Plane: support autotune for yaw rate control
This commit is contained in:
parent
81d20ae49d
commit
55d8afa1dd
@ -595,6 +595,11 @@ void Plane::calc_nav_yaw_coordinated(float speed_scaler)
|
||||
plane.guided_state.last_forced_rpy_ms.z > 0 &&
|
||||
millis() - plane.guided_state.last_forced_rpy_ms.z < 3000) {
|
||||
commanded_rudder = plane.guided_state.forced_rpy_cd.z;
|
||||
} else if (control_mode == &mode_autotune && g.acro_yaw_rate > 0 && yawController.rate_control_enabled()) {
|
||||
// user is doing an AUTOTUNE with yaw rate control
|
||||
const float rudd_expo = rudder_in_expo(true);
|
||||
const float yaw_rate = (rudd_expo/SERVO_MAX) * g.acro_yaw_rate;
|
||||
commanded_rudder = yawController.get_rate_out(yaw_rate, speed_scaler, false);
|
||||
} else {
|
||||
if (control_mode == &mode_stabilize && rudder_in != 0) {
|
||||
disable_integrator = true;
|
||||
|
@ -546,7 +546,7 @@ const AP_Param::Info Plane::var_info[] = {
|
||||
|
||||
// @Param: ACRO_YAW_RATE
|
||||
// @DisplayName: ACRO mode yaw rate
|
||||
// @Description: The maximum yaw rate at full stick deflection in ACRO mode. If this is zero then rudder is directly controlled by rudder stick input
|
||||
// @Description: The maximum yaw rate at full stick deflection in ACRO mode. If this is zero then rudder is directly controlled by rudder stick input. This option is only available if you also set YAW_RATE_ENABLE to 1.
|
||||
// @Units: deg/s
|
||||
// @Range: 0 500
|
||||
// @Increment: 1
|
||||
|
@ -164,6 +164,7 @@ void Plane::autotune_start(void)
|
||||
gcs().send_text(MAV_SEVERITY_INFO, "Started autotune");
|
||||
rollController.autotune_start();
|
||||
pitchController.autotune_start();
|
||||
yawController.autotune_start();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -173,6 +174,7 @@ void Plane::autotune_restore(void)
|
||||
{
|
||||
rollController.autotune_restore();
|
||||
pitchController.autotune_restore();
|
||||
yawController.autotune_restore();
|
||||
gcs().send_text(MAV_SEVERITY_INFO, "Stopped autotune");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user