Public Types | Private Member Functions | Private Attributes | List of all members
atlascar_base::Manager Class Reference

Global management and control class. More...

#include <manager.h>

Public Types

enum  CarState {
  UNKNOWN, INIT, STOPPED, MOVING,
  STOPPED_TO_MOVING, MOVING_TO_STOPPED
}
 Car state machine status. More...
 
enum  sequentialState { FIRST, SECOND, THIRD }
 Car stages. More...
 

Public Member Functions

Mandatory common functions

These functions are mandatory to all low level classes in the atlacar_base namespace. All these must operate in a similar fashion across class. The constructor must only initialize variable values, all major initializations must be done in the init() function, setupMessaging() subscribes and advertises command messages and status (in that order). The loop() function will block the program in a constant loop relaying information to the hardware.

The loop() function can operate in two fashions: setting a spin rate and calling ros::spinOnce() or calling directly ros::spin() if the command callback has been setup properly. In this class (Manager) it works by calling the ros::spinOnce() at a predefined rate.

Warning
These functions are MANDATORY
 Manager (const ros::NodeHandle &nh)
 Class constructor. More...
 
 ~Manager ()
 Class destructor. More...
 
void init ()
 Initialize the class. More...
 
void setupMessaging ()
 Start ros message subscribing and advertising. More...
 
void loop ()
 Start main control loop. More...
 

Private Member Functions

void commandCallback (const atlascar_base::ManagerCommandPtr &command)
 Main command callback. More...
 
void driverStatusCallback (const human_driver_monitor::HumanDriverMonitorStatusPtr &status)
 Driver status callback. More...
 
void gearboxStatusCallback (const atlascar_base::GearboxStatusPtr &status)
 Gearbox status callback. More...
 
CarState getCurrentState ()
 Check Current State. More...
 
void movingToStopped ()
 Moving to Stopped. More...
 
void odometerStatusCallback (const odometer::OdometerStatusPtr &status)
 Velocity status callback. More...
 
void plcStatusCallback (const atlascar_base::PlcStatusPtr &status)
 Plc status callback. More...
 
void stateManager (const atlascar_base::ManagerCommandPtr &command)
 State Manager. More...
 
void stoppedToMoving ()
 Stopped to Moving. More...
 
void throttleStatusCallback (const atlascar_base::ThrottleStatusPtr &status)
 Throttle status callback. More...
 
void toOutgoingMessages (const atlascar_base::ManagerCommandPtr &command)
 Messages. More...
 

Private Attributes

atlascar_base::ManagerCommandPtr command_
 Command message pointer. More...
 
ros::Publisher command_gearbox_pub_
 Gearbox command publisher. More...
 
ros::Publisher command_plc_pub_
 Plc command publisher. More...
 
TopicQueuePriority
< atlascar_base::ManagerCommandPtr > 
command_queue_
 Command queue holding class. More...
 
ros::Subscriber command_sub_
 Ros command subscriber. More...
 
ros::Publisher command_throttle_pub_
 Throttle command publisher. More...
 
CarState current_state
 Current state of state machine. More...
 
human_driver_monitor::HumanDriverMonitorStatus driver_status_
 Driver status message. More...
 
atlascar_base::GearboxCommand gearbox_command_
 Gearbox command message. More...
 
atlascar_base::GearboxStatus gearbox_status_
 Gearbox status message. More...
 
sequentialState mts_state
 Moving to stopped state. More...
 
ros::NodeHandle nh_
 Ros node handler. More...
 
odometer::OdometerStatus odometer_status_
 Velocity status message. More...
 
atlascar_base::PlcCommand plc_command_
 Plc command message. More...
 
atlascar_base::PlcStatus plc_status_
 Plc status message. More...
 
atlascar_base::ManagerCommandPtr safety_command_
 Safety command message pointer. More...
 
atlascar_base::ManagerStatus status_
 Status message. More...
 
ros::Subscriber status_driver_sub_
 Driver status subscriber. More...
 
ros::Subscriber status_gearbox_sub_
 Gearbox status subscriber. More...
 
ros::Subscriber status_odometer_sub_
 Velocity status subscriber. More...
 
ros::Subscriber status_plc_sub_
 Plc status subscriber. More...
 
ros::Publisher status_pub_
 Ros status publisher. More...
 
