|
|
|
@ -153,15 +153,7 @@ void Copter::ModeAuto::takeoff_run()
@@ -153,15 +153,7 @@ void Copter::ModeAuto::takeoff_run()
|
|
|
|
|
if (!motors->armed() || !ap.auto_armed || !motors->get_interlock()) { |
|
|
|
|
// initialise wpnav targets
|
|
|
|
|
wp_nav->shift_wp_origin_to_current_pos(); |
|
|
|
|
#if FRAME_CONFIG == HELI_FRAME // Helicopters always stabilize roll/pitch/yaw
|
|
|
|
|
// call attitude controller
|
|
|
|
|
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(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
|
|
|
|
|
motors->set_desired_spool_state(AP_Motors::DESIRED_SPIN_WHEN_ARMED); |
|
|
|
|
// reset attitude control targets
|
|
|
|
|
attitude_control->set_throttle_out_unstabilized(0,true,g.throttle_filt); |
|
|
|
|
#endif |
|
|
|
|
zero_throttle_and_relax_ac(); |
|
|
|
|
// clear i term when we're taking off
|
|
|
|
|
set_throttle_takeoff(); |
|
|
|
|
return; |
|
|
|
@ -241,14 +233,7 @@ void Copter::ModeAuto::wp_run()
@@ -241,14 +233,7 @@ void Copter::ModeAuto::wp_run()
|
|
|
|
|
if (!motors->armed() || !ap.auto_armed || !motors->get_interlock()) { |
|
|
|
|
// To-Do: reset waypoint origin to current location because copter is probably on the ground so we don't want it lurching left or right on take-off
|
|
|
|
|
// (of course it would be better if people just used take-off)
|
|
|
|
|
#if FRAME_CONFIG == HELI_FRAME // Helicopters always stabilize roll/pitch/yaw
|
|
|
|
|
// call attitude controller
|
|
|
|
|
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(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
|
|
|
|
|
motors->set_desired_spool_state(AP_Motors::DESIRED_SPIN_WHEN_ARMED); |
|
|
|
|
attitude_control->set_throttle_out_unstabilized(0,true,g.throttle_filt); |
|
|
|
|
#endif |
|
|
|
|
zero_throttle_and_relax_ac(); |
|
|
|
|
// clear i term when we're taking off
|
|
|
|
|
set_throttle_takeoff(); |
|
|
|
|
return; |
|
|
|
@ -313,14 +298,7 @@ void Copter::ModeAuto::spline_run()
@@ -313,14 +298,7 @@ void Copter::ModeAuto::spline_run()
|
|
|
|
|
if (!motors->armed() || !ap.auto_armed || !motors->get_interlock()) { |
|
|
|
|
// To-Do: reset waypoint origin to current location because copter is probably on the ground so we don't want it lurching left or right on take-off
|
|
|
|
|
// (of course it would be better if people just used take-off)
|
|
|
|
|
#if FRAME_CONFIG == HELI_FRAME // Helicopters always stabilize roll/pitch/yaw
|
|
|
|
|
// call attitude controller
|
|
|
|
|
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(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
|
|
|
|
|
attitude_control->set_throttle_out_unstabilized(0,true,g.throttle_filt); |
|
|
|
|
motors->set_desired_spool_state(AP_Motors::DESIRED_SPIN_WHEN_ARMED); |
|
|
|
|
#endif |
|
|
|
|
zero_throttle_and_relax_ac(); |
|
|
|
|
// clear i term when we're taking off
|
|
|
|
|
set_throttle_takeoff(); |
|
|
|
|
return; |
|
|
|
@ -390,15 +368,7 @@ void Copter::ModeAuto::land_run()
@@ -390,15 +368,7 @@ void Copter::ModeAuto::land_run()
|
|
|
|
|
{ |
|
|
|
|
// if not auto armed or landed or motor interlock not enabled set throttle to zero and exit immediately
|
|
|
|
|
if (!motors->armed() || !ap.auto_armed || ap.land_complete || !motors->get_interlock()) { |
|
|
|
|
#if FRAME_CONFIG == HELI_FRAME // Helicopters always stabilize roll/pitch/yaw
|
|
|
|
|
// call attitude controller
|
|
|
|
|
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(0, 0, 0, get_smoothing_gain()); |
|
|
|
|
attitude_control->set_throttle_out(0,false,g.throttle_filt); |
|
|
|
|
#else |
|
|
|
|
motors->set_desired_spool_state(AP_Motors::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 |
|
|
|
|
zero_throttle_and_relax_ac(); |
|
|
|
|
// set target to current position
|
|
|
|
|
wp_nav->init_loiter_target(); |
|
|
|
|
return; |
|
|
|
@ -570,15 +540,7 @@ void Copter::ModeAuto::loiter_run()
@@ -570,15 +540,7 @@ void Copter::ModeAuto::loiter_run()
|
|
|
|
|
{ |
|
|
|
|
// if not auto armed or motor interlock not enabled set throttle to zero and exit immediately
|
|
|
|
|
if (!motors->armed() || !ap.auto_armed || ap.land_complete || !motors->get_interlock()) { |
|
|
|
|
#if FRAME_CONFIG == HELI_FRAME // Helicopters always stabilize roll/pitch/yaw
|
|
|
|
|
// call attitude controller
|
|
|
|
|
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(0, 0, 0, get_smoothing_gain()); |
|
|
|
|
attitude_control->set_throttle_out(0,false,g.throttle_filt); |
|
|
|
|
#else |
|
|
|
|
motors->set_desired_spool_state(AP_Motors::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 |
|
|
|
|
zero_throttle_and_relax_ac(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|