Copter: fix takeoff drift if vehicle is not in origin

This commit is contained in:
chobits 2021-04-29 10:16:52 +08:00 committed by Randy Mackay
parent 9b88823ce6
commit 7b60ace18b

View File

@ -146,7 +146,7 @@ void Mode::auto_takeoff_run()
// if not armed set throttle to zero and exit immediately
if (!motors->armed() || !copter.ap.auto_armed) {
make_safe_spool_down();
wp_nav->shift_wp_origin_to_current_pos();
wp_nav->shift_wp_origin_and_destination_to_current_pos_xy();
return;
}
@ -165,7 +165,7 @@ void Mode::auto_takeoff_run()
set_land_complete(false);
} else {
// motors have not completed spool up yet so relax navigation and position controllers
wp_nav->shift_wp_origin_to_current_pos();
wp_nav->shift_wp_origin_and_destination_to_current_pos_xy();
pos_control->relax_alt_hold_controllers(0.0f); // forces throttle output to go to zero
pos_control->update_z_controller();
attitude_control->set_yaw_target_to_current_heading();