Hi everyone,
I’m stuck with my simulated drone project and could use some help. I’ve been wrestling with tracking and control for days, and I’m no longer sure if the issue is my state estimator (IMM), my controller (PID/MPC), or the PX4 integration itself.
My Stack (based on stability recommendations):
-
OS: Ubuntu 22.04
-
Middleware: ROS 2 Humble
-
Autopilot: PX4 v1.14
-
Bridge: Micro XRCE-DDS (uXRCE-DDS)
-
Simulator: Gazebo Garden
-
Sensors: Depth Camera (publishing
PointCloud2and RGB images)
System Pipeline:
-
Vision: HSV filter on the RGB image to isolate a red sphere. I extract the corresponding points from the
PointCloud2data and calculate the centroid. -
Estimation: I feed the centroid into an IMM (Interacting Multiple Model) filter to estimate the target’s position and velocity.
-
Control: The IMM output feeds a controller (I’ve tried both PID and MPC), which generates Offboard mode setpoints for PX4.
The Problem (Symptoms): The drone flies very erratically:
-
Sometimes it crashes into the sphere (fails to regulate distance).
-
Sometimes it tracks it, but suddenly loses the target and hovers in place or drifts away.
-
Other times it detects the sphere but doesn’t move towards it, or moves in the wrong direction entirely.
Main Suspicion: I strongly suspect the IMM is the culprit. I feel it might be introducing too much noise or delay into the velocity estimation, causing both the PID and MPC to make violent or incorrect decisions. However, I’m not sure how to isolate it to confirm this.
What I’ve Tried:
-
Tuning PID gains and MPC horizons (both fail similarly).
-
Modifying the IMM’s covariance and transition probability matrices.
-
Verifying that the TF tree is correct (
camera_linktobase_link).
Specific Questions:
-
Diagnosing the Estimator: How can I diagnose if the IMM is to blame? Do you recommend disabling it temporarily and using just the raw centroid or a simple Kalman Filter to see if the drone’s behavior improves?
-
IMM + MPC Dynamics: Is MPC generally too sensitive to noisy IMM estimates? Would it be better to use a position PID and leave the IMM velocity solely as a feedforward term?
-
Offboard Latency: Processing
PointCloud2+ IMM + PID/MPC can take a long time. Does anyone know the minimum safe frequency limit for Offboard mode in PX4 v1.14, and how to avoid timeout issues? (Would you recommend applying a VoxelGrid filter to downsample the point cloud?). -
Known Issues: Has anyone successfully integrated an IMM with PX4 in Gazebo Garden? Are there any known issues with this specific Gazebo Garden version and the uXRCE-DDS bridge on ROS 2 Humble?
Thanks in advance for any insights!