ros::Subscriber status_throttle_sub_
 Throttle status subscriber. More...
 
sequentialState stm_state
 Stopped to moving state. More...
 
uint target_gear_
 
atlascar_base::ThrottleCommand throttle_command_
 Throttle command message. More...
 
atlascar_base::ThrottleStatus throttle_status_
 Throttle status message. More...
 
bool verbose_
 Verbose mode. More...
 

Detailed Description

Global management and control class.

This class is responsible for the synchronization, calibration and contextual control for the atlascar vehicle. The class communicates locally with the low level modules via command and status messages. The received status messages must be interpreted and calibrated while being integrated into global asynchronous status publisher. The global atlascar_base::ManagerStatus in periodically published independently of the frequency of incoming partial status messages. The manager receives global control messages atlascar_base::ManagerCommand.

Definition at line 72 of file manager.h.

Member Enumeration Documentation

Car state machine status.

Define all states of macine

Enumerator
UNKNOWN 
INIT 
STOPPED 
MOVING 
STOPPED_TO_MOVING 
MOVING_TO_STOPPED 

Definition at line 134 of file manager.h.

Car stages.

Define all stages

Enumerator
FIRST 
SECOND 
THIRD 

Definition at line 150 of file manager.h.

Constructor & Destructor Documentation

atlascar_base::Manager::Manager ( const ros::NodeHandle &  nh)

Class constructor.

Initialize variables, do not call any function

Definition at line 37 of file manager.cpp.

atlascar_base::Manager::~Manager ( )

Class destructor.

Do nothing.

Definition at line 41 of file manager.cpp.

Member Function Documentation

void atlascar_base::Manager::commandCallback ( const atlascar_base::ManagerCommandPtr &  command)
private

Main command callback.

Receive command messages from outside the atlascar_base.

Definition at line 116 of file manager.cpp.

void atlascar_base::Manager::driverStatusCallback ( const human_driver_monitor::HumanDriverMonitorStatusPtr &  status)
private

Driver status callback.

Receive status messages from the Driver low level module

Definition at line 139 of file manager.cpp.

void atlascar_base::Manager::gearboxStatusCallback ( const atlascar_base::GearboxStatusPtr &  status)
private

Gearbox status callback.

Receive status messages from the Gearbox low level module

Definition at line 164 of file manager.cpp.

Manager::CarState atlascar_base::Manager::getCurrentState ( )
private

Check Current State.

Analyse the velocity and choose the current state

Definition at line 177 of file manager.cpp.

void atlascar_base::Manager::init ( )

Initialize the class.

Add the safety message to the command queue.

Definition at line 44 of file manager.cpp.

void atlascar_base::Manager::loop ( )

Start main control loop.

Start ros spin and main state machine.

Definition at line 328 of file manager.cpp.

void atlascar_base::Manager::movingToStopped ( )
private

Moving to Stopped.

Redefine values of variables to be send

Definition at line 208 of file manager.cpp.

void atlascar_base::Manager::odometerStatusCallback ( const odometer::OdometerStatusPtr &  status)
private

Velocity status callback.

Receive status messages from the Velocity low level module

Definition at line 156 of file manager.cpp.

void atlascar_base::Manager::plcStatusCallback ( const atlascar_base::PlcStatusPtr &  status)
private

Plc status callback.

Receive status messages from the Plc low level module

Definition at line 121 of file manager.cpp.

void atlascar_base::Manager::setupMessaging ( )

Start ros message subscribing and advertising.

Subscribe local command messages and advertise local status messages. Subscribe to all low level status messages, and advertise all low level command messages.

Definition at line 58 of file manager.cpp.

void atlascar_base::Manager::stateManager ( const atlascar_base::ManagerCommandPtr &  command)
private

State Manager.

Analyzes the state of state machine

Definition at line 274 of file manager.cpp.

void atlascar_base::Manager::stoppedToMoving ( )
private

Stopped to Moving.

Redefine values of variables to be send

Definition at line 225 of file manager.cpp.

void atlascar_base::Manager::throttleStatusCallback ( const atlascar_base::ThrottleStatusPtr &  status)
private

Throttle status callback.

Receive status messages from the Throttle low level module

Definition at line 170 of file manager.cpp.

void atlascar_base::Manager::toOutgoingMessages ( const atlascar_base::ManagerCommandPtr &  command)
private

