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

Understanding EKF Primary Changes in ArduPilot: Causes and Solutions

LogHat Engineering TeamJune 21, 20265 min read

Key Takeaway

EKF primary change in ArduPilot is crucial for stability and performance adjustments.

TL;DR: An ERR Subsys=18 ECode=1 indicates an EKF primary change in ArduPilot, often triggered by unreliable sensor data. To resolve this, ensure proper sensor calibration and placement, and adjust parameters such as EK3_POS_I_GATE to improve EKF performance.

What Does EKF Primary Change Indicate in the Log?

The EKF primary change in ArduPilot logs is represented by the error message ERR Subsys=18, which indicates a change in the primary EKF solution. This change usually occurs when the system detects issues with the sensor data being fed into the EKF algorithm.

ERR Subsys      ECode     TimeUS
18               1         123456789
  • TimeUS: Timestamp of the error event in microseconds.
  • Subsys: Indicates the subsystem reporting the error; 18 for EKF primary changes.
  • ECode: Specific error code; 1 indicates a primary change triggered by sensor issues.

Confirming It in Mission Planner

To confirm EKF primary changes through Mission Planner, use the following path:

When reviewing logs, look for the following fields:

  • ERR: Check for the presence of ERR Subsys=18.
  • GPS: Ensure GPS data is reliable.
  • VIBE: Monitor vibration levels to assess potential interference.

Confirming It in MAVExplorer

In MAVExplorer, you can visualize the EKF primary change using the following command:

MAV> graph ERR.Subsys ERR.ECode

This command plots the error subsystem and error code over time, allowing you to track when EKF primary changes occur relative to other logged events.

Why EKF Primary Change Happened — Ranked by What We See Most Often

  1. GPS Degradation: Poor GPS signal can lead to ERR Subsys=18 as the EKF relies heavily on accurate position data.
  2. Vibration Issues: Excessive vibrations above VIBE.VibeX/Y/Z thresholds can corrupt sensor readings, triggering changes.
  3. Compass Interference: Magnetic interference can affect compass readings, leading to EKF primary changes. Refer to this guide for compass calibration.
  4. Sensor Failures: Faulty sensors, such as a barometer reading inaccurately, can trigger EKF issues.

Resolving EKF Issues

To address EKF primary changes, follow these steps:

  1. Reduce compass interference by adjusting the COMPASS_OFS_X/Y/Z parameters, ensuring they are within acceptable limits.
  2. Calibrate your compass using the COMPASS_USE parameter set to 1 for the primary compass instance.
  3. Adjust EK3_POS_I_GATE to a more appropriate value to better accommodate your flight environment.
  4. Ensure LOG_DISARMED is enabled to log data while the vehicle is disarmed, providing more context.

When This Isn't Actually EKF Primary Change

  • ERR Subsys=19: Indicates CPU errors, not EKF issues.
  • High vibration levels without an EKF primary change could signal unrelated mechanical issues.
  • Changes in MODE Rsn to 3 or 4 may indicate failsafe actions unrelated to EKF changes.

When LogHat Helps — and When It Doesn't

LogHat can assist in identifying EKF primary changes by analyzing logs and highlighting relevant error messages. However, it cannot directly resolve physical sensor issues or mechanical vibrations that might cause these changes.

What does EKF primary change indicate? It suggests a shift in the primary EKF solution due to unreliable sensor data.
How can I troubleshoot EKF errors? By reviewing logs, adjusting configurations, and ensuring proper sensor placement.
What should I check if I see ERR Subsys=18 in my logs? Examine GPS data quality, vibration levels, and compass calibration settings.
How do I adjust EKF parameters? You can modify parameters like EK3_POS_I_GATE in the Mission Planner under Config/Tuning settings.
What impact does vibration have on EKF? High vibrations can corrupt sensor data, leading to EKF primary changes and potential flight instability.
How can I improve GPS reliability? Ensure your GPS has a clear view of the sky, and consider using GPS redundancy if available.
What is the importance of logging during disarmed periods? Logging while disarmed captures sensor data without flight variables affecting readings, aiding in diagnosis.

For further insights and improved log analysis, consider utilizing LogHat. Our platform provides powerful tools for dissecting flight logs and enhancing flight performance.

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