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:
Florian Achermann
2017-11-22 22:03:26 -05:00
committed by Daniel Agar
parent 85a7a0a86a
commit a5cc4bcd08
8 changed files with 163 additions and 68 deletions
+4 -2
View File
@@ -157,8 +157,9 @@ int initialize_parameter_handles(ParameterHandles &parameter_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 &parameter_handles, Parameters &par
param_get(parameter_handles.vibe_thresh, &parameters.vibration_warning_threshold);
param_get(parameter_handles.air_pmodel, &parameters.air_pmodel);
param_get(parameter_handles.air_cmodel, &parameters.air_cmodel);
param_get(parameter_handles.air_tube_length, &parameters.air_tube_length);
param_get(parameter_handles.air_tube_diameter_mm, &parameters.air_tube_diameter_mm);
return ret;
}
+4 -3
View File
@@ -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;
};
+30 -5
View File
@@ -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
*
+2 -2
View File
@@ -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));