42 #include <mathlib/mathlib.h> 78 float altitude,
bool vz_valid,
float vz,
float az);
84 float EAS_setpoint,
float indicated_airspeed,
float eas_to_tas,
bool climb_out_setpoint,
float pitch_min_climbout,
85 float throttle_min,
float throttle_setpoint_max,
float throttle_cruise,
86 float pitch_limit_min,
float pitch_limit_max);
323 void _initialize_states(
float pitch,
float throttle_cruise,
float baro_altitude,
float pitch_min_climbout,
ECL_TECS_MODE tecs_mode()
float _TAS_min
true airpeed demand lower limit (m/sec)
float _pitch_setpoint_unc
pitch demand before limiting (rad)
float _SPE_rate
specific potential energy rate estimate (m**2/sec**3)
float _integrator_gain
integrator gain used by the throttle and pitch demand calculation
void set_min_sink_rate(float rate)
float _hgt_rate_setpoint
demanded climb rate tracked by the TECS algorithm
float _vert_vel_state
complimentary filter state - height rate (m/sec)
float _SPE_setpoint
specific potential energy demand (m**2/sec**2)
void set_heightrate_ff(float heightrate_ff)
float _hgt_setpoint
demanded height tracked by the TECS algorithm (m)
void set_speed_weight(float weight)
float _height_error_gain
gain from height error to demanded climb rate (1/sec)
float _pitch_setpoint_max
pitch demand upper limit (rad)
float _hgt_setpoint_prev
previous value of _hgt_setpoint after noise filtering and rate limiting (m)
bool _uncommanded_descent_recovery
true when a continuous descent caused by an unachievable airspeed demand has been detected ...
float _vert_accel_limit
magnitude of the maximum vertical acceleration allowed (m/sec**2)
float _tas_rate_state
complimentary filter state - true airspeed first derivative (m/sec**2)
void _update_speed_states(float airspeed_setpoint, float indicated_airspeed, float eas_to_tas)
Update the airspeed internal state using a second order complementary filter.
void set_max_climb_rate(float climb_rate)
float _throttle_slewrate
throttle demand slew rate limit (1/sec)
void _detect_underspeed()
Detect if the system is not capable of maintaining airspeed.
float _min_sink_rate
sink rate produced by min allowed throttle (m/sec)
void set_height_comp_filter_omega(float omega)
void set_max_sink_rate(float sink_rate)
float _throttle_integ_state
throttle integrator state
uint64_t _pitch_update_timestamp
last timestamp of the pitch function call
bool _climbout_mode_active
true when in climbout mode
float _STE_rate_min
specific total energy rate lower limit acheived when throttle is at _throttle_setpoint_min (m**2/sec*...
void _update_throttle_setpoint(float throttle_cruise, const matrix::Dcmf &rotMat)
Update throttle setpoint.
float _SKE_estimate
specific kinetic energy estimate (m**2/sec**2)
float _throttle_setpoint_min
normalised throttle lower limit
float _speed_derivative
rate of change of speed along X axis (m/sec**2)
float _pitch_integ_state
pitch integrator state (rad)
void enable_airspeed(bool enabled)
Set the airspeed enable state.
float _STE_rate_error
specific total energy rate error (m**2/sec**3)
void set_time_const(float time_const)
float _pitch_damping_gain
damping gain of the pitch demand calculation (sec)
float get_pitch_setpoint()
float _tas_state
complimentary filter state - true airspeed (m/sec)
void set_indicated_airspeed_min(float airspeed)
float _pitch_time_constant
control time constant used by the pitch demand calculation (sec)
float pitch_integ_state()
float _SKE_setpoint
specific kinetic energy demand (m**2/sec**2)
float TAS_rate_setpoint()
float _indicated_airspeed_min
equivalent airspeed demand lower limit (m/sec)
float _throttle_damping_gain
damping gain of the throttle demand calculation (sec)
bool _airspeed_enabled
true when airspeed use has been enabled
void _update_pitch_setpoint()
Update the pitch setpoint.
float _TAS_max
true airpeed demand upper limit (m/sec)
float _pitch_speed_weight
speed control weighting used by pitch demand calculation
float _TAS_setpoint_last
previous true airpeed demand (m/sec)
float _last_throttle_setpoint
throttle demand rate limiter state (1/sec)
float _SKE_rate
specific kinetic energy rate estimate (m**2/sec**3)
uint64_t _state_update_timestamp
last timestamp of the 50 Hz function call
void set_integrator_gain(float gain)
float _STE_error
specific total energy error (m**2/sec**2)
float _max_sink_rate
maximum safe sink rate (m/sec)
float _SEB_error
specific energy balance error (m**2/sec**2)
float _throttle_setpoint_max
normalised throttle upper limit
float _load_factor_correction
gain from normal load factor increase to total energy rate demand (m**2/sec**3)
float _hgt_setpoint_in_prev
previous value of _hgt_setpoint after noise filtering (m)
bool airspeed_sensor_enabled()
Get the current airspeed status.
float _last_pitch_setpoint
pitch demand rate limiter state (rad/sec)
float _pitch_setpoint_min
pitch demand lower limit (rad)
void _initialize_states(float pitch, float throttle_cruise, float baro_altitude, float pitch_min_climbout, float eas_to_tas)
Initialize the controller.
float _TAS_setpoint
current airpeed demand (m/sec)
float _EAS
equivalent airspeed (m/sec)
void set_speedrate_p(float speedrate_p)
bool _detect_underspeed_enabled
true when underspeed detection is enabled
float _dt
Time since last update of main TECS loop (sec)
float _SPE_estimate
specific potential energy estimate (m**2/sec**2)
void set_throttle_damp(float throttle_damp)
bool _in_air
true when the vehicle is flying
float _hgt_setpoint_adj
demanded height used by the control loops after all filtering has been applied (m) ...
float _SEB_rate_error
specific energy balance rate error (m**2/sec**3)
float _height_setpoint_gain_ff
gain from height demand derivative to demanded climb rate
float _pitch_setpoint
pitch angle demand (radians)
void handle_alt_step(float delta_alt, float altitude)
Handle the altitude reset.
float _TAS_rate_setpoint
true airspeed rate demand tracked by the TECS algorithm (m/sec**2)
float hgt_rate_setpoint()
void set_indicated_airspeed_max(float airspeed)
float _vert_accel_state
complimentary filter state - height second derivative (m/sec**2)
void set_roll_throttle_compensation(float compensation)
bool _states_initalized
true when TECS states have been iniitalized
float throttle_integ_state()
bool _underspeed_detected
true when an underspeed condition has been detected
float _SPE_rate_setpoint
specific potential energy rate demand (m**2/sec**3)
void set_pitch_damping(float damping)
float _EAS_setpoint
Equivalent airspeed demand (m/sec)
void update_pitch_throttle(const matrix::Dcmf &rotMat, float pitch, float baro_altitude, float hgt_setpoint, float EAS_setpoint, float indicated_airspeed, float eas_to_tas, bool climb_out_setpoint, float pitch_min_climbout, float throttle_min, float throttle_setpoint_max, float throttle_cruise, float pitch_limit_min, float pitch_limit_max)
Update the control loop calculations.
float _STE_rate_max
specific total energy rate upper limit achieved when throttle is at _throttle_setpoint_max (m**2/sec*...
float _hgt_setpoint_adj_prev
value of _hgt_setpoint_adj from previous frame (m)
void _detect_uncommanded_descent()
Detect an uncommanded descent.
void _update_STE_rate_lim()
Calculate specific total energy rate limits.
float _throttle_setpoint
normalized throttle demand (0..1)
void set_detect_underspeed_enabled(bool enabled)
float _max_climb_rate
climb rate produced by max allowed throttle (m/sec)
void update_vehicle_state_estimates(float airspeed, const matrix::Dcmf &rotMat, const matrix::Vector3f &accel_body, bool altitude_lock, bool in_air, float altitude, bool vz_valid, float vz, float az)
Updates the following vehicle kineamtic state estimates: Vertical position, velocity and acceleration...
void set_time_const_throt(float time_const_throt)
float _SKE_rate_setpoint
specific kinetic energy rate demand (m**2/sec**3)
float get_throttle_setpoint(void)
void _update_height_setpoint(float desired, float state)
Update the desired height.
void set_vertical_accel_limit(float limit)
float _TAS_setpoint_adj
true airspeed demand tracked by the TECS algorithm (m/sec)
void _update_speed_setpoint()
Update the desired airspeed.
void set_heightrate_p(float heightrate_p)
float _hgt_estimate_freq
cross-over frequency of the height rate complementary filter (rad/sec)
float _throttle_time_constant
control time constant used by the throttle demand calculation (sec)
void _update_energy_estimates()
Update specific energy.
float _tas_estimate_freq
cross-over frequency of the true airspeed complementary filter (rad/sec)
float _speed_error_gain
gain from speed error to demanded speed rate (1/sec)
void set_speed_comp_filter_omega(float omega)
TECS & operator=(const TECS &)=delete
uint64_t _speed_update_timestamp
last timestamp of the speed function call
float _vert_pos_state
complimentary filter state - height (m)
void set_throttle_slewrate(float slewrate)
static constexpr float DT_DEFAULT
default value for _dt (sec)
float _indicated_airspeed_max
equivalent airspeed demand upper limit (m/sec)