Strange Timestamp Errors in SITL While X-Plane 11 is Running Locally (no Bridge)

Long story short: I’m working on developing a new XPlane 11 bridge for PX4. The individual connectivity works, but when I start XPlane, I immediately start getting imu timestamp and gyro timestamp errors in PX4.

ERROR [vehicle_imu] 0 - accel 1310988 timestamp error timestamp_sample: 19532376942, previous timestamp_sam
ERROR [vehicle_imu] 0 - gyro 1310988 timestamp error timestamp_sample: 19532376942, previous timestamp_samp

PX4 is currently being built with target px4_sitl none

These errors happen immediately on build, I am not starting simulator_mavlink yet.

I am running PX4 in a WSL2 Ubuntu instance and XPlane on the same physical host using Windows 11. When I run the bridge it is on the same virtual host as PX4, but the bridge is not running.

I’m very confused, as PX4 does not by documentation have any designed capability to talk to XPlane, or receive UDP telemetry messages over port 49000.

I’m currently in the process of building up another box to try this test with XPlane on a remote LAN instance, to see if it is a remote UDP error or a local port hijack or what. Does ANY PX4 developer have any idea what might be happening? I’m very confused.

If we can get this stuff working, Robots Everywhere is interested in releasing a universal mavlink to xplane 11 / 12 simulator bridge under an open source license. I hope this will help some folks in the community who have been asking about XPlane.

Update: I tried it on a VM with no network adapter to see if it was UDP related and it’s 100% not, the errors still occur even if the VM has no network adapter or ability to receive UDP broadcasts from X-Plane.

I am utterly baffled right now.

More updates on this issue: it is related to the runtime of the WSL2 instance the PX4 dev environment is running on. The longer it’s running without a “wsl --shutdown” the more this happens.

Still only happens when xplane is running, but with no bridge set up or broadcast configured. Seems like a local port conflict of some kind, but I still haven’t found a root cause. Should I turn this into a bug ticket?

I’m still focused on my own side of this project so I haven’t tried remote xplane yet, but I’m fairly convinced it will work.

I suspect most likely the “actual bug” is in WSL, but I still have no clue how the xplane data is even showing up in PX4 before the bridge is started!

I have confirmed this is a bug with time desynchronization in WSL2. This is not an issue with PX4’s memory management; just be aware of it when you are working with Windows!