Protected Member Functions | Protected Attributes | List of all members
human_driver_monitor::HumanDriverMonitor Class Reference

Human driver monitor class. More...

#include <human_driver_monitor.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.

Warning
These functions are MANDATORY
 HumanDriverMonitor (const ros::NodeHandle &nh, std::string ip, std::string port)
 Class constructor. More...
 
 ~HumanDriverMonitor ()
 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...
 

Protected Member Functions

void connectHandler (void)
 This function will be called (asynchronously) on a successful connection. More...
 
void diagnostics (diagnostic_updater::DiagnosticStatusWrapper &stat)
 Diagnostics function handler. More...
 
void newData (string data)
 This function will be called (asynchronously) upon arrival of new data. More...
 

Protected Attributes

AsyncClient comm_
 Asynchronous tcp/ip communication object. More...
 
boost::asio::io_service io_service_
 Input/Output communication service. More...
 
ros::NodeHandle nh_
 Ros node handler. More...
 
std::string server_ip_
 Ip of the Arduino server. More...
 
std::string server_port_
 Port of the Arduino server. More...
 
human_driver_monitor::HumanDriverMonitorStatus status_
 Status message. More...
 
diagnostic_updater::HeaderlessTopicDiagnostic status_freq_
 Frequency diagnostics tool. More...
 
double status_max_frequency_
 Maximum admissible frequency. More...
 
double status_min_frequency_
 Minimum admissible frequency. More...
 
ros::Publisher status_pub_
 Ros status publisher. More...
 
diagnostic_updater::Updater updater_
 Diagnostics class. More...
 

Detailed Description

Human driver monitor class.

This class handles all communication with the human driver monitor Arduino. This system monitors the human driver interaction with some of the vehicle actuators, namely: lights and pedals.

Definition at line 62 of file human_driver_monitor.h.

Constructor & Destructor Documentation

human_driver_monitor::HumanDriverMonitor::HumanDriverMonitor ( const ros::NodeHandle &  nh,
std::string  ip,
std::string  port 
)
inline

Class constructor.

Mandatory. Should only be used for variable initialization.

The constructor is used to set the server ip and port, initializing the communications service and object and the ros node handler. It also initializes the frequency diagnostics tool with the allowed maximum and minimum frequency.

Definition at line 83 of file human_driver_monitor.h.

human_driver_monitor::HumanDriverMonitor::~HumanDriverMonitor ( )
inline

Class destructor.

Definition at line 96 of file human_driver_monitor.h.

Member Function Documentation

void human_driver_monitor::HumanDriverMonitor::connectHandler ( void  )
inlineprotected

This function will be called (asynchronously) on a successful connection.

This function sends the start command to the Arduino, this order will signal the Arduino to start sending data.

Definition at line 174 of file human_driver_monitor.h.

void human_driver_monitor::HumanDriverMonitor::diagnostics ( diagnostic_updater::DiagnosticStatusWrapper &  stat)
inlineprotected

Diagnostics function handler.

Parameters
statdiagnostics information storage

This function preforms diagnostics on the communication with the Arduino and reports back to the diagnostics tool.

Definition at line 263 of file human_driver_monitor.h.

void human_driver_monitor::HumanDriverMonitor::init ( )
inline

Initialize the class.

Mandatory. To specific initialization tasks, anything that cannot be preformed in the constructor should be done here.

This function initializes the diagnostics tool and sets the communication handlers for received data and connection established.

Definition at line 107 of file human_driver_monitor.h.

void human_driver_monitor::HumanDriverMonitor::loop ( )
inline

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.

This function launches the io service in a separate thread and then starts to do spin ros. The while cycle is used to update the diagnostics tool only. Once the ros::ok() returns false the io service is stopped the thread closed and the loop quits.

Definition at line 141 of file human_driver_monitor.h.

void human_driver_monitor::HumanDriverMonitor::newData ( string  data)
inlineprotected

This function will be called (asynchronously) upon arrival of new data.

Parameters
dataincoming data in std::string format

This function handles new data coming from the Arduino. The new data is interpreted and a status message is published.

Definition at line 191 of file human_driver_monitor.h.

void human_driver_monitor::HumanDriverMonitor::setupMessaging ( )
inline

Start ros message subscribing and advertising.

Mandatory. Subscribe command messages and advertise status messages.

This function only advertises the status messages.

Definition at line 127 of file human_driver_monitor.h.

Member Data Documentation

AsyncClient human_driver_monitor::HumanDriverMonitor::comm_
protected

Asynchronous tcp/ip communication object.

Definition at line 309 of file human_driver_monitor.h.

boost::asio::io_service human_driver_monitor::HumanDriverMonitor::io_service_
protected

Input/Output communication service.

Definition at line 307 of file human_driver_monitor.h.

ros::NodeHandle human_driver_monitor::HumanDriverMonitor::nh_
protected

Ros node handler.

Definition at line 290 of file human_driver_monitor.h.

std::string human_driver_monitor::HumanDriverMonitor::server_ip_
protected

Ip of the Arduino server.

Definition at line 285 of file human_driver_monitor.h.

std::string human_driver_monitor::HumanDriverMonitor::server_port_
protected

Port of the Arduino server.

Definition at line 287 of file human_driver_monitor.h.

human_driver_monitor::HumanDriverMonitorStatus human_driver_monitor::HumanDriverMonitor::status_
protected

Status message.

Definition at line 296 of file human_driver_monitor.h.

diagnostic_updater::HeaderlessTopicDiagnostic human_driver_monitor::HumanDriverMonitor::status_freq_
protected

Frequency diagnostics tool.

Definition at line 301 of file human_driver_monitor.h.

double human_driver_monitor::HumanDriverMonitor::status_max_frequency_
protected

Maximum admissible frequency.

Definition at line 303 of file human_driver_monitor.h.

double human_driver_monitor::HumanDriverMonitor::status_min_frequency_
protected

Minimum admissible frequency.

Definition at line 305 of file human_driver_monitor.h.

ros::Publisher human_driver_monitor::HumanDriverMonitor::status_pub_
protected

Ros status publisher.

Definition at line 293 of file human_driver_monitor.h.

diagnostic_updater::Updater human_driver_monitor::HumanDriverMonitor::updater_
protected

Diagnostics class.

Definition at line 299 of file human_driver_monitor.h.


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


human_driver_monitor
Author(s): Jorge Almeida
autogenerated on Mon Mar 2 2015 01:31:41