Skip to the content
FixTheRobot Explore Robotics / UAV / Module 6 / M6-L6

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.

  • UAV Software and Flight-Controller Integration
  • Implementation-specific
  • About 120 minutes

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

  1. 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.
  2. 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 publishes VehicleOdometry to /fmu/in/vehicle_visual_odometry with timestamp_sample set to the original sample time and honest variances.
  3. 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.
  4. Fly the offboard square from the previous lab. Confirm the vehicle navigates with GNSS fusion disabled.
  5. 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 status
Inspect parameters before changing them. Record the original values.

Experiments

  • Remove the delay compensation (set timestamp_sample to 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

Troubleshooting
SymptomLikely causeWhat to check
EKF2 does not fuse visionParameters not applied or the message invalidCheck the fusion bitmask, restart if required, and the message fields (NaN vs zero)
Vehicle drifts awayFrame or sign errorCompare vision and local position in one plot
Arming refusedPre-arm checks on position sourceRead 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.