Rover: integrate attitude control change to steering output and scaling

steering output is always positive for clockwise
steering is scaled in motors library meaning we do not need to tell attitude controller about skid-steering or vectored-thrust
This commit is contained in:
Randy Mackay 2018-05-03 17:59:37 +09:00
parent 0830e057e0
commit ef2223a712
3 changed files with 5 additions and 17 deletions

View File

@ -329,7 +329,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, reversed);
calc_steering_to_heading(desired_heading);
} else {
// call lateral acceleration to steering controller
calc_steering_from_lateral_acceleration(desired_lat_accel, reversed);
@ -351,11 +351,8 @@ void Mode::calc_steering_from_lateral_acceleration(float lat_accel, bool reverse
// send final steering command to motor library
const float steering_out = attitude_control.get_steering_out_lat_accel(lat_accel,
g2.motors.have_skid_steering(),
g2.motors.have_vectored_thrust(),
g2.motors.limit.steer_left,
g2.motors.limit.steer_right,
reversed);
g2.motors.limit.steer_right);
g2.motors.set_steering(steering_out * 4500.0f);
}
@ -364,11 +361,8 @@ void Mode::calc_steering_to_heading(float desired_heading_cd, 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),
g2.motors.have_skid_steering(),
g2.motors.have_vectored_thrust(),
g2.motors.limit.steer_left,
g2.motors.limit.steer_right,
reversed);
g2.motors.limit.steer_right);
g2.motors.set_steering(steering_out * 4500.0f);
}

View File

@ -18,11 +18,8 @@ void ModeAcro::update()
// run steering turn rate controller and throttle controller
const float steering_out = attitude_control.get_steering_out_rate(
target_turn_rate,
g2.motors.have_skid_steering(),
g2.motors.have_vectored_thrust(),
g2.motors.limit.steer_left,
g2.motors.limit.steer_right,
reversed);
g2.motors.limit.steer_right);
g2.motors.set_steering(steering_out * 4500.0f);

View File

@ -66,11 +66,8 @@ void ModeGuided::update()
if (have_attitude_target) {
// run steering and throttle controllers
float steering_out = attitude_control.get_steering_out_rate(radians(_desired_yaw_rate_cds / 100.0f),
g2.motors.have_skid_steering(),
g2.motors.have_vectored_thrust(),
g2.motors.limit.steer_left,
g2.motors.limit.steer_right,
_desired_speed < 0);
g2.motors.limit.steer_right);
g2.motors.set_steering(steering_out * 4500.0f);
calc_throttle(_desired_speed, true, true);
} else {