Messages.

Put command message into outgoing messages

Definition at line 76 of file manager.cpp.

Member Data Documentation

atlascar_base::ManagerCommandPtr atlascar_base::Manager::command_
private

Command message pointer.

Definition at line 273 of file manager.h.

ros::Publisher atlascar_base::Manager::command_gearbox_pub_
private

Gearbox command publisher.

Definition at line 265 of file manager.h.

ros::Publisher atlascar_base::Manager::command_plc_pub_
private

Plc command publisher.

Definition at line 263 of file manager.h.

TopicQueuePriority<atlascar_base::ManagerCommandPtr> atlascar_base::Manager::command_queue_
private

Command queue holding class.

Definition at line 269 of file manager.h.

ros::Subscriber atlascar_base::Manager::command_sub_
private

Ros command subscriber.

Definition at line 249 of file manager.h.

ros::Publisher atlascar_base::Manager::command_throttle_pub_
private

Throttle command publisher.

Definition at line 267 of file manager.h.

CarState atlascar_base::Manager::current_state
private

Current state of state machine.

Definition at line 243 of file manager.h.

human_driver_monitor::HumanDriverMonitorStatus atlascar_base::Manager::driver_status_
private

Driver status message.

Definition at line 287 of file manager.h.

atlascar_base::GearboxCommand atlascar_base::Manager::gearbox_command_
private

Gearbox command message.

Definition at line 279 of file manager.h.

atlascar_base::GearboxStatus atlascar_base::Manager::gearbox_status_
private

Gearbox status message.

Definition at line 281 of file manager.h.

sequentialState atlascar_base::Manager::mts_state
private

Moving to stopped state.

Definition at line 241 of file manager.h.

ros::NodeHandle atlascar_base::Manager::nh_
private

Ros node handler.

Definition at line 247 of file manager.h.

odometer::OdometerStatus atlascar_base::Manager::odometer_status_
private

Velocity status message.

Definition at line 293 of file manager.h.

atlascar_base::PlcCommand atlascar_base::Manager::plc_command_
private

Plc command message.

Definition at line 283 of file manager.h.

atlascar_base::PlcStatus atlascar_base::Manager::plc_status_
private

Plc status message.

Definition at line 285 of file manager.h.

atlascar_base::ManagerCommandPtr atlascar_base::Manager::safety_command_
private

Safety command message pointer.

Definition at line 275 of file manager.h.

atlascar_base::ManagerStatus atlascar_base::Manager::status_
private

Status message.

Definition at line 277 of file manager.h.

ros::Subscriber atlascar_base::Manager::status_driver_sub_
private

Driver status subscriber.

Definition at line 253 of file manager.h.

ros::Subscriber atlascar_base::Manager::status_gearbox_sub_
private

Gearbox status subscriber.

Definition at line 257 of file manager.h.

ros::Subscriber atlascar_base::Manager::status_odometer_sub_
private

Velocity status subscriber.

Definition at line 255 of file manager.h.

ros::Subscriber atlascar_base::Manager::status_plc_sub_
private

Plc status subscriber.

Definition at line 251 of file manager.h.

ros::Publisher atlascar_base::Manager::status_pub_
private

Ros status publisher.

Definition at line 261 of file manager.h.

ros::Subscriber atlascar_base::Manager::status_throttle_sub_
private

Throttle status subscriber.

Definition at line 259 of file manager.h.

sequentialState atlascar_base::Manager::stm_state
private

Stopped to moving state.

Definition at line 239 of file manager.h.

uint atlascar_base::Manager::target_gear_
private

Definition at line 245 of file manager.h.

atlascar_base::ThrottleCommand atlascar_base::Manager::throttle_command_
private

Throttle command message.

Definition at line 289 of file manager.h.

atlascar_base::ThrottleStatus atlascar_base::Manager::throttle_status_
private

Throttle status message.

Definition at line 291 of file manager.h.

bool atlascar_base::Manager::verbose_
private

Verbose mode.

Definition at line 271 of file manager.h.


The documentation for this class was generated from the following files:


atlascar_base
Author(s): Jorge Almeida, Sérgio Pinho, Miguel Oliveira, Pedro Salvado, Andre Oliveira and Pedro Pinheiro
autogenerated on Mon Mar 2 2015 01:31:23