LOITER behavior after GPS glitch

Dear all,

While I test GPS glitch, I notice that a drone goes back to a wrong position caused by the GPS glitch.
I am not sure whether this issue is a known problem. Anyway, just in case, I would like to share this issue.

You could reproduce the issue as following steps:

  1. ./Tools/autotest/sim_vehicle.py -v ArduCopter --console -w
  2. arm and takeoff in Loiter mode
  3. param set SIM_GPS_GLITCH_Y 0.001
  4. param set SIM_GPS_GLITCH_X 0.001
  5. Increasing altitude by 120 meters
  6. param set SIM_GPS_GLITCH_X 0.000
  7. param set SIM_GPS_GLITCH_Y 0.000

Here, expected behavior is that the drone keeps staying in the home position after cleaning the GPS glitch (i.e., after step 6 and 7). However, the drone goes back to the wrong position after the step 7.



If I’m understanding correctly then this is the expected behaviour. When the EKF resets its position we also reset Loiter’s target position. This is because from a pilot’s point of view, they don’t really care exactly where they are, they care much more that the vehicle physically stays in place.

If we did not reset the loiter position then the vehicle might suddenly move after a GPS glitch and this could be dangerous.

I think if you type in “map set showsimpos 1” then you’ll see that physically the vehicle doesn’t move at all.

It’s possible that I’m misunderstanding what you’ve seen but when I tested the steps you’ve listed above the vehicle didn’t physically move.

Thank you for the explanation :slight_smile:
Please let me make sure one thing.

Are these steps correct processes?
Current ArduPilot shows behaviors as in the below.

  1. Target position is (0, 0).
  2. GPS glitch occurs.
  3. Target position is changed from (0, 0) to (99, 99).
  4. Change flight mode to GUIDED and increase altitude
  5. Resolving the GPS glitch
  6. The drone goes to the (99, 99) because the changed target position is (99, 99).

I have attached a demo video

If you don’t mind, could you please review this log file?
Even though I turn on “map set showsimpos 1”, I can still see that the drone physically moves X and Y positions after the resolving the GPS glitch (i.e., param set SIM_GPS_GLITCH_X 0 and param set SIM_GPS_GLITCH_Y 0).

Further, I am wondering why these steps in the below do not make the drone move into the changed Loiter’s target position.

  1. arm and takeoff in Loiter mode
  2. param set SIM_GPS_GLITCH_Y 0.001
  3. param set SIM_GPS_GLITCH_Y 0.000

Thank you!

Edit: It seems that changing altitude through QGroundControl is a root cause of this issue.
This is because the flight mode is changed to GUIDED and increase the drone’s altitude.


So you’re seeing the difference in behaviour on between Guided mode and Loiter. If you leave the vehicle in Loiter mode I think you’ll see it doesn’t move. Guided is different however because, like Auto, it tries to maintain a specific lat,lon,alt position.

1 Like