I want to PX4’s EKF2 use AI-corrected IMU data instead of the raw sensor stream.
My intended flow is: /mavros/imu/data → AI model (denoising/filtering) → UDP port 14560 → vehicle_imu_ai (uORB) → EKF2
Issue
From a structural point of view, publishing data through the vehicle_imu_ai
topic is correct — the message format and timing fields match vehicle_imu
.
However, once EKF2’s IMU source is switched to vehicle_imu_ai
, two major problems occur.
- EKF2 logs
poll timeout 0, 22
After setting EKF2_IMU_SRC=1
, EKF2 stops receiving IMU updates at the expected rate.
- The AI IMU feed currently runs at about 35 Hz, which is much slower and less regular than the default IMU rate (~200 Hz).
- PX4’s scheduler waits for IMU updates that don’t arrive on time, so it logs poll timeouts.
- As a result, EKF2 stops updating because the AI data is too slow or inconsistent.
/mavros/imu/data
drops to ~1 Hz after switching to AI
Immediately after switching EKF2 to use vehicle_imu_ai
, the /mavros/imu/data
topic slows to ~1 Hz ~ only heartbeat messages remain.
This likely happens because EKF2 unsubscribes from the raw vehicle_imu
topic once it switches to the AI feed.
In SITL, if no one is subscribed, the simulator stops publishing IMU data.
Consequences:
- MAVROS loses high-rate IMU data and pose updates stop.
- The AI inference script stops receiving IMU input and therefore stops sending corrected data.
- EKF2 then times out waiting for new
vehicle_imu_ai
samples, and the entire estimation pipeline halts.