Mode-transition-induced crash caused by unsafe RC3 throttle state

//:frowning: I encountered this problem in an automatic task. I’m not quite sure why it’s set up this way

When the Copter is in the climb phase, switching the flight mode to LOITER should make the vehicle hold its current position and maintain altitude if no explicit descent command is given. However, in SITL, after switching to LOITER during climb, the vehicle continues descending and hits the ground. The console reports:

Mode LOITER
AP: SIM Hit ground at 2.371820 m/s

The suspected root cause is inconsistent handling of the RC3 throttle input during the mode transition. In AUTO/TAKEOFF, the vehicle is climbing under autonomous altitude control, but after switching to LOITER, the controller starts interpreting the current RC3 value as a manual altitude command. If the default RC3 value is below the neutral/mid-throttle region, LOITER treats it as a descent command rather than preserving the current altitude. As a result, the vehicle can descend and hit the ground immediately after the mode switch.

This behavior is unsafe because the mode transition from an autonomous climb phase to LOITER can unintentionally convert an implicit/default RC3 value into an active descent command. The vehicle should either initialize the LOITER altitude target from the current altitude and ignore stale/default RC3 input for a short transition period, or ensure that the default RC3 value used in SITL/failsafe/RC-override contexts corresponds to the neutral throttle region expected by LOITER.

Reproduction outline:

  1. Start Copter SITL with a mission or takeoff sequence.

  2. Arm and start autonomous takeoff or AUTO mission so that the vehicle enters a climb phase.

  3. During climb, switch the mode to LOITER.

  4. Observe that the vehicle does not hold altitude, but descends and hits the ground.

  5. The console reports Mode LOITER followed by AP: SIM Hit ground at 2.371820 m/s.

Expected behavior:
After switching to LOITER during climb, if no explicit descent command is issued, the Copter should hold the current altitude or stabilize around the current altitude target.

Actual behavior:
After switching to LOITER, the Copter interprets the current/default RC3 value as a descent command and hits the ground.

A similar discussion a while back, but for non-manual and manual collective modes…

ETA:

I don’t think that is exactly correct.

If you switch to LOITER, the helicopter will stop and hold its position laterally, but if the collective is not centered, it will immediately begin climbing or descending.

If the collective is all the way down and you switch to LOITER, it will immediately begin descending at the rate set by PILOT_SPD_DN (or if set to 0, PILOT_SPD_UP).

In other words, I think what you are seeing is normal behavior, as there is not presently a feature to hold the altitude until an RC3 input change is detected.

Thanks! I tried setting RC3 to 1500 before starting the mission, but this triggers the pre-arm check message:

AP: Arm: Throttle (RC3) is not neutral

As a result, I cannot arm the Copter.

One possible workaround is to set RC3 to 1500 after takeoff and before switching to LOITER, so that the throttle stick is kept around the neutral/mid position.( I am not sure whether this workaround could introduce other side effects)

Overall, it seems that this case may require a smoother transition between non-manual altitude-control modes and manual collective/throttle-controlled modes. Otherwise, when switching to LOITER during the climb phase, the current or default RC3 value may be interpreted as an unintended descent command, causing the vehicle to lose altitude instead of holding the current altitude.

If you look at the Pre-Arm Safety Checks, you’ll see that “Throttle is not neutral” means “RC transmitter’s throttle stick is too high”.

There was also a recent change in the latest firmware that requires collective to be all the way down before arming is allowed.

I think that will give you the result you’re looking for.

1 Like

I think the default behavior of auto takeoff is to wait for stick to be up, if not the default there definitely was a bit to set that.

IIRC if you set throttle feedback from mid stick throttle check will pass at 0 climb rate in altitude control modes.

Setting PILOT_THR_BHV=1 and then setting RC3 does solve the pre-arm check issue.
the LOITER behavior now looks like what I expected: when switching to LOITER, the vehicle holds altitude instead of immediately descending due to the low/default throttle value. Thanks!

1 Like

I completely disagree. How is the controller to know that the RC values are stale. SITL is probably a bad way to test this because it expects the RC to be there. If the option for no RC is selected then maybe. At that point though you should have RC override and if you don’t and switch into loiter mode then shame on you. Loiter mode is a piloted mode meaning it expects a pilot on the controls.

Glad @nspector was able to get you to the right settings.

IIRC if there is no RC input transition to pilot modes should fail. SITL provides RC stream that defaults to sticks centered with 0 throttle so radio check passes.