forked from Archive/PX4-Autopilot
TECS: fix airspeed filter init in airspeed-less mode
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
parent
60e2c6a5cb
commit
9db86f7f0a
|
@ -52,10 +52,17 @@ using namespace time_literals;
|
||||||
|
|
||||||
static inline constexpr bool TIMESTAMP_VALID(float dt) { return (PX4_ISFINITE(dt) && dt > FLT_EPSILON);}
|
static inline constexpr bool TIMESTAMP_VALID(float dt) { return (PX4_ISFINITE(dt) && dt > FLT_EPSILON);}
|
||||||
|
|
||||||
void TECSAirspeedFilter::initialize(const float equivalent_airspeed)
|
void TECSAirspeedFilter::initialize(const float equivalent_airspeed, const float equivalent_airspeed_trim,
|
||||||
|
const bool airspeed_sensor_available)
|
||||||
{
|
{
|
||||||
_airspeed_state.speed = equivalent_airspeed;
|
if (airspeed_sensor_available && PX4_ISFINITE(equivalent_airspeed)) {
|
||||||
_airspeed_state.speed_rate = 0.0f;
|
_airspeed_state.speed = equivalent_airspeed;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_airspeed_state.speed = equivalent_airspeed_trim;
|
||||||
|
}
|
||||||
|
|
||||||
|
_airspeed_state.speed_rate = 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TECSAirspeedFilter::update(const float dt, const Input &input, const Param ¶m,
|
void TECSAirspeedFilter::update(const float dt, const Input &input, const Param ¶m,
|
||||||
|
@ -651,7 +658,8 @@ void TECS::initialize(const float altitude, const float altitude_rate, const flo
|
||||||
TECSAltitudeReferenceModel::AltitudeReferenceState current_state{.alt = altitude,
|
TECSAltitudeReferenceModel::AltitudeReferenceState current_state{.alt = altitude,
|
||||||
.alt_rate = altitude_rate};
|
.alt_rate = altitude_rate};
|
||||||
_altitude_reference_model.initialize(current_state);
|
_altitude_reference_model.initialize(current_state);
|
||||||
_airspeed_filter.initialize(equivalent_airspeed);
|
_airspeed_filter.initialize(equivalent_airspeed, _airspeed_filter_param.equivalent_airspeed_trim,
|
||||||
|
_control_flag.airspeed_enabled);
|
||||||
|
|
||||||
TECSControl::Setpoint control_setpoint;
|
TECSControl::Setpoint control_setpoint;
|
||||||
control_setpoint.altitude_reference = _altitude_reference_model.getAltitudeReference();
|
control_setpoint.altitude_reference = _altitude_reference_model.getAltitudeReference();
|
||||||
|
|
Loading…
Reference in New Issue