Is it possible to synchronize Gazebo /clock with respect to node calculations?

asked 2023-01-02 09:34:27 -0600

sendilkelm gravatar image

updated 2023-01-03 10:55:04 -0600

Python calculations in the node take a long time, and Gazebo simulation is "faster".

As I understand it, with rosparam set use_sim_time true it is possible to enable synchronization of moments of Python function calls in ROS, for the frequency set by "rospy.Rate". And this is done based on the moments of time read from /clock generated by Gazebo. That means it's not what I need.

Is it possible to synchronize the Gazebo to the moments of computation completion in the node?

The only idea I found was to slow down the Gazebo calculations by reducing the real_time_factor parameter.

Edit: change real_time_factor does not work (Gazebo 9). You should instead change max_step_size or/and real_time_update_rate.

Then, using rosparam set use_sim_time true the ROS will synchronize with the corresponding moments of Gazebo time. However, this requires estimating the longest possible calculation time and is not particularly convenient. Can it be done more cleverly?

Generally, the question is about ROS1 and Gazebo classic.

edit retag flag offensive close merge delete