APMRover2: prevent unless calculus when stoping

This commit is contained in:
Pierre Kancir 2017-05-03 16:06:38 +02:00 committed by Grant Morphett
parent 670e7b7914
commit ed26c103f9

View File

@ -569,11 +569,12 @@ void Rover::update_navigation()
case RTL:
// no loitering around the wp with the rover, goes direct to the wp position
calc_lateral_acceleration();
calc_nav_steer();
if (verify_RTL()) {
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, g.throttle_min.get());
set_mode(HOLD);
} else {
calc_lateral_acceleration();
calc_nav_steer();
}
break;
@ -585,13 +586,14 @@ void Rover::update_navigation()
case Guided_WP:
// no loitering around the wp with the rover, goes direct to the wp position
calc_lateral_acceleration();
calc_nav_steer();
if (rtl_complete || verify_RTL()) {
// we have reached destination so stop where we are
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, g.throttle_min.get());
SRV_Channels::set_output_scaled(SRV_Channel::k_steering, 0);
lateral_acceleration = 0;
} else {
calc_lateral_acceleration();
calc_nav_steer();
}
break;