Rover: integrate vectored thrust support

This commit is contained in:
Randy Mackay 2018-04-09 21:12:07 +09:00
parent 3f1f68b130
commit 8119c537c7
3 changed files with 19 additions and 3 deletions

View File

@ -354,7 +354,12 @@ void Mode::calc_steering_from_lateral_acceleration(float lat_accel, bool reverse
lat_accel = constrain_float(lat_accel, -g.turn_max_g * GRAVITY_MSS, g.turn_max_g * GRAVITY_MSS);
// 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.limit.steer_left, g2.motors.limit.steer_right, reversed);
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.set_steering(steering_out * 4500.0f);
}
@ -362,7 +367,12 @@ void Mode::calc_steering_from_lateral_acceleration(float lat_accel, bool reverse
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.limit.steer_left, g2.motors.limit.steer_right, reversed);
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.set_steering(steering_out * 4500.0f);
}

View File

@ -19,6 +19,7 @@ void ModeAcro::update()
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);

View File

@ -65,7 +65,12 @@ 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.limit.steer_left, g2.motors.limit.steer_right, _desired_speed < 0);
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.set_steering(steering_out * 4500.0f);
calc_throttle(_desired_speed, true, true);
} else {