mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 07:51:36 +08:00
control state: indicate if airspeed is not valid
This commit is contained in:
@@ -896,7 +896,14 @@ void AttitudePositionEstimatorEKF::publishControlState()
|
||||
//_ctrl_state.airspeed = sqrt(pow(_ekf->states[4] - _ekf->states[14], 2) + pow(_ekf->states[5] - _ekf->states[15], 2) + pow(_ekf->states[6], 2));
|
||||
// the line above was introduced by the control state PR. The airspeed it gives is totally wrong and leads to horrible flight performance in SITL
|
||||
// and in outdoor tests
|
||||
_ctrl_state.airspeed = _airspeed.true_airspeed_m_s;
|
||||
if (PX4_ISFINITE(_airspeed.indicated_airspeed_m_s) && hrt_absolute_time() - _airspeed.timestamp < 1e6
|
||||
&& _airspeed.timestamp > 0) {
|
||||
_ctrl_state.airspeed = _airspeed.indicated_airspeed_m_s;
|
||||
_ctrl_state.airspeed_valid = true;
|
||||
|
||||
} else {
|
||||
_ctrl_state.airspeed_valid = false;
|
||||
}
|
||||
/* Attitude Rates */
|
||||
_ctrl_state.roll_rate = _LP_att_P.apply(_ekf->dAngIMU.x / _ekf->dtIMU) - _ekf->states[10] / _ekf->dtIMUfilt;
|
||||
_ctrl_state.pitch_rate = _LP_att_Q.apply(_ekf->dAngIMU.y / _ekf->dtIMU) - _ekf->states[11] / _ekf->dtIMUfilt;
|
||||
|
||||
Reference in New Issue
Block a user