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