ArduPilot / ardupilot

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

AP_NavEKF2: pos not reset to ext nav init pos #14801

Open chobitsfan opened 4 years ago

chobitsfan commented 4 years ago

When use motion capture system for indoor flight navigation (ATT_POS_MOCAP or VISION_POSITION_ESTIMATE). If vehicle is not boot near motion capture system origin. (for example, vehicle is boot in a position 1.2m away from mocap origin), EKF2 will not reset to ext nav initial pos.

Log Browser - 9 1980-1-1 上午 08-00-00 bin 2020_7_13 上午 10_50_38 9 1980-1-1 08-00-00.zip (EKF PN graph left, VISP PX graph right) Drone is placed 1.2m away from ext nav origin and boot. After drone start receive ext nav data, EKF2 seems fuse these data. Because EKF2 do not reset to initial ext nav pos in ResetPosition(), there is diff between EKF position and VISP. It makes drone keep reporting "prearm: need 3d fix" and unable to arm

Log Browser - 8 1980-1-1 上午 08-00-00 bin 2020_7_13 上午 11_04_05 8 1980-1-1 08-00-00.zip (EKF PN graph left, VISP PX graph right) If drone is placed closer to ext nav origin and boot. EKF will reset to initial ext nav pos and everything is working well then

chobitsfan commented 4 years ago

The real cause is EKF2 pos did not reset to ext nav init pos because extNavDataDelayed is too old to pass this check https://github.com/ArduPilot/ardupilot/blob/1db0feea59bfc7b531fff957d7eed4ff00b1dfb7/libraries/AP_NavEKF2/AP_NavEKF2_PosVelFusion.cpp#L127 This problem is fixed in EKF3