How to manage simulation time in Gazebo - Set interval time and update time

asked 2020-04-30 05:43:35 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi everyone, I'm new to Gazebo and ROS and I'm writing my thesis project.

I start Gazebo and RViz with the roslaunch command in a first shell and I have to command, through a python script that I start with rosrun in a second shell, my Franka Emika Panda.

Specifically, the robot must perform a 90° rotation (from 0 to + 90°) of the joint0 with deltaTime = 0.005s. I would like that this happen in a simulation time interval, always equal, of [0, 3] s. This because the execution time may depend by too many variables and it will never be the same but I need that the simulation time always start from 0s and always stop at 3s.

So at the instant of simulation t0 the joint0 must be in position 0, and at the final instant t3 the joint0 must be in position +90° (in the middle I define 600 waypoints in which I set position and speed calculate by a third degree polynomial function). Specifically, therefore, I would like that the time in the simulator to start from 0s, as already mentioned, and at each execution/assignment of a waypoint (the trajectory is accomplished with dt = 0.005s) the simulation time increases exactly by 0.005s regardless of how long it took wallclock time to run/execute it.

I hope I have been understandable and have correctly formulated the question.

Can anyone help me achieve this? I read several online tutorials but could not find what I was looking for.

My configuration is: - Ubuntu 18.04 LTS - ROS Melodic - Gazebo 9

Thanks

edit retag flag offensive close merge delete