Understanding EKF Primary Change in ArduPilot: Causes and Solutions
EKFArduPilotdrone engineeringtroubleshooting

Understanding EKF Primary Change in ArduPilot: Causes and Solutions

LogHat Engineering TeamJuly 17, 20265 min read

Key Takeaway

EKF primary change in ArduPilot can occur due to sensor errors or configuration issues.

TL;DR: An EKF primary change in ArduPilot can be identified with ERR Subsys=18 ECode=2 indicating EKFCHECK_BAD_VARIANCE. The canonical fix involves verifying sensor calibration and ensuring that all components are properly positioned and functioning. Diagnosing these issues can help prevent triggering RTL due to EKF failures.

What Is EKF in ArduPilot?

EKF is essential for a drone's navigation, providing accurate estimates based on sensor data.

The Extended Kalman Filter (EKF) in ArduPilot is a vital component for estimating a drone's position and orientation based on sensor data. It integrates various inputs, including GPS, barometer, and accelerometers, to provide a reliable state estimate. An EKF primary change occurs when the algorithm detects inconsistencies in sensor data, leading to potential navigation issues.

EKF  TimeUS  Status  Lat  Lng  Alt  Spd  Yaw
  • Status: Indicates the current EKF status, such as OK, bad variance, or faults.
  • Lat: Latitude of the drone's position.
  • Lng: Longitude of the drone's position.
  • Alt: Altitude in meters.
  • Spd: Speed in meters per second.
  • Yaw: Orientation angle in degrees.

How to Confirm EKF Primary Change Issues in Mission Planner?

Mission Planner is a powerful tool for verifying EKF-related issues through log analysis.

To confirm EKF primary change issues using Mission Planner, follow these steps:

  • Open Mission Planner and connect to your drone.
  • Navigate to the Flight Data tab.
  • Click on DataFlash Logs and select Review a Log.
  • Choose the log file you want to analyze.
  • In the Graphical Log section, plot the EKF.Status and the relevant sensor data fields.

How to Confirm EKF Primary Change Issues in MAVExplorer?

MAVExplorer provides a streamlined approach to assess EKF performance through command execution.

Using MAVExplorer to assess EKF primary changes can be effective. Here's how to run a command:

MAV> graph EKF.Status EKF.Lat EKF.Lng

This command will provide a plot showing the EKF status alongside the latitude and longitude readings, allowing you to visualize the relationship between the EKF's state and the drone's position. Discrepancies in these readings often correlate with EKF issues.

What Causes EKF Primary Change Issues in ArduPilot?

Understanding the common causes of EKF primary change can aid in effective troubleshooting.
  1. GPS Signal Interference - Poor GPS signals can lead to inaccurate position estimates, triggering an EKF primary change. When GPS.Status indicates a low number of satellites or high HDop, it can result in EKF errors.
  2. Sensor Calibration Issues - If sensors such as the barometer or compass are not calibrated correctly, the EKF may detect invalid data. This often manifests as unexpected altitude changes or erratic yaw readings.
  3. Physical Component Interference - Components placed too close together can cause electromagnetic interference, affecting sensor readings. This could be seen in log messages indicating ERR Subsys=18 for barometer errors.
  4. Improper Tuning Parameters - Incorrect EKF tuning parameters can lead to sensitivity issues. For instance, high noise parameters may cause the EKF to reject valid sensor data, leading to status changes.

How to Fix EKF Primary Change Issues?

Proper fixes can restore EKF functionality and prevent navigation errors.
  1. Check and calibrate the BARO sensor to ensure accurate altitude readings.
  2. Verify the GPS_HDOP_GOOD setting to ensure it's below 1.4 for optimal performance.
  3. Place the GPS and compass at least 30 cm away from motors and ESCs to minimize interference.
  4. Adjust EK3_POSNE_M_NSE to improve noise estimates for horizontal position.
  5. Regularly inspect and clean the drone's sensors to avoid dust or debris affecting readings.

When This Isn't Actually EKF Primary Change

Identifying false flags is crucial for accurate troubleshooting and safety.
  • An EKF primary change may appear when the drone is transitioning to different flight modes, particularly if MODE Rsn=3 indicates a battery failsafe.
  • Low battery voltage can cause unexpected behavior, triggering failsafes that are misinterpreted as EKF issues.
  • GPS glitches logged as ERR Subsys=11 ECode=2 can also lead to perceived EKF failures.

When LogHat Helps — and When It Doesn't

LogHat can identify trends in EKF performance but cannot resolve hardware issues directly.

LogHat excels in providing a detailed analysis of flight logs, helping to identify trends and anomalies related to EKF performance. However, it cannot directly resolve hardware or calibration issues; users must manually address these aspects. LogHat offers insights based on historical data, but immediate troubleshooting requires hands-on adjustments and checks.

What is EKF in ArduPilot?

EKF stands for Extended Kalman Filter, a system for estimating drone position and orientation based on sensor data.

How can I troubleshoot EKF primary change errors?

Check sensor data, ensure proper calibration, and verify component placement to troubleshoot EKF primary change errors effectively.

What causes EKF primary change in ArduPilot?

Common causes include GPS signal interference, sensor calibration issues, and physical component interference.

How can I confirm EKF status in Mission Planner?

You can confirm EKF status in Mission Planner by reviewing logs and plotting relevant fields in the graphical log viewer.

What parameters should I adjust for better EKF performance?

Adjust parameters such as EK3_POSNE_M_NSE for noise estimation and ensure sensors are calibrated accurately.

By understanding and addressing EKF primary change issues, we can significantly improve flight safety and reliability. For further analysis and insights, consider using LogHat to gain deeper visibility into your flight logs.

About the author

LE

LogHat Engineering Team

The LogHat engineering team — drone-systems engineers who build and operate the LogHat flight analytics platform. Posts in this byline are written and reviewed by team members working on the parsers, analysis engine, and Vector AI that the post describes.

Tagged

EKFArduPilotdrone engineeringtroubleshooting

Try LogHat

Analyze your flight logs in seconds

Upload a .bin, .tlog, .log, or .ulg file. Get AI crash analysis, 3D replay, and forensic PDF reports instantly.

Try LogHat Free