Description

This handler is responsible for publishing transform (tf) information.

For more information on the use of tf in ROS, see the tf2_ros documentation.

#include <ChROSTFHandler.h>

Inheritance diagram for chrono::ros::ChROSTFHandler:
Collaboration diagram for chrono::ros::ChROSTFHandler:

Public Member Functions

 ChROSTFHandler (double update_rate)
 Constructor.
 
virtual bool Initialize (std::shared_ptr< ChROSInterface > interface) override
 Initializes the handler. More...
 
void AddTransform (std::shared_ptr< chrono::ChBody > parent, const std::string &parent_frame_id, std::shared_ptr< chrono::ChBody > child, const std::string &child_frame_id)
 Add a transform to be published. More...
 
void AddTransform (std::shared_ptr< chrono::ChBody > parent, const std::string &parent_frame_id, chrono::ChFrame< double > child_frame, const std::string &child_frame_id)
 Add a transform to be published. More...
 
- Public Member Functions inherited from chrono::ros::ChROSHandler
virtual ~ChROSHandler ()=default
 Destructor for the ChROSHandler.
 
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

virtual void Tick (double time) override
 Update the transforms and publish them. More...
 
- Protected Member Functions inherited from chrono::ros::ChROSHandler
 ChROSHandler (double update_rate)
 Constructor for the ChROSHandler. More...
 

Member Function Documentation

◆ AddTransform() [1/2]

void chrono::ros::ChROSTFHandler::AddTransform ( std::shared_ptr< chrono::ChBody parent,
const std::string &  parent_frame_id,
chrono::ChFrame< double >  child_frame,
const std::string &  child_frame_id 
)

Add a transform to be published.

This version of the AddTransform function will publish a static transform between the parent and child frame. This is useful for two bodies that are connected by a link.

Parameters
parentThe parent body
parent_frameThe parent frame id.
child_frameThe child frame
child_frame_idThe child frame id

◆ AddTransform() [2/2]

void chrono::ros::ChROSTFHandler::AddTransform ( std::shared_ptr< chrono::ChBody parent,
const std::string &  parent_frame_id,
std::shared_ptr< chrono::ChBody child,
const std::string &  child_frame_id 
)

Add a transform to be published.

This version of the AddTransform function will use two bodies directly and calculate the transform at each tick. This is useful for two bodies that are not connected by a link. For each iteration of this method, when the frame id for the parent and/or child is not passed, it defaults to the name of the body.

◆ Initialize()

bool chrono::ros::ChROSTFHandler::Initialize ( std::shared_ptr< ChROSInterface interface)
overridevirtual

Initializes the handler.

This will create the tf broadcaster. The topic name is assigned to /tf internally within the broadcaster and this can not be changed.

Implements chrono::ros::ChROSHandler.

◆ Tick()

void chrono::ros::ChROSTFHandler::Tick ( double  time)
overrideprotectedvirtual

Update the transforms and publish them.

Parameters
timeThe current time of the simulation

Implements chrono::ros::ChROSHandler.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_ros/handlers/ChROSTFHandler.h
  • /builds/uwsbel/chrono/src/chrono_ros/handlers/ChROSTFHandler.cpp