mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 03:53:35 +08:00
px4flow : publish sensor limits over uORB
This commit is contained in:
committed by
Lorenz Meier
parent
230d6c5aa2
commit
32a7097018
@@ -143,7 +143,11 @@ private:
|
|||||||
perf_counter_t _comms_errors;
|
perf_counter_t _comms_errors;
|
||||||
|
|
||||||
unsigned _conversion_interval;
|
unsigned _conversion_interval;
|
||||||
|
|
||||||
enum Rotation _sensor_rotation;
|
enum Rotation _sensor_rotation;
|
||||||
|
float _sensor_min_range;
|
||||||
|
float _sensor_max_range;
|
||||||
|
float _sensor_max_flow_rate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether the device supported by the driver is present at a
|
* Test whether the device supported by the driver is present at a
|
||||||
@@ -267,7 +271,6 @@ PX4FLOW::init()
|
|||||||
/* get yaw rotation from sensor frame to body frame */
|
/* get yaw rotation from sensor frame to body frame */
|
||||||
param_t rot = param_find("SENS_FLOW_ROT");
|
param_t rot = param_find("SENS_FLOW_ROT");
|
||||||
|
|
||||||
/* only set it if the parameter exists */
|
|
||||||
if (rot != PARAM_INVALID) {
|
if (rot != PARAM_INVALID) {
|
||||||
int32_t val = 6; // the recommended installation for the flow sensor is with the Y sensor axis forward
|
int32_t val = 6; // the recommended installation for the flow sensor is with the Y sensor axis forward
|
||||||
param_get(rot, &val);
|
param_get(rot, &val);
|
||||||
@@ -275,6 +278,34 @@ PX4FLOW::init()
|
|||||||
_sensor_rotation = (enum Rotation)val;
|
_sensor_rotation = (enum Rotation)val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* get operational limits of the sensor */
|
||||||
|
param_t hmin = param_find("SENS_FLOW_MINHGT");
|
||||||
|
|
||||||
|
if (hmin != PARAM_INVALID) {
|
||||||
|
float val = 0.7;
|
||||||
|
param_get(hmin, &val);
|
||||||
|
|
||||||
|
_sensor_min_range = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
param_t hmax = param_find("SENS_FLOW_MAXHGT");
|
||||||
|
|
||||||
|
if (hmax != PARAM_INVALID) {
|
||||||
|
float val = 3.0;
|
||||||
|
param_get(hmax, &val);
|
||||||
|
|
||||||
|
_sensor_max_range = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
param_t ratemax = param_find("SENS_FLOW_MAXR");
|
||||||
|
|
||||||
|
if (ratemax != PARAM_INVALID) {
|
||||||
|
float val = 2.5;
|
||||||
|
param_get(ratemax, &val);
|
||||||
|
|
||||||
|
_sensor_max_flow_rate = val;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -536,6 +567,12 @@ PX4FLOW::collect()
|
|||||||
|
|
||||||
report.sensor_id = 0;
|
report.sensor_id = 0;
|
||||||
|
|
||||||
|
report.max_flow_rate = _sensor_max_flow_rate;
|
||||||
|
|
||||||
|
report.min_ground_distance = _sensor_min_range;
|
||||||
|
|
||||||
|
report.max_ground_distance = _sensor_max_range;
|
||||||
|
|
||||||
/* rotate measurements in yaw from sensor frame to body frame according to parameter SENS_FLOW_ROT */
|
/* rotate measurements in yaw from sensor frame to body frame according to parameter SENS_FLOW_ROT */
|
||||||
float zeroval = 0.0f;
|
float zeroval = 0.0f;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user