Slow simulator does not work in SITL

Hi,

I am new to PX4. I am using a custom simulator that runs slower than real wall clock time. I am seeing that the copter is not flying and not following the waypoints in QGC and deviating and then goes to failsafe saying no valid local position estimate. I saw in SimulatorMavlink.cpp that it updates the hrt_absolute_time to the timestamp of HIL_SENSOR message update from Simulator.

I am wondering if SITL runs in lockstep and that too with the HIL_SENSOR timestamp as current time which comes from Simulator why the copter does not fly. Additionally, I see that the mavlink messages are also updating at a slow rate almost 15 HZ in contrast to 50HZ when using jmavsim.

Can anyone please help me understand if I am missing something or there is some bug in SimulatorMavlink.cpp? Is there any dependence of real time is SITL of PX4?

Thanks,

Sayan

Hi, the problem is your sim is too slow and only sending ~15 Hz sensor data. PX4 expects ~50 Hz real-time updates, otherwise the EKF loses position and triggers failsafe. PX4 SITL isn’t designed to run slower than real time, so you’ll need to speed up the sim or align its timestamps with real clock.

Thanks I will check this.