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.
| |
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... | |
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.
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 | ( | ) |
|
private |
Main command callback.
Receive command messages from outside the atlascar_base.
Definition at line 116 of file manager.cpp.
|
private |
Driver status callback.
Receive status messages from the Driver low level module
Definition at line 139 of file manager.cpp.
|
private |
Gearbox status callback.
Receive status messages from the Gearbox low level module
Definition at line 164 of file manager.cpp.
|
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.
|
private |
Moving to Stopped.
Redefine values of variables to be send
Definition at line 208 of file manager.cpp.
|
private |
Velocity status callback.
Receive status messages from the Velocity low level module
Definition at line 156 of file manager.cpp.
|
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.
|
private |
|
private |
Stopped to Moving.
Redefine values of variables to be send
Definition at line 225 of file manager.cpp.
|
private |
Throttle status callback.
Receive status messages from the Throttle low level module
Definition at line 170 of file manager.cpp.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |