Skip to content
Snippets Groups Projects
Commit 32a70970 authored by Mohammed Kabir's avatar Mohammed Kabir Committed by Lorenz Meier
Browse files

px4flow : publish sensor limits over uORB

parent 230d6c5a
No related branches found
No related tags found
No related merge requests found
......@@ -143,7 +143,11 @@ private:
perf_counter_t _comms_errors;
unsigned _conversion_interval;
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
......@@ -267,7 +271,6 @@ PX4FLOW::init()
/* get yaw rotation from sensor frame to body frame */
param_t rot = param_find("SENS_FLOW_ROT");
/* only set it if the parameter exists */
if (rot != PARAM_INVALID) {
int32_t val = 6; // the recommended installation for the flow sensor is with the Y sensor axis forward
param_get(rot, &val);
......@@ -275,6 +278,34 @@ PX4FLOW::init()
_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;
}
......@@ -536,6 +567,12 @@ PX4FLOW::collect()
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 */
float zeroval = 0.0f;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment