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

Understanding EKF Primary Changes in ArduPilot: Causes and Solutions

LogHat Engineering TeamJune 28, 20265 min read

Key Takeaway

The EKF primary change in ArduPilot affects stability; understanding it aids in troubleshooting.

TL;DR: An EKF primary change logged as ERR Subsys=24 with ECode=0 indicates a transition to a new EKF instance due to sensor data issues. Diagnose RTL issues by checking MODE Rsn=0, MODE Rsn=1, MODE Rsn=2, MODE Rsn=3, MODE Rsn=4, and MODE Rsn=5. Ensure sensor calibration and review EK3_POS_I_GATE and EK3_HGT_I_GATE settings.

What is EKF Primary Change in ArduPilot Logs?

The EKF primary change occurs when the Extended Kalman Filter (EKF) switches due to unreliable sensor data, impacting flight performance and stability. Key message fields relevant to this change include:

ERR Subsys  ECode  TimeUS  Msg
  • ERR Subsys: Indicates the subsystem generating the error. For EKF changes, this is typically 24.
  • ECode: Specific error code. An ECode=0 signifies a successful transition.
  • TimeUS: Timestamp of the log entry in microseconds.
  • Msg: Descriptive message of the error or state change.

Confirming EKF Primary Change in Mission Planner

To confirm an EKF primary change in Mission Planner, follow these steps:

  • Open Mission Planner.
  • Navigate to Flight DataDataFlash LogsReview a Log.
  • Look for the ERR messages and filter for Subsys=24.

When reviewing logs, plot the following fields together to better understand the context:

  • EK3_POS_I_GATE
  • EK3_HGT_I_GATE
  • VIBE.VibeX, VIBE.VibeY, VIBE.VibeZ
  • GPS.Status

Confirming EKF Primary Change in MAVExplorer

In MAVExplorer, you can run the following command to visualize the relevant data:

MAV> graph ERR.Subsys EK3_POS_I_GATE

This plot will help you correlate EKF primary changes with position innovation gates, allowing you to identify potential causes of instability.

Common Causes of EKF Primary Change

  1. Barometer Issues: If the barometer malfunctions, it can lead to erroneous altitude readings, triggering an EKF primary change. This often results in ERR Subsys=18, indicating a barometer-related issue.
  2. Compass Interference: Magnetic interference can distort compass readings, causing the EKF to switch due to unreliable orientation data.
  3. GPS Signal Degradation: Poor GPS signals can lead to a transition in EKF states as the system attempts to maintain stable navigation despite unreliable position data.
  4. Vibration Issues: Excessive vibrations can affect sensor readings, particularly from the IMU, leading to EKF failures. Check VIBE.VibeX/Y/Z for values exceeding acceptable limits.
  5. Sensor Calibration Errors: Improperly calibrated sensors can cause the EKF to switch states as it cannot trust the data being received.

Fixes for EKF Primary Change Issues

  1. BARO.Press: Ensure the barometer is functioning correctly. Replace if necessary.
  2. COMPASS_AUTODEC: Check and adjust the compass settings to minimize interference.
  3. GPS_HDOP_GOOD: Ensure the GPS has adequate satellite lock; aim for an HDOP value below 1.0.
  4. VIBE.VibeX/Y/Z: Reduce vibrations by tuning or replacing motors and props if values exceed 15 m/s².
  5. EK3_POS_I_GATE: Adjust the innovation gates to be less sensitive if false positives are frequent.

When This Isn't Actually an EKF Primary Change

  • Logs showing ERR Subsys=18 may indicate a barometer glitch, not an EKF primary change.
  • Frequent MODE Rsn=2 logs suggest a radio failsafe issue, which is distinct from EKF instability.
  • High vibration values recorded in VIBE messages may cause system issues unrelated to EKF changes.

When LogHat Helps — and When It Doesn't

LogHat excels in analyzing flight logs to identify EKF primary changes and their causes by providing clear visualizations and detailed insights. However, it cannot physically diagnose sensor hardware issues or perform real-time adjustments. Users must still perform hands-on inspections and calibration for optimal performance.

What is EKF primary change?

An EKF primary change occurs when the Extended Kalman Filter switches to a different instance due to unreliable sensor data, which can affect flight stability.

How can I troubleshoot EKF errors?

Troubleshooting EKF errors involves reviewing flight logs for anomalies, checking sensor placements, and ensuring proper calibration.

What are common causes of EKF primary change?

Common causes include barometer issues, compass interference, GPS signal degradation, excessive vibrations, and improper sensor calibration.

How do I confirm EKF changes in flight logs?

EKF changes can be confirmed by checking ERR Subsys for 24 in flight logs using Mission Planner or MAVExplorer.

What actions can I take to prevent EKF primary changes?

Preventive actions include ensuring proper sensor calibration, maintaining hardware, and addressing any sources of vibration or interference.

For deeper analysis and insights into your flight logs, consider using LogHat. Our platform offers comprehensive tools to help you identify and resolve EKF and other flight-related issues efficiently.

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