ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
10.69k stars 17.16k forks source link

EKF3: switching sources between ExtNav and OptFlow leads to position jump if GPS enabled #27729

Open rmackay9 opened 1 month ago

rmackay9 commented 1 month ago

If GPS/Non-GPS transitions are setup using External Nav (e.g. Visual Odometry) and Optical flow then transitions from optical flow to External Nav may result in a large position jump to the GPS location even though the GPS is not defined in any of the source sets (e.g. the GPS is not defined in any EK3SRCx parameters)

Below is an image from SITL testing where GCS_SEND_TEXT() debug messages were added to NavEKF3_core::ResetPosition() to determine the position source used for the position reset. image

The issue can be reproduced in SITL by doing the following the SITL instructions for Vicon and optical flow. To be more specific follow these instructions:

Fly the vehicle in Guided mode first using External nav

At this last command the vehicle will momentarily appear where the GPS reports the vehicle to be and then move violently back to where it was.

peterbarker commented 1 month ago

Could be related to this: https://github.com/ArduPilot/ardupilot/issues/16046