Skip to content

Allow EKF2 to use AI-corrected IMU without disrupting the raw IMU stream #25773

@souvik0306

Description

@souvik0306

Describe problem solved by the proposed feature

I'm using ROS1 Noetic and PX4 v1.13.0

Currently, EKF2 relies on the raw vehicle_imu topic as its primary input.
My goal is to integrate an AI-corrected IMU stream into PX4’s estimation pipeline using the following flow:

  1. Current Pipeline:

/mavros/imu/data → AI model → corrected IMU → new uORB topic (vehicle_imu_ai) → EKF2

  1. Actual Requirement:

SITL IMU Data → AI model → Corrected IMU → EKF2

When EKF2 switches its input from vehicle_imu to vehicle_imu_ai, the raw IMU stream (/mavros/imu/data) stops publishing because EKF2 is its only active subscriber in SITL. Once it unsubscribes, the simulator pauses IMU publishing, which breaks the entire loop:

  • MAVROS stops broadcasting pose.
  • The AI model stops receiving input.
  • EKF2 times out waiting for AI IMU data.
  • The system stalls until EKF2 is switched back to the raw IMU.

A clean way to inject corrected IMU data into EKF2 without disrupting the original simulated IMU stream is currently missing.

Describe your preferred solution

Introduce an EKF2_AI module (or equivalent configuration) that:

  1. Subscribes only to vehicle_imu_ai.
  2. Publishes the same downstream topics as EKF2 (vehicle_attitude, vehicle_local_position, etc.).
  3. Keeps a passive subscription to vehicle_imu alive in the background to maintain the SITL IMU stream, without using it for estimation.
  4. Allows clean replacement of EKF2 or side-by-side operation with the default estimator.

This would make it possible to run state estimation on AI-corrected IMU data without breaking MAVROS or the simulator, while keeping the standard PX4 pipeline intact.

Describe possible alternatives

  • Hard-wire EKF2 to vehicle_imu_ai: Simpler, but brittle. If the AI stream stalls, EKF2 fails and there’s no fallback. Startup ordering also becomes fragile.
  • Keep current EKF2 and inject via HITL or MAVLink HIL_SENSOR: Tried, but EKF2 still uses the raw IMU and doesn’t allow easy handover.
  • Source switching logic: Currently supported but causes the simulator to idle when raw IMU loses subscribers. This breaks the feedback loop.

Additional context

The main problem:

  • Switching EKF2 input to the AI topic unsubscribes from the raw IMU.
  • /mavros/imu/data then drops to ~1 Hz (heartbeat only).
  • The AI model loses input and stops publishing.
  • EKF2 reports poll timeouts and the estimation stops entirely.

As soon as I switch EKF2 back to vehicle_imu, everything recovers.

A dedicated EKF2_AI module or similar mechanism would provide a stable, modular way to integrate AI-based IMU correction without breaking the simulator pipeline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions