Skip to content

Commit

Permalink
TECS:use tas_setpoint instead of measured tas for specific kinetic en…
Browse files Browse the repository at this point in the history
…ergy calculation
  • Loading branch information
KonradRudin committed May 7, 2024
1 parent f56f4c7 commit 6984e6d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/tecs/TECS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ void TECSControl::initialize(const Setpoint &setpoint, const Input &input, Param

AltitudePitchControl control_setpoint;

control_setpoint.tas_setpoint = setpoint.tas_setpoint;

control_setpoint.tas_rate_setpoint = _calcAirspeedControlOutput(setpoint, input, param, flag);

control_setpoint.altitude_rate_setpoint = _calcAltitudeControlOutput(setpoint, input, param);
Expand Down Expand Up @@ -274,6 +276,7 @@ void TECSControl::update(const float dt, const Setpoint &setpoint, const Input &

AltitudePitchControl control_setpoint;

control_setpoint.tas_setpoint = setpoint.tas_setpoint;
control_setpoint.tas_rate_setpoint = _calcAirspeedControlOutput(setpoint, input, param, flag);

if (PX4_ISFINITE(setpoint.altitude_rate_setpoint_direct)) {
Expand Down Expand Up @@ -350,7 +353,7 @@ TECSControl::SpecificEnergyRates TECSControl::_calcSpecificEnergyRates(const Alt
// Calculate specific energy rate demands in units of (m**2/sec**3)
specific_energy_rates.spe_rate.setpoint = control_setpoint.altitude_rate_setpoint *
CONSTANTS_ONE_G; // potential energy rate of change
specific_energy_rates.ske_rate.setpoint = input.tas *
specific_energy_rates.ske_rate.setpoint = control_setpoint.tas_setpoint *
control_setpoint.tas_rate_setpoint; // kinetic energy rate of change

// Calculate specific energy rates in units of (m**2/sec**3)
Expand Down
1 change: 1 addition & 0 deletions src/lib/tecs/TECS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ class TECSControl
struct AltitudePitchControl {
float altitude_rate_setpoint; ///< Controlled altitude rate setpoint [m/s].
float tas_rate_setpoint; ///< Controlled true airspeed rate setpoint [m/s²].
float tas_setpoint; ///< Controller true airspeed setpoint [m/s]
};

/**
Expand Down

0 comments on commit 6984e6d

Please sign in to comment.