mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 05:03:34 +08:00
Update SDP3x Airspeed Correction (#8242)
Update the model for the standard configuration based on the model from Sensirion and add also an option to do the tube pressure loss correction from Sensirion for other configurations.
This commit is contained in:
committed by
Daniel Agar
parent
85a7a0a86a
commit
a5cc4bcd08
@@ -157,8 +157,9 @@ int initialize_parameter_handles(ParameterHandles ¶meter_handles)
|
||||
|
||||
parameter_handles.vibe_thresh = param_find("ATT_VIBE_THRESH");
|
||||
|
||||
parameter_handles.air_pmodel = param_find("CAL_AIR_PMODEL");
|
||||
parameter_handles.air_cmodel = param_find("CAL_AIR_CMODEL");
|
||||
parameter_handles.air_tube_length = param_find("CAL_AIR_TUBELEN");
|
||||
parameter_handles.air_tube_diameter_mm = param_find("CAL_AIR_TUBED_MM");
|
||||
|
||||
// These are parameters for which QGroundControl always expects to be returned in a list request.
|
||||
// We do a param_find here to force them into the list.
|
||||
@@ -491,8 +492,9 @@ int update_parameters(const ParameterHandles ¶meter_handles, Parameters &par
|
||||
|
||||
param_get(parameter_handles.vibe_thresh, ¶meters.vibration_warning_threshold);
|
||||
|
||||
param_get(parameter_handles.air_pmodel, ¶meters.air_pmodel);
|
||||
param_get(parameter_handles.air_cmodel, ¶meters.air_cmodel);
|
||||
param_get(parameter_handles.air_tube_length, ¶meters.air_tube_length);
|
||||
param_get(parameter_handles.air_tube_diameter_mm, ¶meters.air_tube_diameter_mm);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -146,9 +146,9 @@ struct Parameters {
|
||||
|
||||
float vibration_warning_threshold;
|
||||
|
||||
int32_t air_pmodel;
|
||||
int32_t air_cmodel;
|
||||
float air_tube_length;
|
||||
|
||||
float air_tube_diameter_mm;
|
||||
};
|
||||
|
||||
struct ParameterHandles {
|
||||
@@ -230,8 +230,9 @@ struct ParameterHandles {
|
||||
|
||||
param_t vibe_thresh; /**< vibration threshold */
|
||||
|
||||
param_t air_pmodel;
|
||||
param_t air_cmodel;
|
||||
param_t air_tube_length;
|
||||
param_t air_tube_diameter_mm;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -39,24 +39,49 @@
|
||||
PARAM_DEFINE_INT32(CAL_BARO_PRIME, 0);
|
||||
|
||||
/**
|
||||
* Airspeed sensor pitot model
|
||||
* Airspeed sensor compensation model for the SDP3x
|
||||
*
|
||||
* @value 0 HB Pitot
|
||||
* Model with Pitot
|
||||
* CAL_AIR_TUBED_MM: Not used, 1.5 mm tubes assumed.
|
||||
* CAL_AIR_TUBELEN: Length of the tubes connecting the pitot to the sensor.
|
||||
* Model without Pitot (1.5 mm tubes)
|
||||
* CAL_AIR_TUBED_MM: Not used, 1.5 mm tubes assumed.
|
||||
* CAL_AIR_TUBELEN: Length of the tubes connecting the pitot to the sensor.
|
||||
* Tube Pressure Drop
|
||||
* CAL_AIR_TUBED_MM: Diameter in mm of the pitot and tubes, must have the same diameter.
|
||||
* CAL_AIR_TUBELEN: Length of the tubes connecting the pitot to the sensor and the static + dynamic port length of the pitot.
|
||||
*
|
||||
* @value 0 Model with Pitot
|
||||
* @value 1 Model without Pitot (1.5 mm tubes)
|
||||
* @value 2 Tube Pressure Drop
|
||||
* @group Sensor Calibration
|
||||
*/
|
||||
PARAM_DEFINE_INT32(CAL_AIR_PMODEL, 0);
|
||||
PARAM_DEFINE_INT32(CAL_AIR_CMODEL, 0);
|
||||
|
||||
/**
|
||||
* Airspeed sensor tube length
|
||||
* Airspeed sensor tube length.
|
||||
*
|
||||
* See the CAL_AIR_CMODEL explanation on how this parameter should be set.
|
||||
*
|
||||
* @min 0.01
|
||||
* @max 0.5
|
||||
* @max 2.00
|
||||
* @unit meter
|
||||
*
|
||||
* @group Sensor Calibration
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(CAL_AIR_TUBELEN, 0.2f);
|
||||
|
||||
/**
|
||||
* Airspeed sensor tube diameter. Only used for the Tube Pressure Drop Compensation.
|
||||
*
|
||||
* @min 0.1
|
||||
* @max 100
|
||||
* @unit millimeter
|
||||
*
|
||||
* @group Sensor Calibration
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(CAL_AIR_TUBED_MM, 1.5f);
|
||||
|
||||
/**
|
||||
* Differential pressure sensor offset
|
||||
*
|
||||
|
||||
@@ -345,8 +345,8 @@ Sensors::diff_pres_poll(struct sensor_combined_s &raw)
|
||||
|
||||
/* don't risk to feed negative airspeed into the system */
|
||||
_airspeed.indicated_airspeed_m_s = math::max(0.0f,
|
||||
calc_indicated_airspeed_corrected((enum AIRSPEED_PITOT_MODEL)_parameters.air_pmodel,
|
||||
smodel, _parameters.air_tube_length,
|
||||
calc_indicated_airspeed_corrected((enum AIRSPEED_COMPENSATION_MODEL)_parameters.air_cmodel,
|
||||
smodel, _parameters.air_tube_length, _parameters.air_tube_diameter_mm,
|
||||
_diff_pres.differential_pressure_filtered_pa, _voted_sensors_update.baro_pressure(),
|
||||
air_temperature_celsius));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user