"Autopilot off! Returning control to pilot" spam

Hi all,

I have been testing loss of GPS failsafe for my drone with v1.9.2 and I noticed the following:

  • when loosing it in Position mode, the drone reverts to Altitude as planned
  • when loosing it in Hold/Loiter mode, the drone stays in the mode. (Potential bug #1?)

Moreover if I try to take over with my RC, when the drone is still in Hold mode without GPS, I have a spam of “Autopilot off! Returning control to pilot”. Wen looking to to the code I noticed that a transition to Position is enforced when the RC sticks are moved, and due to the lack of GPS the transition keeps failling. (Potential bug #2)
A comment states “revert to position control in any case” so I do not know if there was an historic reason for that (I tried to git blame the file but git crashed because it is too big…)

I did not open any issues yet as I did not know if that should be considered as such.

Log can be found here: https://review.px4.io/plot_app?log=4ececb97-a25a-4653-b7b4-ef6f3f382279

PX4 shell + actions:
INFO [commander] Takeoff detected
Drones transitions to Hold mode and then is moved manually: OK
WARN [commander] Autopilot off! Returning control to pilot
Probably not the cleanest way to test GPS loss…
pxh> gpssim stop
INFO [gpssim] exiting
WARN [mc_pos_control] Position-Control Setpoint-Update failed
WARN [commander] Failsafe enabled: no local position
WARN [ecl/EKF] EKF GPS data stopped
WARN [ecl/EKF] EKF stopping navigation
Automatically transitionned to Altitude, flown it manually a bit
pxh> gpssim start
pxh> INFO [ecl/EKF] EKF commencing GPS fusion
Change to Hold mode using QGC
pxh> gpssim stop
INFO [gpssim] exiting
pxh> WARN [mc_pos_control] Position-Control Setpoint-Update failed
WARN [mc_pos_control] Failsafe: Descend with land-speed.
WARN [ecl/EKF] EKF GPS data stopped
WARN [ecl/EKF] EKF stopping navigation
WARN [commander] Failsafe enabled: no global position
No transition and then try to take over with the joystick
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
[ a few more hundred lines like that…]
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
WARN [commander] Autopilot off! Returning control to pilot
INFO [commander] Landing detected
INFO [commander] Takeoff detected
INFO [commander] Landing detected
INFO [logger] closed logfile, bytes written: 6996197