Rover: fixed a bug going into guided and rover still moving

When the rover goes into guided mode it sets the current location as
the guided point to goto.  If the rover is stationary when this
happens no problem.  If however the rover is still rolling (say going
from AUTO to GUIDED) then the rover would go past its guided position
and get confused and begin to circle it.  This change resolves that issue.
This commit is contained in:
Grant Morphett 2015-07-27 21:39:25 +10:00 committed by Randy Mackay
parent eb63293498
commit 07c57ba973

View File

@ -376,8 +376,7 @@ void Rover::update_current_mode(void)
case GUIDED:
set_reverse(false);
if (!rtl_complete) {
if (verify_RTL()) {
if (rtl_complete || verify_RTL()) {
// we have reached destination so stop where we are
channel_throttle->servo_out = g.throttle_min.get();
channel_steer->servo_out = 0;
@ -387,7 +386,6 @@ void Rover::update_current_mode(void)
calc_nav_steer();
calc_throttle(g.speed_cruise);
}
}
break;
case STEERING: {
@ -475,14 +473,12 @@ void Rover::update_navigation()
// no loitering around the wp with the rover, goes direct to the wp position
calc_lateral_acceleration();
calc_nav_steer();
if (!rtl_complete) {
if (verify_RTL()) {
if (rtl_complete || verify_RTL()) {
// we have reached destination so stop where we are
channel_throttle->servo_out = g.throttle_min.get();
channel_steer->servo_out = 0;
lateral_acceleration = 0;
}
}
break;
}
}