Copter: zigzag smoother stops on terrain failure

This commit is contained in:
Randy Mackay 2019-08-22 11:47:43 +09:00
parent 8e385d7453
commit 8a20d37799

View File

@ -122,11 +122,15 @@ void ModeZigZag::return_to_manual_control(bool maintain_target)
if (stage == AUTO) {
stage = MANUAL_REGAIN;
loiter_nav->clear_pilot_desired_acceleration();
if (maintain_target) {
const Vector3f wp_dest = wp_nav->get_wp_destination();
loiter_nav->init_target(wp_dest);
if (maintain_target && wp_nav->origin_and_destination_are_terrain_alt()) {
if (wp_nav->origin_and_destination_are_terrain_alt()) {
copter.surface_tracking.set_target_alt_cm(wp_dest.z);
}
} else {
loiter_nav->init_target();
}
gcs().send_text(MAV_SEVERITY_INFO, "ZigZag: manual control");
}
}