IRI ROS Specific Driver Class. More...
#include <tcm3_compass_driver_node.h>
Public Member Functions | |
Tcm3CompassDriverNode (ros::NodeHandle &nh) | |
constructor | |
~Tcm3CompassDriverNode () | |
Destructor. | |
Protected Member Functions | |
void | addNodeDiagnostics (void) |
node add diagnostics | |
void | addNodeOpenedTests (void) |
open status driver tests | |
void | addNodeRunningTests (void) |
run status driver tests | |
void | addNodeStoppedTests (void) |
stop status driver tests | |
void | mainNodeThread (void) |
main node thread | |
void | reconfigureNodeHook (int level) |
specific node dynamic reconfigure | |
Private Member Functions | |
double | covariance (vector< double > x, vector< double > y) |
void | covarianceMatrix (vector< double > x, vector< double > y, vector< double > z, vector< double > &matrix) |
void | postNodeOpenHook (void) |
post open hook | |
Private Attributes | |
iri_common_drivers_msgs::compass3axis | compass3axis_msg_ |
uint | covariance_buffer_length_ |
uint | data_counter_ |
bool | distortion_ |
double | heading_ |
double | pitch_ |
double | roll_ |
ros::Publisher | tcm3_publisher_ |
vector< double > | vheading_ |
vector< double > | vpitch_ |
vector< double > | vroll_ |
IRI ROS Specific Driver Class.
This class inherits from the IRI Core class IriBaseNodeDriver<IriBaseDriver>, to provide an execution thread to the driver object. A complete framework with utilites to test the node functionallity or to add diagnostics to specific situations is also given. The inherit template design form allows complete access to any IriBaseDriver object implementation.
As mentioned, tests in the different driver states can be performed through class methods such as addNodeOpenedTests() or addNodeRunningTests(). Tests common to all nodes may be also executed in the pattern class IriBaseNodeDriver. Similarly to the tests, diagnostics can easyly be added. See ROS Wiki for more details: http://www.ros.org/wiki/diagnostics/ (Tutorials: Creating a Diagnostic Analyzer) http://www.ros.org/wiki/self_test/ (Example: Self Test)
Definition at line 55 of file tcm3_compass_driver_node.h.
constructor
This constructor mainly creates and initializes the Tcm3CompassDriverNode topics through the given public_node_handle object. IriBaseNodeDriver attributes may be also modified to suit node specifications.
All kind of ROS topics (publishers, subscribers, servers or clients) can be easyly generated with the scripts in the iri_ros_scripts package. Refer to ROS and IRI Wiki pages for more details:
http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber(c++) http://www.ros.org/wiki/ROS/Tutorials/WritingServiceClient(c++) http://wikiri.upc.es/index.php/Robotics_Lab
nh | a reference to the node handle object to manage all ROS topics. |
Definition at line 6 of file tcm3_compass_driver_node.cpp.
Destructor.
This destructor is called when the object is about to be destroyed.
Definition at line 148 of file tcm3_compass_driver_node.cpp.
void Tcm3CompassDriverNode::addNodeDiagnostics | ( | void | ) | [protected, virtual] |
node add diagnostics
In this function ROS diagnostics applied to this specific node may be added. Common use diagnostics for all nodes are already called from IriBaseNodeDriver::addDiagnostics(), which also calls this function. Information of how ROS diagnostics work can be readen here: http://www.ros.org/wiki/diagnostics/ http://www.ros.org/doc/api/diagnostic_updater/html/example_8cpp-source.html
Implements iri_base_driver::IriBaseNodeDriver< Tcm3CompassDriver >.
Definition at line 128 of file tcm3_compass_driver_node.cpp.
void Tcm3CompassDriverNode::addNodeOpenedTests | ( | void | ) | [protected, virtual] |
open status driver tests
In this function tests checking driver's functionallity when driver_base status=open can be added. Common use tests for all nodes are already called from IriBaseNodeDriver tests methods. For more details on how ROS tests work, please refer to the Self Test example in: http://www.ros.org/wiki/self_test/
Implements iri_base_driver::IriBaseNodeDriver< Tcm3CompassDriver >.
Definition at line 132 of file tcm3_compass_driver_node.cpp.
void Tcm3CompassDriverNode::addNodeRunningTests | ( | void | ) | [protected, virtual] |
run status driver tests
In this function tests checking driver's functionallity when driver_base status=run can be added. Common use tests for all nodes are already called from IriBaseNodeDriver tests methods. For more details on how ROS tests work, please refer to the Self Test example in: http://www.ros.org/wiki/self_test/
Implements iri_base_driver::IriBaseNodeDriver< Tcm3CompassDriver >.
Definition at line 140 of file tcm3_compass_driver_node.cpp.
void Tcm3CompassDriverNode::addNodeStoppedTests | ( | void | ) | [protected, virtual] |
stop status driver tests
In this function tests checking driver's functionallity when driver_base status=stop can be added. Common use tests for all nodes are already called from IriBaseNodeDriver tests methods. For more details on how ROS tests work, please refer to the Self Test example in: http://www.ros.org/wiki/self_test/
Implements iri_base_driver::IriBaseNodeDriver< Tcm3CompassDriver >.
Definition at line 136 of file tcm3_compass_driver_node.cpp.
double Tcm3CompassDriverNode::covariance | ( | vector< double > | x, |
vector< double > | y | ||
) | [private] |
Definition at line 175 of file tcm3_compass_driver_node.cpp.
void Tcm3CompassDriverNode::covarianceMatrix | ( | vector< double > | x, |
vector< double > | y, | ||
vector< double > | z, | ||
vector< double > & | matrix | ||
) | [private] |
Definition at line 159 of file tcm3_compass_driver_node.cpp.
void Tcm3CompassDriverNode::mainNodeThread | ( | void | ) | [protected, virtual] |
main node thread
This is the main thread node function. Code written here will be executed in every node loop while the driver is on running state. Loop frequency can be tuned by modifying loop_rate attribute.
Here data related to the process loop or to ROS topics (mainly data structs related to the MSG and SRV files) must be updated. ROS publisher objects must publish their data in this process. ROS client servers may also request data to the corresponding server topics.
Implements iri_base_driver::IriBaseNodeDriver< Tcm3CompassDriver >.
Definition at line 31 of file tcm3_compass_driver_node.cpp.
void Tcm3CompassDriverNode::postNodeOpenHook | ( | void | ) | [private, virtual] |
post open hook
This function is called by IriBaseNodeDriver::postOpenHook(). In this function specific parameters from the driver must be added so the ROS dynamic reconfigure application can update them.
Implements iri_base_driver::IriBaseNodeDriver< Tcm3CompassDriver >.
Definition at line 124 of file tcm3_compass_driver_node.cpp.
void Tcm3CompassDriverNode::reconfigureNodeHook | ( | int | level | ) | [protected, virtual] |
specific node dynamic reconfigure
This function is called reconfigureHook()
level | integer |
Implements iri_base_driver::IriBaseNodeDriver< Tcm3CompassDriver >.
Definition at line 144 of file tcm3_compass_driver_node.cpp.
Definition at line 60 of file tcm3_compass_driver_node.h.
uint Tcm3CompassDriverNode::covariance_buffer_length_ [private] |
Definition at line 69 of file tcm3_compass_driver_node.h.
uint Tcm3CompassDriverNode::data_counter_ [private] |
Definition at line 65 of file tcm3_compass_driver_node.h.
bool Tcm3CompassDriverNode::distortion_ [private] |
Definition at line 64 of file tcm3_compass_driver_node.h.
double Tcm3CompassDriverNode::heading_ [private] |
Definition at line 61 of file tcm3_compass_driver_node.h.
double Tcm3CompassDriverNode::pitch_ [private] |
Definition at line 62 of file tcm3_compass_driver_node.h.
double Tcm3CompassDriverNode::roll_ [private] |
Definition at line 63 of file tcm3_compass_driver_node.h.
Definition at line 59 of file tcm3_compass_driver_node.h.
vector<double> Tcm3CompassDriverNode::vheading_ [private] |
Definition at line 66 of file tcm3_compass_driver_node.h.
vector<double> Tcm3CompassDriverNode::vpitch_ [private] |
Definition at line 68 of file tcm3_compass_driver_node.h.
vector<double> Tcm3CompassDriverNode::vroll_ [private] |
Definition at line 67 of file tcm3_compass_driver_node.h.