After looking at the code, I can see that even in posix_sitl the system is still coupled to wall-clock time from the host machine.
Is anyone looking at using other time bases? For example, my simulator can run faster than wall-clock time and I’d love to be able to run it CPU-bound for automated testing with PX4.
One way I can see to accomplish this would be to somehow use the timestamps of incoming HIL_GPS/HIL_SENSOR messages instead of gettimeofday() for the tick reference. But before I start playing around with this, I figured I’d probably better ask some experts here. I can’t be the first person to come up with this idea…
No definitely not the first. See https://github.com/PX4/Firmware/issues/5026 and a few others.
It would be great to get your input on the difficultly of implementing this on linux. It could drastically increase our automated testing capacity.
Well, brute-forcing HRT seems like a possibility, at least as a first approximation. And, most (all?) the pthreads APIs involving timed waits have ways to abort them from outside the blocked thread.
So, it could be a matter of just updating HRT and then maintaining a list of pthreads objects (mutexes, etc.) to awaken when time is changed outside the normal flow.
I’ll keep my eyes open, but it’ll be a couple weeks at least before I have spare cycles to look into this.