The aircraft changed to another copy of the EKF
What ArduPilot says:
- NavEKF2: lane switch N
- EKF3 lane switch N
- EKF primary changed:N
The EKF, ArduPilot's position and attitude estimator, runs one copy (a lane, or core) per IMU. Each has an error score: how badly GPS and barometer (and compass or airspeed, if asked) disagree with it. Armed, the aircraft follows one lane and moves to another when the active one turns unhealthy or scores above 1.0 while another does better, or as a last attempt just before an EKF failsafe. The number is the new lane, counting from 0. On a copter “EKF primary changed” reports the same event.
What to do, most likely first
One IMU saw more vibration than the other, or clipped, and its lane drifted.
CheckCompare the IMUs in the log (vibration, clipping, accelerometer traces). The lane that was left is the suspect.
FixReduce the vibration. If the same IMU is always the bad one, look at how the board is mounted: on many boards one IMU is damped and another is not.
The lanes use different compasses, GPS units or barometers, and one of those sensors went bad.
Check
EK3_AFFINITYis not 0; look for compass, GPS or barometer messages at the same time.FixThe switch did its job; find and repair the sensor that failed.
A GPS glitch or a compass disturbance hit every lane, and the switch was the last attempt before an EKF failsafe.
Check“EKF variance” or an EKF failsafe follows within a second or two.
FixSee “EKF variance”.
One switch in a flight that otherwise went well is the redundancy working. Repeated switches mean an IMU or a sensor needs attention. In the log: error subsystem 24, the code is the new lane.
Parameters to look at
| Parameter | What it is |
|---|---|
EK3_IMU_MASK | Bitmask of active IMUs |
EK3_PRIMARY | Primary core number |
EK3_AFFINITY | EKF3 Sensor Affinity Options |
EK3_ERR_THRESH | EKF3 Lane Relative Error Sensitivity Threshold |
EK3_OPTIONS | Optional EKF behaviour |
Where to do it:Setup & Tuning GuideSetup & Tuning Guide
The code that sends it
NavEKF2: lane switch N
libraries/AP_NavEKF2/AP_NavEKF2.cpp NavEKF2::checkLaneSwitch() · Open in ArduPilot Copter-4.7.1
EKF3 lane switch N
libraries/AP_NavEKF3/AP_NavEKF3.cpp NavEKF3::UpdateFilter() · Open in ArduPilot Copter-4.6.3
libraries/AP_NavEKF3/AP_NavEKF3.cpp NavEKF3::checkLaneSwitch() · Open in ArduPilot Copter-4.6.3
libraries/AP_NavEKF3/AP_NavEKF3.cpp NavEKF3::switchLane() · Open in ArduPilot Copter-4.7.1
EKF primary changed:N
ArduCopter/ekf_check.cpp Copter::check_ekf_reset() · Open in ArduPilot Copter-4.7.1