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

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.

Warning
These functions are MANDATORY
 Gearbox (const ros::NodeHandle &nh)
 Class constructor. More...
 
 ~Gearbox ()
 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 Types

enum  { OFFLINE =0, ONLINE }
 Online and offline states. More...
 

Private Member Functions

void commandCallback (const atlascar_base::GearboxCommandPtr &command)
 Command message handler. More...
 
void diagnostics (diagnostic_updater::DiagnosticStatusWrapper &stat)
 
int interpreterMessage (string &message)
 
int maintainConnection ()
 Keep connection alive. More...
 
int receiveMessage (string &message)
 

Private Attributes

tcp_client * comm_
 TCP client communication class pointer. More...
 
atlascar_base::GearboxCommandPtr command_
 Command message pointer. More...
 
TopicQueuePriority
< atlascar_base::GearboxCommandPtr > 
command_queue_
 Command queue holding class. More...
 
ros::Subscriber command_sub_
 Ros command subscriber. More...
 
int connection_status_
 Current connection status. More...
 
std::string ip_
 
ros::NodeHandle nh_
 Ros node handler. More...
 
int port_
 
atlascar_base::GearboxCommandPtr safety_command_
 Safety command message pointer. More...
 
atlascar_base::GearboxStatus status_
 Status message. More...
 
diagnostic_updater::HeaderlessTopicDiagnostic status_freq_
 
double status_max_frequency_
 
double status_min_frequency_
 
ros::Publisher status_pub_
 Ros status publisher. More...
 
diagnostic_updater::Updater updater_
 
bool verbose_
 Verbose mode. More...
 

Detailed Description

This class is not fully documented!

Warning
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.

Enumerator
OFFLINE 
ONLINE 

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 38 of file gearbox.cpp.

atlascar_base::Gearbox::~Gearbox ( )

Class destructor.

Definition at line 52 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.

Parameters
commandreceived command message

Definition at line 135 of file gearbox.cpp.

void atlascar_base::Gearbox::diagnostics ( diagnostic_updater::DiagnosticStatusWrapper &  stat)
inlineprivate

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 56 of file gearbox.cpp.

int atlascar_base::Gearbox::interpreterMessage ( string &  message)
private

Definition at line 177 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 79 of file gearbox.cpp.

int atlascar_base::Gearbox::maintainConnection ( )
private

Keep connection alive.

Maintains the connection with the hardware active, reconnects if needed.

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

Definition at line 140 of file gearbox.cpp.

int atlascar_base::Gearbox::receiveMessage ( string &  message)
private

Definition at line 231 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 73 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.

int atlascar_base::Gearbox::connection_status_
private

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.

int atlascar_base::Gearbox::port_
private

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.

double atlascar_base::Gearbox::status_max_frequency_
private

Definition at line 176 of file gearbox.h.

double atlascar_base::Gearbox::status_min_frequency_
private

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.

bool atlascar_base::Gearbox::verbose_
private

Verbose mode.

Definition at line 161 of file gearbox.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