ArduPilot / ardupilot

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

AHRS: continue to calculate after GPS lost #9853

Closed tatsuy closed 1 month ago

tatsuy commented 5 years ago

Issue details AHRS(AP_AHRS_NavEKF::update function) don't check EKF failsafe.

Repro step is here:

  1. Waiting for setting home in AHRS (wait for the message "EKF2 IMU0 is using GPS")
  2. Arming in Guided mode
  3. TakeOff and do "Fly To Here"
  4. GPS lost while moving (param set SIM_GPS_DISABLE 1)

After GPS lost, AHRS continue to update the position (GLOBAL_POSITION_INT). Therefore, the vehicle keeps moving on Mission Planner despite of stopping.

Version master

Platform [〇] Copter [〇] Rover checked only the two types.

Hardware type SITL

WickedShell commented 5 years ago

GLOBAL_POSITION_INT should be sent regardless of GPS status. We've discussed this before and there are a couple of main points with it:

With all that being said I'm not sure I see a real issue here?

rmackay9 commented 5 years ago

I've seen some cases where the Mission Planner moves the focus on the map to the coast of Africa which is a bit annoying for the user. This is probably caused by the GLOBAL_POSITION_INT message being sent with zero lat,lon. We should probably ask MichaelOborne to not update the vehicle's position on the map when the lat,lon in the message is (0,0).

I think some of this problem will go away when we remove DCM as an option for Rover because I think the EKF doesn't normally drift as far as DCM does.. i.e. it gives up more easily.

tatsuy commented 5 years ago

Thank you for the comments.

It's good to keep the position after GPS lost. But I thought that it's necessary to stop to calculate using IMU after ekf failsafe or disarmed. I made this video for my description. https://youtu.be/l-eAtR0F8g0

It's better to stop the position after ekf failsafe or disarmed. Because we cannot find the vehicle using displaying on MP when the vehicle stop far away.

rmackay9 commented 5 years ago

I looked into this today and I'm actually a bit surprised that the position keeps updating. I agree that it would make more sense if it stopped. Certainly from a user's point of view, having the vehicle apparently fly off forever isn't useful.

wangcongai commented 3 months ago

I test this case on my SITL COPTER==3.3 The position in GLOBAL_POSITION_INT message keeps updated after lost GPS(set SIM_GPS_DISABLE=1) for about 10 seconds. Then the position return back to the moment when GPS was lost. If you set FS_EKF_THRESH=0.8 as default,after 10 seconds, you will get an error report: "ERROR:autopilot:EKF variance", then the copter change into LAND MODE immediataly. If you set FS_EKF_THRESH=0(disable EKF failsafe),after 10 seconds, the copter will continue fly under DEAD RECKONING. But the price is, the position in GLOBAL_POSITION_INT return back to the moment when GPS was lost. So we lost track of the copter. In the ardupilot website, [GPS Failsafe and Glitch Protection](https://ardupilot.org/copter/docs/gps-failsafe-glitch-protection.html), it said:

image

which is confirmed by my simulation:

image
rmackay9 commented 3 months ago

Hi @wangcongai,

Thanks for the input. Which version of AP are you using? You mention, "SITL COPTER==3.3" so does this mean you're using Copter-3.3? If "yes" then that is really far too old a version to provide a good reference for this issue. It would be best to re-test with Copter-4.5 or 4.6.

wangcongai commented 3 months ago

Hi @wangcongai,

Thanks for the input. Which version of AP are you using? You mention, "SITL COPTER==3.3" so does this mean you're using Copter-3.3? If "yes" then that is really far too old a version to provide a good reference for this issue. It would be best to re-test with Copter-4.5 or 4.6.

Hi @rmackay9 , You are right and my test was on Dronekit-sitl's default copter, which is an old version=3.3. Follow your advice, I rebuild a Copter-4.6.0-dev0 and retest it. I set SIM_GPS_DISABLE=1 to disable GPS, set FS_EKF_THRESH=0(disable EKF failsafe), and test fly east 50 meters and 100 meters. The 50 meters dead-reckoning experiment is good. But the 100 meters dead-reckoning get a warning "WARNING:autopilot:EKF3 IMU1 stopped aiding, WARNING:autopilot:EKF3 IMU0 stopped aiding" at about 15 seconds(almost reach the target), after that, LOCAL_POSITION_INT message stops transmitting via mavlink. Then there is a big GPS drift after I reopen GPS(SIM_GPS_DISABLE=0)

image image image

So in General, new version of copter seems to improve the dead reckoning fly, but still it cannot last for about 15 seconds.

peterbarker commented 1 month ago

This sounds like everything is working as expected, then?

tatsuy commented 1 month ago

@peterbarker Yes, I tested it again with V4.6.0-dev and it worked as expected. This is an old issue so I close it.