chrono::ros::ChROSHandler Class Referenceabstract

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>

Inheritance diagram for chrono::ros::ChROSHandler:

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()

chrono::ros::ChROSHandler::ChROSHandler ( double  update_rate)
explicitprotected

Constructor for the ChROSHandler.

Parameters
update_rateUpdate 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()

virtual bool chrono::ros::ChROSHandler::Initialize ( std::shared_ptr< ChROSInterface interface)
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
interfaceThe 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()

◆ Update()

void chrono::ros::ChROSHandler::Update ( double  time,
double  step 
)
finalvirtual

Updates the internal clock and checks if a tick should occur.

If yes, Tick() is called.

Parameters
timethe current simulation time
stepthe 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