mirror of https://github.com/ArduPilot/ardupilot
Rover: integrate balancebot pitch limit protection
This commit is contained in:
parent
71ae3f0a13
commit
f74d22135c
|
@ -8,7 +8,7 @@ void Rover::balancebot_pitch_control(float &throttle)
|
||||||
const float demanded_pitch = radians(-throttle * 0.01f * g2.bal_pitch_max) + radians(g2.bal_pitch_trim);
|
const float demanded_pitch = radians(-throttle * 0.01f * g2.bal_pitch_max) + radians(g2.bal_pitch_trim);
|
||||||
|
|
||||||
// calculate required throttle using PID controller
|
// calculate required throttle using PID controller
|
||||||
throttle = g2.attitude_control.get_throttle_out_from_pitch(demanded_pitch, g2.motors.limit.throttle_lower || g2.motors.limit.throttle_upper, G_Dt) * 100.0f;
|
throttle = g2.attitude_control.get_throttle_out_from_pitch(demanded_pitch, radians(g2.bal_pitch_max), g2.motors.limit.throttle_lower || g2.motors.limit.throttle_upper, G_Dt) * 100.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if vehicle is a balance bot
|
// returns true if vehicle is a balance bot
|
||||||
|
|
|
@ -317,7 +317,9 @@ void Mode::calc_throttle(float target_speed, bool avoidance_enabled)
|
||||||
bool stopped;
|
bool stopped;
|
||||||
throttle_out = 100.0f * attitude_control.get_throttle_out_stop(g2.motors.limit.throttle_lower, g2.motors.limit.throttle_upper, g.speed_cruise, g.throttle_cruise * 0.01f, rover.G_Dt, stopped);
|
throttle_out = 100.0f * attitude_control.get_throttle_out_stop(g2.motors.limit.throttle_lower, g2.motors.limit.throttle_upper, g.speed_cruise, g.throttle_cruise * 0.01f, rover.G_Dt, stopped);
|
||||||
} else {
|
} else {
|
||||||
throttle_out = 100.0f * attitude_control.get_throttle_out_speed(target_speed, g2.motors.limit.throttle_lower, g2.motors.limit.throttle_upper, g.speed_cruise, g.throttle_cruise * 0.01f, rover.G_Dt);
|
bool motor_lim_low = g2.motors.limit.throttle_lower || attitude_control.pitch_limited();
|
||||||
|
bool motor_lim_high = g2.motors.limit.throttle_upper || attitude_control.pitch_limited();
|
||||||
|
throttle_out = 100.0f * attitude_control.get_throttle_out_speed(target_speed, motor_lim_low, motor_lim_high, g.speed_cruise, g.throttle_cruise * 0.01f, rover.G_Dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if vehicle is balance bot, calculate actual throttle required for balancing
|
// if vehicle is balance bot, calculate actual throttle required for balancing
|
||||||
|
|
Loading…
Reference in New Issue