Project Chrono: chrono::ros::ChROSClockHandler Class Reference

Public Member Functions | Protected Member Functions | List of all members
chrono::ros::ChROSClockHandler Class Reference
ROS module » ROS Handlers

## Description

Publishes rosgraph_msgs::msg::Clock messages at each timestep (by default) of the simulation.

This is useful if you want run the ROS at a corresponding to simulation time versus wall time.

`#include <ChROSClockHandler.h>`

Inheritance diagram for chrono::ros::ChROSClockHandler:
[legend]
Collaboration diagram for chrono::ros::ChROSClockHandler:
[legend]

## Public Member Functions
| ChROSClockHandler (double update_rate=0, const std::string &topic_name="/clock")
| Constructor for the ChROSClockHandler.
virtual bool | Initialize (std::shared_ptr< ChROSInterface > interface) override
| Initializes this handler. Will create a single publisher for the clock information under the "/clock" topic.
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.
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
| Tick this hander. Will create the clock message and publish it. By default, Tick is called at each sim update.
Protected Member Functions inherited from chrono::ros::ChROSHandler
| ChROSHandler (double update_rate)
| Constructor for the ChROSHandler.

## Constructor & Destructor Documentation

## ◆ ChROSClockHandler()

chrono::ros::ChROSClockHandler::ChROSClockHandler | ( | double | update_rate = 0,
|  | const std::string & | topic_name = "/clock" )

Constructor for the ChROSClockHandler.

The update rate defaults to 0 (i.e. to be updated at each timestep). topic_name defaults to "/clock" which overrides the ros time update handler. The chrono time will then correspond to ros time.

## Member Function Documentation

## ◆ Initialize()

bool chrono::ros::ChROSClockHandler::Initialize | ( | std::shared_ptr< ChROSInterface > | interface | ) |
| overridevirtual

Initializes this handler. Will create a single publisher for the clock information under the "/clock" topic.

Implements chrono::ros::ChROSHandler.

## ◆ Tick()

void chrono::ros::ChROSClockHandler::Tick | ( | double | time | ) |
| overrideprotectedvirtual

Tick this hander. Will create the clock message and publish it. By default, Tick is called at each sim update.

Implements chrono::ros::ChROSHandler.

The documentation for this class was generated from the following files:

- D:/W/B/src/chrono-9.0.1/src/chrono_ros/handlers/ChROSClockHandler.h
- D:/W/B/src/chrono-9.0.1/src/chrono_ros/handlers/ChROSClockHandler.cpp