jhelovuo/ros2-client

syncing time across nodes

Closed this issue · 5 comments

Hi,

How do I sync time across nodes? is there something like ROSTime and SystemTime? any support for the /clock topic like ROS2?

ros2-client 0.7.0 has been released. It has support for ROSTime and the /clock topic.

Is this what you were missing?

yes, exactly! need it for time sync/realtime

btw, any examples on how to use it?

Yes. There are example programs time_broadcaster and time_reporter.

The broadcaster just periodically sends time updates over the /clock topic, so it is a very simple simulated clock. You can make it run slower or faster than real time by changing the source code.

time_reporter periodically reports the current ROSTime. It is configured to have the ROS parameter use_sim_time = true by default, so it will report the simulated time. If there is no-one broadcasting the time, the simulated time will be stuck at zero timestamp.

The parameter use_sim_time can be changed at runtime using e.g. the rqt tool's Dynamic Reconfigure plugin. This should change the clock source between the simulated and real system clock.

amazing, thank you...

So i guess my next step is to report my gps sensor on /clock