This class is not fully documented! More...
#include <gearbox.h>
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 (Gearbox) it works by calling the ros::spinOnce() at a predefined rate.
| |
Gearbox (const ros::NodeHandle &nh) | |
Class constructor. | |
void | init () |
Initialize the class. | |
void | loop () |
Start main control loop. | |
void | setupMessaging () |
Start ros message subscribing and advertising. | |
~Gearbox () | |
Class destructor. | |
Private Types | |
enum | { OFFLINE = 0, ONLINE } |
Online and offline states. More... | |
Private Member Functions | |
void | commandCallback (const atlascar_base::GearboxCommandPtr &command) |
Command message handler. | |
void | diagnostics (diagnostic_updater::DiagnosticStatusWrapper &stat) |
int | interpreterMessage (string &message) |
int | maintainConnection () |
Keep connection alive. | |
int | receiveMessage (string &message) |
Private Attributes | |
tcp_client * | comm_ |
TCP client communication class pointer. | |
atlascar_base::GearboxCommandPtr | command_ |
Command message pointer. | |
TopicQueuePriority < atlascar_base::GearboxCommandPtr > | command_queue_ |
Command queue holding class. | |
ros::Subscriber | command_sub_ |
Ros command subscriber. | |
int | connection_status_ |
Current connection status. | |
std::string | ip_ |
ros::NodeHandle | nh_ |
Ros node handler. | |
int | port_ |
atlascar_base::GearboxCommandPtr | safety_command_ |
Safety command message pointer. | |
atlascar_base::GearboxStatus | status_ |
Status message. | |
diagnostic_updater::HeaderlessTopicDiagnostic | status_freq_ |
double | status_max_frequency_ |
double | status_min_frequency_ |
ros::Publisher | status_pub_ |
Ros status publisher. | |
diagnostic_updater::Updater | updater_ |
bool | verbose_ |
Verbose mode. |
This class is not fully documented!
The documentation of this class is the responsibility of masters student Pedro Pinheiro (assigned by Jorge Almeida)
Definition at line 59 of file gearbox.h.
anonymous enum [private] |
atlascar_base::Gearbox::Gearbox | ( | const ros::NodeHandle & | nh | ) |
Class constructor.
Mandatory. Should only be used for variable initialization.
Definition at line 35 of file gearbox.cpp.
atlascar_base::Gearbox::~Gearbox | ( | ) |
Class destructor.
Definition at line 46 of file gearbox.cpp.
void atlascar_base::Gearbox::commandCallback | ( | const atlascar_base::GearboxCommandPtr & | command | ) | [private] |
Command message handler.
Receive command messages and put them in the queue.
command | received command message |
Definition at line 121 of file gearbox.cpp.
void atlascar_base::Gearbox::diagnostics | ( | diagnostic_updater::DiagnosticStatusWrapper & | stat | ) | [inline, private] |
void atlascar_base::Gearbox::init | ( | ) |
Initialize the class.
Mandatory. To specific initialization tasks, anything that cannot be preformed in the constructor should be done here.
Definition at line 50 of file gearbox.cpp.
int atlascar_base::Gearbox::interpreterMessage | ( | string & | message | ) | [private] |
Definition at line 163 of file gearbox.cpp.
void atlascar_base::Gearbox::loop | ( | ) |
Start main control loop.
Mandatory. Do the main loop of the program, call ros spin or spinOnce as needed, should only quit on ros exit command.
Definition at line 73 of file gearbox.cpp.
int atlascar_base::Gearbox::maintainConnection | ( | ) | [private] |
Keep connection alive.
Maintains the connection with the hardware active, reconnects if needed.
Definition at line 126 of file gearbox.cpp.
int atlascar_base::Gearbox::receiveMessage | ( | string & | message | ) | [private] |
Definition at line 210 of file gearbox.cpp.
void atlascar_base::Gearbox::setupMessaging | ( | ) |
Start ros message subscribing and advertising.
Mandatory. Subscribe command messages and advertise status messages.
Definition at line 67 of file gearbox.cpp.
tcp_client* atlascar_base::Gearbox::comm_ [private] |
atlascar_base::GearboxCommandPtr atlascar_base::Gearbox::command_ [private] |
TopicQueuePriority<atlascar_base::GearboxCommandPtr> atlascar_base::Gearbox::command_queue_ [private] |
ros::Subscriber atlascar_base::Gearbox::command_sub_ [private] |
int atlascar_base::Gearbox::connection_status_ [private] |
std::string atlascar_base::Gearbox::ip_ [private] |
ros::NodeHandle atlascar_base::Gearbox::nh_ [private] |
int atlascar_base::Gearbox::port_ [private] |
atlascar_base::GearboxCommandPtr atlascar_base::Gearbox::safety_command_ [private] |
atlascar_base::GearboxStatus atlascar_base::Gearbox::status_ [private] |
diagnostic_updater::HeaderlessTopicDiagnostic atlascar_base::Gearbox::status_freq_ [private] |
double atlascar_base::Gearbox::status_max_frequency_ [private] |
double atlascar_base::Gearbox::status_min_frequency_ [private] |
ros::Publisher atlascar_base::Gearbox::status_pub_ [private] |
diagnostic_updater::Updater atlascar_base::Gearbox::updater_ [private] |
bool atlascar_base::Gearbox::verbose_ [private] |