IRI ROS Specific Driver Class. More...
#include <darwin_robot_driver.h>
Public Types | |
typedef iri_darwin_robot::DarwinRobotConfig | Config |
define config type | |
Public Member Functions | |
bool | action_is_running (void) |
void | break_action (void) |
bool | closeDriver (void) |
close driver | |
void | config_update (Config &new_cfg, uint32_t level=0) |
config update | |
DarwinRobotDriver (void) | |
constructor | |
void | get_accelerometer (double *x, double *y, double *z) |
void | get_analog_channel (analogs id, double *value) |
std::vector< double > | get_current_angles (void) |
void | get_gyroscope (double *x, double *y, double *z) |
void | get_head_position (double *pan, double *tilt) |
void | get_tracking_pid (int *t, TPID *pan_pid, TPID *tilt_pid) |
void | get_tracking_target (double *pan, double *tilt) |
double | get_walking_param (motion_params param) |
bool | is_walking (void) |
bool | joints_are_moving (std::string &target_id) |
std::string | move_joints (std::vector< int > &servos, std::vector< double > &angles, std::vector< double > &speeds, std::vector< double > &accels, const std::string &target_id=std::string("")) |
bool | openDriver (void) |
open driver | |
void | set_head_position (double pan, double tilt) |
void | set_tracking_pid (int t, TPID *pan_pid, TPID *tilt_pid) |
void | set_tracking_target (double pan, double tilt) |
void | set_walking_param (motion_params param, double value) |
void | start_action (unsigned int action_index) |
void | start_action (std::string &action_name) |
void | start_head_tracking (void) |
void | start_walking (double x_dist, double y_dist, double turn_angle) |
bool | startDriver (void) |
start driver | |
void | stop_action (void) |
void | stop_head_tracking (void) |
void | stop_joints (std::string &target_id) |
void | stop_walking (void) |
bool | stopDriver (void) |
stop driver | |
void | tune_walking (double x_dist, double y_dist, double turn_angle) |
~DarwinRobotDriver (void) | |
Destructor. | |
Public Attributes | |
Config | config_ |
config variable | |
Private Attributes | |
std::string | action_file |
std::string | CM730_device |
std::string | config_file |
CDarwin * | robot |
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 DarwinNodeDriver 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 DarwinNodeConfig.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 54 of file darwin_robot_driver.h.
typedef iri_darwin_robot::DarwinRobotConfig DarwinRobotDriver::Config |
define config type
Define a Config type with the DarwinNodeConfig. All driver implementations will then use the same variable type Config.
Definition at line 72 of file darwin_robot_driver.h.
DarwinRobotDriver::DarwinRobotDriver | ( | void | ) |
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 4 of file darwin_robot_driver.cpp.
Destructor.
This destructor is called when the object is about to be destroyed.
Definition at line 236 of file darwin_robot_driver.cpp.
bool DarwinRobotDriver::action_is_running | ( | void | ) |
Definition at line 157 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::break_action | ( | void | ) |
Definition at line 152 of file darwin_robot_driver.cpp.
bool DarwinRobotDriver::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 32 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::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 56 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::get_accelerometer | ( | double * | x, |
double * | y, | ||
double * | z | ||
) |
Definition at line 179 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::get_analog_channel | ( | analogs | id, |
double * | value | ||
) |
Definition at line 184 of file darwin_robot_driver.cpp.
std::vector< double > DarwinRobotDriver::get_current_angles | ( | void | ) |
Definition at line 100 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::get_gyroscope | ( | double * | x, |
double * | y, | ||
double * | z | ||
) |
Definition at line 174 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::get_head_position | ( | double * | pan, |
double * | tilt | ||
) |
Definition at line 163 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::get_tracking_pid | ( | int * | t, |
TPID * | pan_pid, | ||
TPID * | tilt_pid | ||
) |
Definition at line 221 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::get_tracking_target | ( | double * | pan, |
double * | tilt | ||
) |
Definition at line 231 of file darwin_robot_driver.cpp.
double DarwinRobotDriver::get_walking_param | ( | motion_params | param | ) |
Definition at line 121 of file darwin_robot_driver.cpp.
bool DarwinRobotDriver::is_walking | ( | void | ) |
Definition at line 131 of file darwin_robot_driver.cpp.
bool DarwinRobotDriver::joints_are_moving | ( | std::string & | target_id | ) |
Definition at line 195 of file darwin_robot_driver.cpp.
std::string DarwinRobotDriver::move_joints | ( | std::vector< int > & | servos, |
std::vector< double > & | angles, | ||
std::vector< double > & | speeds, | ||
std::vector< double > & | accels, | ||
const std::string & | target_id = std::string("") |
||
) |
Definition at line 190 of file darwin_robot_driver.cpp.
bool DarwinRobotDriver::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 14 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::set_head_position | ( | double | pan, |
double | tilt | ||
) |
Definition at line 168 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::set_tracking_pid | ( | int | t, |
TPID * | pan_pid, | ||
TPID * | tilt_pid | ||
) |
Definition at line 216 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::set_tracking_target | ( | double | pan, |
double | tilt | ||
) |
Definition at line 226 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::set_walking_param | ( | motion_params | param, |
double | value | ||
) |
Definition at line 116 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::start_action | ( | unsigned int | action_index | ) |
Definition at line 137 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::start_action | ( | std::string & | action_name | ) |
Definition at line 142 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::start_head_tracking | ( | void | ) |
Definition at line 206 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::start_walking | ( | double | x_dist, |
double | y_dist, | ||
double | turn_angle | ||
) |
Definition at line 106 of file darwin_robot_driver.cpp.
bool DarwinRobotDriver::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 46 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::stop_action | ( | void | ) |
Definition at line 147 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::stop_head_tracking | ( | void | ) |
Definition at line 211 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::stop_joints | ( | std::string & | target_id | ) |
Definition at line 200 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::stop_walking | ( | void | ) |
Definition at line 126 of file darwin_robot_driver.cpp.
bool DarwinRobotDriver::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 51 of file darwin_robot_driver.cpp.
void DarwinRobotDriver::tune_walking | ( | double | x_dist, |
double | y_dist, | ||
double | turn_angle | ||
) |
Definition at line 111 of file darwin_robot_driver.cpp.
std::string DarwinRobotDriver::action_file [private] |
Definition at line 62 of file darwin_robot_driver.h.
std::string DarwinRobotDriver::CM730_device [private] |
Definition at line 60 of file darwin_robot_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 80 of file darwin_robot_driver.h.
std::string DarwinRobotDriver::config_file [private] |
Definition at line 64 of file darwin_robot_driver.h.
CDarwin* DarwinRobotDriver::robot [private] |
Definition at line 58 of file darwin_robot_driver.h.