Browse Source

Rover: simplify logic for lateral-accel override during use-pivot-steering

It was theoretically possible that the lateral-acceleration would not be overwritten if the yaw-error-cd was exactly zero
mission-4.1.18
Randy Mackay 7 years ago
parent
commit
7e2214c2be
  1. 5
      APMrover2/mode.cpp

5
APMrover2/mode.cpp

@ -205,10 +205,9 @@ void Mode::calc_lateral_acceleration(const struct Location &origin, const struct @@ -205,10 +205,9 @@ void Mode::calc_lateral_acceleration(const struct Location &origin, const struct
_yaw_error_cd = wrap_180_cd(rover.nav_controller->target_bearing_cd() - ahrs.yaw_sensor);
}
if (rover.use_pivot_steering(_yaw_error_cd)) {
if (is_positive(_yaw_error_cd)) {
if (_yaw_error_cd >= 0.0f) {
lateral_acceleration = g.turn_max_g * GRAVITY_MSS;
}
if (is_negative(_yaw_error_cd)) {
} else {
lateral_acceleration = -g.turn_max_g * GRAVITY_MSS;
}
}

Loading…
Cancel
Save