mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 14:43:33 +08:00
add cs_baro_fault to switch to fallback baro if available (#24260)
This commit is contained in:
@@ -141,6 +141,9 @@ void VehicleAirData::Run()
|
||||
|
||||
AirTemperatureUpdate();
|
||||
|
||||
estimator_status_flags_s estimator_status_flags;
|
||||
const bool estimator_status_flags_updated = _estimator_status_flags_sub.update(&estimator_status_flags);
|
||||
|
||||
bool updated[MAX_SENSOR_COUNT] {};
|
||||
|
||||
for (int uorb_index = 0; uorb_index < MAX_SENSOR_COUNT; uorb_index++) {
|
||||
@@ -196,6 +199,11 @@ void VehicleAirData::Run()
|
||||
ParametersUpdate(true);
|
||||
}
|
||||
|
||||
if (estimator_status_flags_updated && _selected_sensor_sub_index >= 0 && _selected_sensor_sub_index == uorb_index
|
||||
&& estimator_status_flags.cs_baro_fault) {
|
||||
_priority[uorb_index] = 1; // 1 is min priority while still being enabled
|
||||
}
|
||||
|
||||
// pressure corrected with offset (if available)
|
||||
_calibration[uorb_index].SensorCorrectionsUpdate();
|
||||
const float pressure_corrected = _calibration[uorb_index].Correct(report.pressure);
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include <uORB/topics/sensor_baro.h>
|
||||
#include <uORB/topics/sensors_status.h>
|
||||
#include <uORB/topics/vehicle_air_data.h>
|
||||
#include <uORB/topics/estimator_status_flags.h>
|
||||
|
||||
using namespace time_literals;
|
||||
|
||||
@@ -89,6 +90,8 @@ private:
|
||||
|
||||
uORB::Subscription _differential_pressure_sub{ORB_ID(differential_pressure)};
|
||||
|
||||
uORB::Subscription _estimator_status_flags_sub{ORB_ID(estimator_status_flags)};
|
||||
|
||||
uORB::SubscriptionCallbackWorkItem _sensor_sub[MAX_SENSOR_COUNT] {
|
||||
{this, ORB_ID(sensor_baro), 0},
|
||||
{this, ORB_ID(sensor_baro), 1},
|
||||
|
||||
Reference in New Issue
Block a user