|
|
|
@ -363,7 +363,7 @@ void Mode::calc_steering_to_waypoint(const struct Location &origin, const struct
@@ -363,7 +363,7 @@ void Mode::calc_steering_to_waypoint(const struct Location &origin, const struct
|
|
|
|
|
|
|
|
|
|
if (rover.use_pivot_steering(_yaw_error_cd)) { |
|
|
|
|
// for pivot turns use heading controller
|
|
|
|
|
calc_steering_to_heading(desired_heading); |
|
|
|
|
calc_steering_to_heading(desired_heading, g2.pivot_turn_rate); |
|
|
|
|
} else { |
|
|
|
|
// call lateral acceleration to steering controller
|
|
|
|
|
calc_steering_from_lateral_acceleration(desired_lat_accel, reversed); |
|
|
|
@ -392,10 +392,11 @@ void Mode::calc_steering_from_lateral_acceleration(float lat_accel, bool reverse
@@ -392,10 +392,11 @@ void Mode::calc_steering_from_lateral_acceleration(float lat_accel, bool reverse
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// calculate steering output to drive towards desired heading
|
|
|
|
|
void Mode::calc_steering_to_heading(float desired_heading_cd, bool reversed) |
|
|
|
|
void Mode::calc_steering_to_heading(float desired_heading_cd, float rate_max, bool reversed) |
|
|
|
|
{ |
|
|
|
|
// calculate yaw error (in radians) and pass to steering angle controller
|
|
|
|
|
const float steering_out = attitude_control.get_steering_out_heading(radians(desired_heading_cd*0.01f), |
|
|
|
|
rate_max, |
|
|
|
|
g2.motors.limit.steer_left, |
|
|
|
|
g2.motors.limit.steer_right); |
|
|
|
|
g2.motors.set_steering(steering_out * 4500.0f); |
|
|
|
|