mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-26 01:00:36 +08:00
refactor(tecs)!: remove the energy balance rate feedforward gain FW_T_SEB_R_FF
The pitch converts its balance rate setpoint together with the total energy rate to the potential energy rate it flies, (SEB rate + STE rate) / (2 g V). Only the full feedforward gives that potential energy rate; any other gain mixes in a share of the total energy rate. Feed the setpoint forward in full and remove the parameter. No airframe sets it. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
1 parent
e8f1f5097d
commit
acad041562
7 files changed
+4
-50
No files matched your search
@@ -545,10 +545,10 @@ float TECSControl::_sebRateToClimbAngle(float seb_rate, float ste_rate, const In
|
||||
float TECSControl::_calcPitchControlOutput(const Input &input, const ControlValues &seb_rate, float ste_rate_setpoint,
|
||||
const Param ¶m) const
|
||||
{
|
||||
// Calculate a specific energy correction that doesn't include the integrator contribution
|
||||
float SEB_rate_correction = _getControlError(seb_rate) * param.pitch_damping_gain +
|
||||
param.seb_rate_ff *
|
||||
seb_rate.setpoint;
|
||||
// Calculate a specific energy correction that doesn't include the integrator contribution. The setpoint is fed
|
||||
// forward in full: together with the total energy rate it converts to the potential energy rate the pitch flies,
|
||||
// a partial feedforward would mix in a share of the total energy rate instead.
|
||||
float SEB_rate_correction = _getControlError(seb_rate) * param.pitch_damping_gain + seb_rate.setpoint;
|
||||
|
||||
// Convert the balance rate correction to a climb angle and add the level-flight pitch, the angle of attack at
|
||||
// zero climb angle, to get the absolute pitch setpoint. This calculation assumes:
|
||||
|
||||
@@ -240,7 +240,6 @@ public:
|
||||
|
||||
// Energy control param
|
||||
float ste_rate_time_const; ///< Filter time constant for specific total energy rate (damping path) [s].
|
||||
float seb_rate_ff; ///< Specific energy balance rate feedforward gain.
|
||||
|
||||
// Pitch control param
|
||||
float pitch_speed_weight; ///< Speed control weighting used by pitch demand calculation.
|
||||
@@ -750,8 +749,6 @@ public:
|
||||
|
||||
void set_ste_rate_time_const(float time_const) { _control_param.ste_rate_time_const = time_const; }
|
||||
|
||||
void set_seb_rate_ff_gain(float ff_gain) { _control_param.seb_rate_ff = ff_gain; }
|
||||
|
||||
/**
|
||||
* Set the pitch angle in level flight at trim airspeed [rad], fed forward as the pitch at zero climb angle
|
||||
*/
|
||||
@@ -868,7 +865,6 @@ private:
|
||||
.altitude_setpoint_gain_ff = 0.0f,
|
||||
.airspeed_error_gain = 0.1f,
|
||||
.ste_rate_time_const = 0.1f,
|
||||
.seb_rate_ff = 1.0f,
|
||||
.pitch_speed_weight = 1.0f,
|
||||
.integrator_gain_pitch = 0.0f,
|
||||
.pitch_damping_gain = 0.0f,
|
||||
|
||||
@@ -98,7 +98,6 @@ constexpr TECSControl::Param defaultParams()
|
||||
.altitude_setpoint_gain_ff = paramDefault(px4::params::FW_T_HRATE_FF),
|
||||
.airspeed_error_gain = 1.f / paramDefault(px4::params::FW_T_TAS_TC),
|
||||
.ste_rate_time_const = paramDefault(px4::params::FW_T_STE_R_TC),
|
||||
.seb_rate_ff = paramDefault(px4::params::FW_T_SEB_R_FF),
|
||||
.pitch_speed_weight = paramDefault(px4::params::FW_T_SPDWEIGHT),
|
||||
.integrator_gain_pitch = paramDefault(px4::params::FW_T_I_GAIN_PIT),
|
||||
|
||||
@@ -600,32 +599,3 @@ TEST_F(TECSControlClosedLoopTest, AirspeedlessSteadyStateCruise)
|
||||
EXPECT_LT(_sim_stats.max_throttle_integ_norm, MAX_NUMERICAL_ERR);
|
||||
EXPECT_LT(_sim_stats.max_pitch_integ_norm, MAX_NUMERICAL_ERR);
|
||||
}
|
||||
|
||||
// Without airspeed the speed weight is 0, so the SEB rate is twice the SPE rate and the pitch feedforward
|
||||
// SEB_rate_sp / (V * g) asks for twice the demanded climb angle. A feedforward gain of 0.5 cancels this: the vehicle
|
||||
// then flies exactly the demanded climb rate, the SEB rate error stays zero, and the altitude error decays first order
|
||||
// with FW_T_ALT_TC. As in AltitudeStepDown, the pitch must follow the raw step as fast as the throttle and the demanded
|
||||
// sink rate must not exceed FW_T_SINK_MIN.
|
||||
|
||||
TEST_F(TECSControlClosedLoopTest, AirspeedlessAltitudeStepHalfFeedforward)
|
||||
{
|
||||
disableAirspeed();
|
||||
_params.seb_rate_ff = 0.5f;
|
||||
|
||||
run(10.f);
|
||||
|
||||
for (const float step : {-ALT_STEP, ALT_STEP}) {
|
||||
setAltitudeSetpoint(_state.h + step);
|
||||
const float t_step = _t;
|
||||
|
||||
for (int i = 0; i < 30; i++) {
|
||||
run(1.f);
|
||||
const float expected_error = step * expf(-(_t - t_step) * _params.altitude_error_gain);
|
||||
EXPECT_NEAR(_alt_sp - _state.h, expected_error, MAX_NUMERICAL_ERR_OPENLOOP) << "at t=" << _t << " s";
|
||||
}
|
||||
}
|
||||
|
||||
// The throttle feedforward funds the climb exactly, so the open loop airspeed does not move
|
||||
EXPECT_LT(_sim_stats.max_airspeed_error, MAX_NUMERICAL_ERR_OPENLOOP) << "peak at t=" << _sim_stats.t_max_airspeed_error << " s";
|
||||
EXPECT_LT(_sim_stats.max_pitch_integ_norm, MAX_NUMERICAL_ERR_OPENLOOP);
|
||||
}
|
||||
@@ -65,7 +65,6 @@ TECSControl::Param makeParam()
|
||||
param.altitude_setpoint_gain_ff = 0.f;
|
||||
param.airspeed_error_gain = 0.1f;
|
||||
param.ste_rate_time_const = 0.1f;
|
||||
param.seb_rate_ff = 1.f;
|
||||
param.pitch_speed_weight = 1.f;
|
||||
param.integrator_gain_pitch = 0.4f;
|
||||
param.pitch_damping_gain = 0.1f;
|
||||
|
||||
@@ -123,7 +123,6 @@ FwLateralLongitudinalControl::parameters_update()
|
||||
_tecs.set_altitude_rate_ff(_param_fw_t_hrate_ff.get());
|
||||
_tecs.set_airspeed_error_time_constant(_param_fw_t_tas_tc.get());
|
||||
_tecs.set_ste_rate_time_const(_param_fw_t_ste_r_tc.get());
|
||||
_tecs.set_seb_rate_ff_gain(_param_fw_t_seb_r_ff.get());
|
||||
_tecs.set_level_flight_pitch(radians(_param_fw_psp_off.get()));
|
||||
|
||||
_roll_slew_rate.setSlewRate(radians(_param_fw_pn_r_slew_max.get()));
|
||||
|
||||
@@ -162,7 +162,6 @@ private:
|
||||
(ParamFloat<px4::params::FW_T_THR_DAMPING>) _param_fw_t_thr_damping,
|
||||
(ParamFloat<px4::params::FW_T_VERT_ACC>) _param_fw_t_vert_acc,
|
||||
(ParamFloat<px4::params::FW_T_STE_R_TC>) _param_fw_t_ste_r_tc,
|
||||
(ParamFloat<px4::params::FW_T_SEB_R_FF>) _param_fw_t_seb_r_ff,
|
||||
(ParamFloat<px4::params::FW_T_SPDWEIGHT>) _param_fw_t_spdweight,
|
||||
(ParamFloat<px4::params::FW_T_CLMB_R_SP>) _param_fw_t_clmb_r_sp,
|
||||
(ParamFloat<px4::params::FW_T_SINK_R_SP>) _param_fw_t_sink_r_sp,
|
||||
|
||||
@@ -176,15 +176,6 @@ parameters:
|
||||
max: 2
|
||||
decimal: 2
|
||||
increment: 0.01
|
||||
FW_T_SEB_R_FF:
|
||||
description:
|
||||
short: Specific total energy balance rate feedforward gain
|
||||
type: float
|
||||
default: 1.0
|
||||
min: 0.5
|
||||
max: 3
|
||||
decimal: 2
|
||||
increment: 0.01
|
||||
FW_WIND_ARSP_SC:
|
||||
description:
|
||||
short: Wind-based airspeed scaling factor
|
||||
|
||||
Reference in new issue
Block a user