UAV Systems Engineering · M6-L6 · Hands-on lab (runs on your machine)
Feed external visual odometry to PX4
The most important integration in the module: make PX4 navigate on odometry you provide, and verify it in the log.
What you will do
In simulation there is no real VIO, so you will generate a simulated external odometry from the simulator’s ground truth, with realistic noise and delay, and feed it through the bridge of lesson M6-T10. The goal is to verify the integration path (frames, timestamps, covariance, parameters) before connecting a real estimator.
Before you start
- Labs “Run PX4 SITL” and “Connect ROS 2 with PX4” completed.
- Lessons M6-T5 (EKF2) and M6-T10 (external vision), M1-T4 (frames).
Steps
- Read the external-position-estimation page and the EKF2 page of the PX4 documentation for your version and write down the parameter names for: enabling vision position, velocity and yaw fusion; selecting the height reference; disabling GNSS fusion; the vision delay and noise modes.
- Write a ROS 2 node that subscribes to
/fmu/out/vehicle_odometry(EKF2’s own output as ground truth proxy), adds Gaussian noise (σ = 0.05 m position), a fixed 50 ms delay, converts nothing (it is already NED/FRD) and publishesVehicleOdometryto/fmu/in/vehicle_visual_odometrywithtimestamp_sampleset to the original sample time and honest variances. - With the vehicle on the ground, set the EKF2 parameters (in QGC or the shell), restart as the parameter documentation requires, and check
ekf2 status. - Fly the offboard square from the previous lab. Confirm the vehicle navigates with GNSS fusion disabled.
- Upload or open the ULog and plot external vision position against EKF2 local position; plot the vision innovations and the fusion flags.
# in the PX4 shell (parameter names as in recent releases: verify for your version!)
param show EKF2_EV_CTRL
param show EKF2_GPS_CTRL
param show EKF2_HGT_REF
ekf2 statusExperiments
- Remove the delay compensation (set
timestamp_sampleto publication time) and measure the jitter at 3 m/s. - Make the reported variance 100× too small, then inject a sudden 2 m position jump into the odometry and observe how EKF2 reacts (gating, rejection, or following).
- Publish ENU positions without conversion and note the symptom in the log.
How to know it worked
- The log shows external vision position being fused and GNSS not fused.
- You can state the effect of each of the experiments on the innovation and on the flown path.
- A table lists every PX4 parameter you changed, the old and new values and why.
If it does not work
| Symptom | Likely cause | What to check |
|---|---|---|
| EKF2 does not fuse vision | Parameters not applied or the message invalid | Check the fusion bitmask, restart if required, and the message fields (NaN vs zero) |
| Vehicle drifts away | Frame or sign error | Compare vision and local position in one plot |
| Arming refused | Pre-arm checks on position source | Read the messages; confirm the vision stream is steady before arming |
References
Record your progress
Saved in this browser. This lab runs on your own machine, so the site cannot check it for you.