EKF2 and VIO Configuration
PX4's EKF2 can fuse data from the IMU, GPS, barometer, vision system, magnetometer, and RTK heading system to provide position, velocity, attitude, and heading estimates to the…
3 min read · English documentationPX4's EKF2 can fuse data from the IMU, GPS, barometer, vision system, magnetometer, and RTK heading system to provide position, velocity, attitude, and heading estimates to the control system. Positioning-source configuration directly affects position hold, waypoint flight, and automatic control.
Warning:
Before changing EKF2 parameters, confirm the current positioning hardware, communication links, and data status. Change only the parameters related to the current positioning source each time. After saving the parameters and restarting the flight controller, read back the parameters and check the QGC status and EKF warnings. This product's barometer is susceptible to airflow, temperature, and the installation environment, which may cause fluctuations in altitude estimation. If a reliable altitude source such as GNSS or vision is available, it is recommended that you set EKF2_BARO_CTRL to 0 to exclude barometer data from EKF altitude fusion. If the barometer is required, ensure that the installation area is open to ambient atmospheric pressure and avoid direct exposure to strong airflow.
Official reference: PX4 ECL/EKF2 Tuning Guide. The official web page may be updated. When using it, verify the PX4 version and parameter definitions that correspond to the current FlyCore firmware.
GPS / RTK Mode
This mode is intended for open outdoor environments where enough satellites are available, differential data is injected correctly, and absolute positioning is the primary positioning source.
Prerequisites
- The GPS/RTK module has been detected, and the antennas and differential data link are operating correctly;
- Visual positioning or external odometry is not used;
-
GPS_YAW_OFFSEThas been set correctly for dual-antenna applications.
Reference Parameters
EKF2_GPS_CTRL = 15
EKF2_HGT_REF = GPS or Baro
For RTK positioning, GPS can be used as the height reference. For standard GPS mode, Baro can be used.
Status Verification
- GPS is detected and operating correctly, with enough satellites available;
- RTK reaches
FloatorFixedstatus; - Heading and Local Position are stable and oriented correctly;
- No EKF or GPS warnings are present.
For UM982 wiring and dual-antenna configuration, see FlyCore-FC UM982 RTK Configuration.
VIO Mode

VIO is used in environments with weak or unavailable GPS signals, such as indoor spaces, underground areas, factories, tunnels, and utility tunnels. The FlyCore-U fused positioning system provides external visual odometry data to FlyCore-FC through MAVLink.
Data Link
Camera / LiDAR / IMU
↓
FlyCore-U Fused Positioning System
↓ MAVLink (External Vision / Odometry)
FlyCore-FC PX4
↓
EKF2 State Estimation and Flight Control
The VIO serial-port configuration must be consistent with FlyCore-FC Serial Port and MAVLink Configuration.
Prerequisites
- The external positioning system continuously outputs vision-based, LiDAR-based, or fused pose data;
- The MAVLink link delivers external visual positioning data to FlyCore-FC;
- The external positioning coordinate frame, time synchronization, and output data have been confirmed;
- Data such as
vehicle_visual_odometryis continuously updated in QGC.
Reference Parameters
EKF2_EV_CTRL = 11
EKF2_HGT_REF = Vision
Disable or reduce the influence of GPS on sensor fusion according to the actual configuration. GPS/RTK and VIO should not both be used as primary positioning sources unless the fusion strategy has been verified.
Handheld Verification
-
Save the parameters, restart the flight controller, and read back the settings.
-
Confirm that the external vision data is continuously updated.
-
Check Local Position, heading, and altitude direction in QGC.
-
Move the aircraft by hand and observe the position changes:
Move forward → The X value should increase Move right → The Y value should increase Move upward → The Z / altitude value should decrease

If the position, orientation, or altitude is inconsistent, first check the external positioning coordinate frame, time synchronization, MAVLink data format, and EKF2 configuration. Do not proceed to flight testing while any EKF2 or External Vision warning is present.
