Browse Source

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
mission-4.1.18
Randy Mackay 7 years ago
parent
commit
ef2223a712
  1. 12
      APMrover2/mode.cpp
  2. 5
      APMrover2/mode_acro.cpp
  3. 5
      APMrover2/mode_guided.cpp

12
APMrover2/mode.cpp

@ -329,7 +329,7 @@ void Mode::calc_steering_to_waypoint(const struct Location &origin, const struct @@ -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 @@ -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) @@ -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);
}

5
APMrover2/mode_acro.cpp

@ -18,11 +18,8 @@ void ModeAcro::update() @@ -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);

5
APMrover2/mode_guided.cpp

@ -66,11 +66,8 @@ void ModeGuided::update() @@ -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 {

Loading…
Cancel
Save