Description
Base class for a ROS handler.
A specific handler should inherit from here. A handler is essentially a wrapper around a ROS subscriber/publisher/service/action. Logic regarding message generation/parsing and sending/receiving is implemented here. A derived class is implemented to define logic specific to a desired output.
#include <ChROSHandler.h>
Public Member Functions | |
virtual | ~ChROSHandler ()=default |
Destructor for the ChROSHandler. | |
virtual bool | Initialize (std::shared_ptr< ChROSInterface > interface)=0 |
Initializes the handler. More... | |
virtual void | Update (double time, double step) final |
Updates the internal clock and checks if a tick should occur. More... | |
const double | GetUpdateRate () const |
Get the period which this handler operates at. | |
const uint64_t | GetTickCount () const |
Get the number of times Tick() has been called. | |
Protected Member Functions | |
ChROSHandler (double update_rate) | |
Constructor for the ChROSHandler. More... | |
virtual void | Tick (double time)=0 |
Derived class must implement this function. More... | |
Constructor & Destructor Documentation
◆ ChROSHandler()
|
explicitprotected |
Constructor for the ChROSHandler.
- Parameters
-
update_rate Update rate with which the handler should tick relative to the simulation clock. NOTE: A update_rate of 0 indicates tick should be called on each update of the simulation.
Member Function Documentation
◆ Initialize()
|
pure virtual |
Initializes the handler.
Must be implemented by derived classes. This is called after rclcpp::init(). Here the underlying ROS objects (e.g. publisher, subscription) should be created.
- Parameters
-
interface The interface to the ROS node
Implemented in chrono::ros::ChROSTFHandler, chrono::ros::ChROSRobotModelHandler, chrono::ros::ChROSBodyHandler, chrono::ros::ChROSAccelerometerHandler, chrono::ros::ChROSGyroscopeHandler, chrono::ros::ChROSMagnetometerHandler, chrono::ros::ChROSDriverInputsHandler, chrono::ros::ChROSLidarHandler, chrono::ros::ChROSGPSHandler, chrono::ros::ChROSViperDCMotorControlHandler, chrono::ros::ChROSCameraHandler, and chrono::ros::ChROSClockHandler.
◆ Tick()
|
protectedpure virtual |
Derived class must implement this function.
- Parameters
-
time the current simulation time
Implemented in chrono::ros::ChROSTFHandler, chrono::ros::ChROSRobotModelHandler, chrono::ros::ChROSBodyHandler, chrono::ros::ChROSDriverInputsHandler, chrono::ros::ChROSAccelerometerHandler, chrono::ros::ChROSGyroscopeHandler, chrono::ros::ChROSMagnetometerHandler, chrono::ros::ChROSLidarHandler, chrono::ros::ChROSGPSHandler, chrono::ros::ChROSViperDCMotorControlHandler, chrono::ros::ChROSCameraHandler, and chrono::ros::ChROSClockHandler.
◆ Update()
|
finalvirtual |
Updates the internal clock and checks if a tick should occur.
If yes, Tick() is called.
- Parameters
-
time the current simulation time step the step size used since the last Update call
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono_ros/ChROSHandler.h
- /builds/uwsbel/chrono/src/chrono_ros/ChROSHandler.cpp