diff --git a/src/lib/tecs/TECS.cpp b/src/lib/tecs/TECS.cpp index 866b9b9b543..7c25e1d17fe 100644 --- a/src/lib/tecs/TECS.cpp +++ b/src/lib/tecs/TECS.cpp @@ -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: diff --git a/src/lib/tecs/TECS.hpp b/src/lib/tecs/TECS.hpp index e811ddfa976..5107470a9c4 100644 --- a/src/lib/tecs/TECS.hpp +++ b/src/lib/tecs/TECS.hpp @@ -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, diff --git a/src/lib/tecs/TECSControlClosedLoopTest.cpp b/src/lib/tecs/TECSControlClosedLoopTest.cpp index de0cd98ef42..7857fb73624 100644 --- a/src/lib/tecs/TECSControlClosedLoopTest.cpp +++ b/src/lib/tecs/TECSControlClosedLoopTest.cpp @@ -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); -} diff --git a/src/lib/tecs/TECSTest.cpp b/src/lib/tecs/TECSTest.cpp index 4fad0aac577..f431bae484d 100644 --- a/src/lib/tecs/TECSTest.cpp +++ b/src/lib/tecs/TECSTest.cpp @@ -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; diff --git a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp index fed6374bd4f..9e8fab9b4e0 100644 --- a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp +++ b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp @@ -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())); diff --git a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.hpp b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.hpp index fcf3123aa75..de6b5a3a836 100644 --- a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.hpp +++ b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.hpp @@ -162,7 +162,6 @@ private: (ParamFloat) _param_fw_t_thr_damping, (ParamFloat) _param_fw_t_vert_acc, (ParamFloat) _param_fw_t_ste_r_tc, - (ParamFloat) _param_fw_t_seb_r_ff, (ParamFloat) _param_fw_t_spdweight, (ParamFloat) _param_fw_t_clmb_r_sp, (ParamFloat) _param_fw_t_sink_r_sp, diff --git a/src/modules/fw_lateral_longitudinal_control/fw_lat_long_params.yaml b/src/modules/fw_lateral_longitudinal_control/fw_lat_long_params.yaml index d24e0ee9063..878ea863466 100644 --- a/src/modules/fw_lateral_longitudinal_control/fw_lat_long_params.yaml +++ b/src/modules/fw_lateral_longitudinal_control/fw_lat_long_params.yaml @@ -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