|
|
|
@ -257,8 +257,9 @@ void Copter::ModeRTL::descent_start()
@@ -257,8 +257,9 @@ void Copter::ModeRTL::descent_start()
|
|
|
|
|
// called by rtl_run at 100hz or more
|
|
|
|
|
void Copter::ModeRTL::descent_run() |
|
|
|
|
{ |
|
|
|
|
int16_t roll_control = 0, pitch_control = 0; |
|
|
|
|
float target_yaw_rate = 0; |
|
|
|
|
float target_roll = 0.0f; |
|
|
|
|
float target_pitch = 0.0f; |
|
|
|
|
float target_yaw_rate = 0.0f; |
|
|
|
|
|
|
|
|
|
// if not auto armed or motor interlock not enabled set throttle to zero and exit immediately
|
|
|
|
|
if (!motors->armed() || !ap.auto_armed || !motors->get_interlock()) { |
|
|
|
@ -282,9 +283,13 @@ void Copter::ModeRTL::descent_run()
@@ -282,9 +283,13 @@ void Copter::ModeRTL::descent_run()
|
|
|
|
|
// apply SIMPLE mode transform to pilot inputs
|
|
|
|
|
update_simple_mode(); |
|
|
|
|
|
|
|
|
|
// process pilot's roll and pitch input
|
|
|
|
|
roll_control = channel_roll->get_control_in(); |
|
|
|
|
pitch_control = channel_pitch->get_control_in(); |
|
|
|
|
// convert pilot input to lean angles
|
|
|
|
|
get_pilot_desired_lean_angles(channel_roll->get_control_in(), channel_pitch->get_control_in(), target_roll, target_pitch, wp_nav->get_loiter_angle_max_cd(), attitude_control->get_althold_lean_angle_max()); |
|
|
|
|
|
|
|
|
|
// record if pilot has overriden roll or pitch
|
|
|
|
|
if (!is_zero(target_roll) || !is_zero(target_pitch)) { |
|
|
|
|
ap.land_repo_active = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// get pilot's desired yaw rate
|
|
|
|
@ -295,7 +300,7 @@ void Copter::ModeRTL::descent_run()
@@ -295,7 +300,7 @@ void Copter::ModeRTL::descent_run()
|
|
|
|
|
motors->set_desired_spool_state(AP_Motors::DESIRED_THROTTLE_UNLIMITED); |
|
|
|
|
|
|
|
|
|
// process roll, pitch inputs
|
|
|
|
|
wp_nav->set_pilot_desired_acceleration(roll_control, pitch_control); |
|
|
|
|
wp_nav->set_pilot_desired_acceleration(target_roll, target_pitch, G_Dt); |
|
|
|
|
|
|
|
|
|
// run loiter controller
|
|
|
|
|
wp_nav->update_loiter(ekfGndSpdLimit, ekfNavVelGainScaler); |
|
|
|
|