atlascar_base::Gearbox Class Reference

This class is not fully documented! More...

#include <gearbox.h>

List of all members.

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.

These functions are MANDATORY
 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.


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.
< atlascar_base::GearboxCommandPtr > 
 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.

Detailed Description

This class is not fully documented!

Missing documentation!!

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.

Member Enumeration Documentation

anonymous enum [private]

Online and offline states.


Definition at line 146 of file gearbox.h.

Constructor & Destructor Documentation

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.

Member Function Documentation

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]

Definition at line 114 of file gearbox.h.

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.

0 if connection active or reconnection successful, -1 on reconnection fail

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.

Member Data Documentation

tcp_client* atlascar_base::Gearbox::comm_ [private]

TCP client communication class pointer.

Definition at line 155 of file gearbox.h.

atlascar_base::GearboxCommandPtr atlascar_base::Gearbox::command_ [private]

Command message pointer.

Definition at line 163 of file gearbox.h.

TopicQueuePriority<atlascar_base::GearboxCommandPtr> atlascar_base::Gearbox::command_queue_ [private]

Command queue holding class.

Definition at line 157 of file gearbox.h.

ros::Subscriber atlascar_base::Gearbox::command_sub_ [private]

Ros command subscriber.

Definition at line 151 of file gearbox.h.

Current connection status.

Definition at line 159 of file gearbox.h.

std::string atlascar_base::Gearbox::ip_ [private]

Definition at line 169 of file gearbox.h.

ros::NodeHandle atlascar_base::Gearbox::nh_ [private]

Ros node handler.

Definition at line 149 of file gearbox.h.

Definition at line 171 of file gearbox.h.

atlascar_base::GearboxCommandPtr atlascar_base::Gearbox::safety_command_ [private]

Safety command message pointer.

Definition at line 165 of file gearbox.h.

atlascar_base::GearboxStatus atlascar_base::Gearbox::status_ [private]

Status message.

Definition at line 167 of file gearbox.h.

diagnostic_updater::HeaderlessTopicDiagnostic atlascar_base::Gearbox::status_freq_ [private]

Definition at line 175 of file gearbox.h.

Definition at line 176 of file gearbox.h.

Definition at line 177 of file gearbox.h.

ros::Publisher atlascar_base::Gearbox::status_pub_ [private]

Ros status publisher.

Definition at line 153 of file gearbox.h.

diagnostic_updater::Updater atlascar_base::Gearbox::updater_ [private]

Definition at line 174 of file gearbox.h.

Verbose mode.

Definition at line 161 of file gearbox.h.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Author(s): Jorge Almeida, Miguel Oliveira, Pedro Salvado, Andre Oliveira and Pedro Pinheiro
autogenerated on Wed Jul 23 04:34:35 2014