Understanding NKF Log Messages for EKF2 vs EKF3 in ArduPilot
EKFArduPilotdrone engineeringstate estimation

Understanding NKF Log Messages for EKF2 vs EKF3 in ArduPilot

LogHat Engineering TeamJune 12, 20265 min read

Key Takeaway

NKF log messages are crucial for understanding EKF2 and EKF3 in ArduPilot.

TL;DR: When analyzing EKF log messages, look for NKF messages in ArduPilot to help determine the state estimation accuracy. The canonical fix often involves tuning parameters such as EK3_ALT_M_NSE for altitude noise or EK3_VELD_M_NSE for vertical velocity noise adjustments to optimize performance.

What NKF Log Messages Actually Are in the Log

In ArduPilot, NKF log messages are crucial for understanding the operation of the Extended Kalman Filter (EKF) versions 2 and 3. These messages provide insights into the filter's state, including its innovations and variances. The relevant fields in these messages differ between EKF2 and EKF3, with EKF3 generally providing more detailed information.

NKF TimeUS  C  IVN  IVE  IVD  IPN  IPE  IPD
  • TimeUS: Timestamp of the log message in microseconds.
  • C: Core index indicating which EKF core is being referenced.
  • IVN: Velocity innovations (how much the predicted velocity differs from the measured velocity).
  • IVE: Variance of velocity innovations.
  • IPN: Position innovations (difference between predicted and actual positions).

Confirming it in Mission Planner

To confirm EKF log messages in Mission Planner, follow this path:

  • Connect your drone and navigate to Flight Data.
  • Go to DataFlash Logs and select Review a Log.
  • In the log review window, plot NKF.IVN and NKF.IPN together to analyze innovations.
  • Also, consider plotting EKF.GPS for GPS health and EKF.ERR for EKF status.

Confirming it in MAVExplorer

MAV> graph NKF.IVN NKF.IPN

This command in MAVExplorer will help visualize the velocity and position innovations over time. A healthy EKF will show innovations that remain close to zero, indicating the filter is accurately estimating the state based on the current measurements.

Why NKF Messages Happen — Ranked by What We See Most Often

  1. GPS Signal Degradation: When GPS.Status is below 6, the EKF may struggle to achieve a 3D fix, leading to unstable innovations. This often results in unexpected RTL behavior.
  2. High Noise Levels: Elevated noise settings in parameters like EK3_ALT_M_NSE can lead to inaccurate estimations, resulting in high innovation values.
  3. Configuration Issues: Improperly set EKF parameters can lead to the EKF rejecting valid sensor inputs, causing erratic logging patterns.
  4. Sensor Malfunction: Malfunctioning sensors may send erroneous data to the EKF, leading to spikes in innovation rates.

Fixes for NKF Issues

  1. Adjust EK3_ALT_M_NSE to a lower value (typically around 1.0) to reduce altitude noise influences.
  2. Set EK3_VELD_M_NSE to an appropriate value (try starting with 0.5) to improve vertical velocity estimations.
  3. Ensure that GPS_HDOP_GOOD is set below 1.0; this will help maintain a reliable GPS fix.
  4. Regularly check and calibrate your sensors to ensure they are functioning correctly.

When This Isn't Actually an NKF Issue

  • High vibrations as indicated by VIBE.VibeX/Y/Z can cause similar symptoms to poor EKF performance.
  • Improper battery voltage readings (below 3.3V), which may lead to unexpected behavior but are not related to EKF filtering.
  • Flight mode changes logged under MODE messages that might affect the expected EKF behavior.

When LogHat Helps — and When It Doesn't

LogHat excels at analyzing NKF messages by providing intuitive visualizations and insights into EKF performance, helping engineers troubleshoot issues effectively. However, LogHat cannot replace the need for proper sensor calibration and real-time adjustments to parameters, which are essential for optimal EKF performance.

By understanding the nuances of EKF2 and EKF3 through NKF log messages, engineers can fine-tune their drone’s navigation capabilities and ensure reliable flight operations.
Monitoring innovations and variances through tools like Mission Planner and MAVExplorer can reveal critical insights into EKF performance and help prevent flight anomalies.
What is the main advantage of EKF3 over EKF2? A: EKF3 supports newer sensor sources and has improved filtering capabilities.
How do I adjust EKF logging levels? A: Use the configuration settings in ArduPilot to set EKF3 logging levels from 0 to 3.
Learn more about EKF logging levels in our related post.

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 engineeringstate estimation

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