MAVROS Time Sync issues with SITL Gazebo LockStep

I’m currently testing my system using the standard SITL Gazebo simulation. The simulation is set to run realtime but sometimes lags a bit due to system load. Eventually it create sync reset between MAVROS and Px4. Is there anyway of fixing times?

One way would be to disable locktep

I don’t see how you can stay in sync with something that is not running in sync with time :thinking:

Isn’t the whole point of lockstep in SITL to provide a fixed timestep and deterministic evolution during variable system loads and comms?

Right but the MAVROS or rather the time it is working on is not part of that lockstep. So yes it should be as deterministic as possible internally but when it comes to the outside world like MAVROS that’s hard to do.

Hm… I’m not aware of MAVROS internals. Perhaps it doesn’t use the simulated clock (published by Gazebo) and uses the wallclock instead, in which case it could drift from the sim clock, yes.

Right, that seems plausible.

In fact, I guess I was wondering if you setup ROS to use the simulated time would work with MAVROS.

I have not tried that, no.

Maybe @mhkabir has?