IRI ROS Specific Driver Class. More...
#include <tibi_dabo_battery_monitor_driver.h>
Public Types | |
typedef tibi_dabo_battery_monitor::TibiDaboBatteryMonitorConfig | Config |
define config type | |
Public Member Functions | |
bool | check_alarm (void) |
bool | check_warning (void) |
bool | closeDriver (void) |
close driver | |
void | config_update (Config &new_cfg, uint32_t level=0) |
config update | |
void | get_battery_info (TBatteryInfo *info) |
bool | openDriver (void) |
open driver | |
bool | startDriver (void) |
start driver | |
bool | stopDriver (void) |
stop driver | |
TibiDaboBatteryMonitorDriver (void) | |
constructor | |
~TibiDaboBatteryMonitorDriver (void) | |
Destructor. | |
Public Attributes | |
Config | config_ |
config variable | |
Static Protected Member Functions | |
static bool | alarm_condition (TBatteryInfo *info) |
static bool | warning_condition (TBatteryInfo *info) |
Private Attributes | |
std::string | alarm_time_to_discharge |
std::string | alarm_time_to_discharge_event_id |
CSegway_Battery * | battery |
std::string | serial_num |
std::string | warning_time_to_discharge |
std::string | warning_time_to_discharge_event_id |
Static Private Attributes | |
static int | alarm_threshold = 5 |
static int | warning_threshold = 15 |
IRI ROS Specific Driver Class.
This class inherits from the IRI Base class IriBaseDriver, which provides the guidelines to implement any specific driver. The IriBaseDriver class offers an easy framework to integrate functional drivers implemented in C++ with the ROS driver structure. ROS driver_base state transitions are already managed by IriBaseDriver.
The TibiDaboBatteryMonitorDriver class must implement all specific driver requirements to safetely open, close, run and stop the driver at any time. It also must guarantee an accessible interface for all driver's parameters.
The TibiDaboBatteryMonitorConfig.cfg needs to be filled up with those parameters suitable to be changed dynamically by the ROS dyanmic reconfigure application. The implementation of the CIriNode class will manage those parameters through methods like postNodeOpenHook() and reconfigureNodeHook().
Definition at line 53 of file tibi_dabo_battery_monitor_driver.h.
typedef tibi_dabo_battery_monitor::TibiDaboBatteryMonitorConfig TibiDaboBatteryMonitorDriver::Config |
define config type
Define a Config type with the TibiDaboBatteryMonitorConfig. All driver implementations will then use the same variable type Config.
Definition at line 77 of file tibi_dabo_battery_monitor_driver.h.
constructor
In this constructor parameters related to the specific driver can be initalized. Those parameters can be also set in the openDriver() function. Attributes from the main node driver class IriBaseDriver such as loop_rate, may be also overload here.
Definition at line 7 of file tibi_dabo_battery_monitor_driver.cpp.
Destructor.
This destructor is called when the object is about to be destroyed.
Definition at line 131 of file tibi_dabo_battery_monitor_driver.cpp.
bool TibiDaboBatteryMonitorDriver::alarm_condition | ( | TBatteryInfo * | info | ) | [static, protected] |
Definition at line 123 of file tibi_dabo_battery_monitor_driver.cpp.
Definition at line 84 of file tibi_dabo_battery_monitor_driver.cpp.
Definition at line 97 of file tibi_dabo_battery_monitor_driver.cpp.
bool TibiDaboBatteryMonitorDriver::closeDriver | ( | void | ) | [virtual] |
close driver
In this function, the driver must be closed. Variables related to the driver state must also be taken into account. This function is automatically called by IriBaseDriver::doClose(), an state transition is performed if return value equals true.
Implements iri_base_driver::IriBaseDriver.
Definition at line 36 of file tibi_dabo_battery_monitor_driver.cpp.
void TibiDaboBatteryMonitorDriver::config_update | ( | Config & | new_cfg, |
uint32_t | level = 0 |
||
) |
config update
In this function the driver parameters must be updated with the input config variable. Then the new configuration state will be stored in the Config attribute.
new_cfg | the new driver configuration state |
level | level in which the update is taken place |
Definition at line 57 of file tibi_dabo_battery_monitor_driver.cpp.
void TibiDaboBatteryMonitorDriver::get_battery_info | ( | TBatteryInfo * | info | ) |
Definition at line 110 of file tibi_dabo_battery_monitor_driver.cpp.
bool TibiDaboBatteryMonitorDriver::openDriver | ( | void | ) | [virtual] |
open driver
In this function, the driver must be openned. Openning errors must be taken into account. This function is automatically called by IriBaseDriver::doOpen(), an state transition is performed if return value equals true.
Implements iri_base_driver::IriBaseDriver.
Definition at line 16 of file tibi_dabo_battery_monitor_driver.cpp.
bool TibiDaboBatteryMonitorDriver::startDriver | ( | void | ) | [virtual] |
start driver
After this function, the driver and its thread will be started. The driver and related variables should be properly setup. This function is automatically called by IriBaseDriver::doStart(), an state transition is performed if return value equals true.
Implements iri_base_driver::IriBaseDriver.
Definition at line 47 of file tibi_dabo_battery_monitor_driver.cpp.
bool TibiDaboBatteryMonitorDriver::stopDriver | ( | void | ) | [virtual] |
stop driver
After this function, the driver's thread will stop its execution. The driver and related variables should be properly setup. This function is automatically called by IriBaseDriver::doStop(), an state transition is performed if return value equals true.
Implements iri_base_driver::IriBaseDriver.
Definition at line 52 of file tibi_dabo_battery_monitor_driver.cpp.
bool TibiDaboBatteryMonitorDriver::warning_condition | ( | TBatteryInfo * | info | ) | [static, protected] |
Definition at line 115 of file tibi_dabo_battery_monitor_driver.cpp.
int TibiDaboBatteryMonitorDriver::alarm_threshold = 5 [static, private] |
Definition at line 66 of file tibi_dabo_battery_monitor_driver.h.
std::string TibiDaboBatteryMonitorDriver::alarm_time_to_discharge [private] |
Definition at line 64 of file tibi_dabo_battery_monitor_driver.h.
std::string TibiDaboBatteryMonitorDriver::alarm_time_to_discharge_event_id [private] |
Definition at line 65 of file tibi_dabo_battery_monitor_driver.h.
CSegway_Battery* TibiDaboBatteryMonitorDriver::battery [private] |
Definition at line 57 of file tibi_dabo_battery_monitor_driver.h.
config variable
This variable has all the driver parameters defined in the cfg config file. Is updated everytime function config_update() is called.
Definition at line 85 of file tibi_dabo_battery_monitor_driver.h.
std::string TibiDaboBatteryMonitorDriver::serial_num [private] |
Definition at line 58 of file tibi_dabo_battery_monitor_driver.h.
int TibiDaboBatteryMonitorDriver::warning_threshold = 15 [static, private] |
Definition at line 62 of file tibi_dabo_battery_monitor_driver.h.
std::string TibiDaboBatteryMonitorDriver::warning_time_to_discharge [private] |
Definition at line 60 of file tibi_dabo_battery_monitor_driver.h.
std::string TibiDaboBatteryMonitorDriver::warning_time_to_discharge_event_id [private] |
Definition at line 61 of file tibi_dabo_battery_monitor_driver.h.