init disarm motors
I would suggest while calling init_disarm_motors we also include a mode change to stabilize. See below at the end of the function call:
static void init_disarm_motors() {
if HIL_MODE != HIL_MODE_DISABLED || CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL
gcs_send_text_P(SEVERITY_HIGH, PSTR("DISARMING MOTORS"));
endif
motors.armed(false);
set_armed(false);
motors.auto_armed(false);
set_auto_armed(false);
compass.save_offsets();
g.throttle_cruise.save();
// we are not in the air
set_takeoff_complete(false);
if COPTER_LEDS == ENABLED
if ( bitRead(g.copter_leds_mode, 3) ) {
piezo_beep();
}
endif
// setup fast AHRS gains to get right attitude
ahrs.set_fast_gains(true);
if SECONDARY_DMP_ENABLED == ENABLED
ahrs2.set_fast_gains(true);
endif
// add in mode switch to exit AP modes.
set_mode(STABILIZE);
}
didn't mean to close the issue!
I can't see too much real harm in switching to stabilize mode but I'm wondering what the advantage would be? One disadvantage is the person could actually arm the motors again while their flight mode switch is still in AUTO or RTL mode...unless of course we're at the end of an RTL that was kicked off from a failsafe event. I'm not super keen on changing the flight modes unless we really need to. I kinda think people should get use to the copter switching the flight mode only in emergencies and then it will just stay there until they take back control.
I'm going to close this issue for now but if more people express a desire that they want it to automatically switch out of AUTO, RTL etc automatically into stabilize then I'll make the change.