Interpolating the "in-betweens" of /clock ?

asked 2017-07-12 12:26:55 -0600

csano gravatar image

updated 2017-07-12 12:28:32 -0600


I am running a simulation where gazebo is hooked up to our robot software through ROS. Now, the problem is, our software is very sensitive to time.

Essentially, we want to implement a sleep and get_time that scales with the simulation time. I was able to get time through /clock and simulate sleep by locking threads until the time passes. get_time just returns whatever we have from /clock. However, that really isn't enough because our max_step_size is 0.005 (ie: 5ms). Ideally, we want less than 1ms for max_step_size, but that will significantly reduce Gazebo's RTF.

Ideally, we would like to create a gazebo plugin that "guesses" the /clock in those intervals and publishes them. If there's some conflict there, we can publish the guesses in another topic and that's totally ok. However, the only Gazebo plugin method that I know that scales gracefully with simulation time is the one that gets called every step. Is there some way to have a Gazebo plugin that gets called more than once per step?

The "good-enough" solution is we calculate the RTF and just scale sleep calls from there. Probably the same thing for time. However, that isn't sensitive enough on RTF change so it may cause unexpected behaviors when RTF suddenly changes (lag/pause/someone changing the speed)

edit retag flag offensive close merge delete