Search code examples
roswebots

How to synchronize Webots Time with ROS time?


I'm currently trying to synchronize the ROS time with Webots. What I'm expecting:

  • The ROS time is fully depends on the Webots time. If the simulation starts running slowly, the ROS time should slow down as well, if I run webots in fast mode (> real-time), the ros time should run faster as well.

However, I'm currently not able to synchronize webots to achieve the above behavior. I followed the instructions mentioned in the Webots documention and in this thread of the old webots forum and set the ros_controller arguments --use_sim_time, --clock and --synchronize to be true, with no success. Both Times still run independently from each other.

I would be glad if anyone would have some feedback how one can achieve the synchronization.

Best regards


Solution

  • It seems you missed one step, you have to set the ROS /use_sim_time parameter to true before starting your ROS node and the simulation so that it will use the time published by the /clock topic: http://wiki.ros.org/Clock#Using_Simulation_Time_from_the_.2BAC8-clock_Topic