Copter: brake sets desired spool state

This commit is contained in:
Leonard Hall 2016-01-13 16:09:42 +09:00 committed by Randy Mackay
parent 7366bc8a56
commit 07b311f6a8
1 changed files with 7 additions and 2 deletions

View File

@ -36,13 +36,15 @@ bool Copter::brake_init(bool ignore_checks)
void Copter::brake_run()
{
// if not auto armed set throttle to zero and exit immediately
if(!ap.auto_armed) {
if (!motors.armed() || !ap.auto_armed || !motors.get_interlock()) {
wp_nav.init_brake_target(BRAKE_MODE_DECEL_RATE);
#if FRAME_CONFIG == HELI_FRAME // Helicopters always stabilize roll/pitch/yaw
// call attitude controller
attitude_control.input_euler_angle_roll_pitch_euler_rate_yaw_smooth(0, 0, 0, get_smoothing_gain());
attitude_control.set_throttle_out(0,false,g.throttle_filt);
#else // multicopters do not stabilize roll/pitch/yaw when disarmed
#else
motors.set_desired_spool_state(AP_MotorsMulticopter::DESIRED_SPIN_WHEN_ARMED);
// multicopters do not stabilize roll/pitch/yaw when disarmed
attitude_control.set_throttle_out_unstabilized(0,true,g.throttle_filt);
#endif
pos_control.relax_alt_hold_controllers(get_throttle_pre_takeoff(0)-throttle_average);
@ -59,6 +61,9 @@ void Copter::brake_run()
init_disarm_motors();
}
// set motors to full range
motors.set_desired_spool_state(AP_MotorsMulticopter::DESIRED_THROTTLE_UNLIMITED);
// run brake controller
wp_nav.update_brake(ekfGndSpdLimit, ekfNavVelGainScaler);