How to feed Custom IMU data to EKF2

Context
I am building a pipeline where raw IMU data from MAVROS is passed through an AI model that outputs corrected accelerometer and gyroscope measurements. I then want PX4’s EKF2 to use this corrected IMU instead of the default onboard/simulated IMU data.

Currently, I publish the corrected IMU as a MAVROS HilSensor message on /mavros/hil/imu_ned. I can successfully echo this topic in ROS and also see the data arriving in QGroundControl’s MAVLink Inspector. I have set SYS_HITL = 1, so PX4 is in HIL mode.

Issue

Even though I see my corrected IMU data in MAVLink Inspector, running listener vehicle_imu inside PX4 shows nothing. It seems that EKF2 is not consuming my corrected IMU.

Question

  • When publishing corrected IMU data via MAVROS HilSensor in HIL mode, how to route that data internally?

  • Should I expect it to appear in sensor_accel and sensor_gyro rather than vehicle_imu?

  • If EKF2 is supposed to consume this data, what parameters (e.g. EKF2_MULTI_IMU, SENS_IMU_MODE) need to be set so that my corrected IMU becomes the primary source?

I’m very new to PX4.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.