Skip to content

Commit

Permalink
flow: add scale factor parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
bresch authored and dagar committed Nov 13, 2024
1 parent d14c054 commit ea1a6a3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/modules/sensors/sensor_params_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,13 @@ PARAM_DEFINE_FLOAT(SENS_FLOW_MAXR, 8.f);
*
*/
PARAM_DEFINE_FLOAT(SENS_FLOW_RATE, 70.0f);

/**
* Optical flow scale factor
*
* @min 0.5
* @max 1.5
* @decimal 2
* @group Sensors
*/
PARAM_DEFINE_FLOAT(SENS_FLOW_SCALE, 1.f);
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ void VehicleOpticalFlow::Run()
vehicle_optical_flow.timestamp_sample = sensor_optical_flow.timestamp_sample;
vehicle_optical_flow.device_id = sensor_optical_flow.device_id;

_flow_integral *= _param_sens_flow_scale.get();
_flow_integral.copyTo(vehicle_optical_flow.pixel_flow);
_delta_angle.copyTo(vehicle_optical_flow.delta_angle);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ class VehicleOpticalFlow : public ModuleParams, public px4::ScheduledWorkItem
(ParamFloat<px4::params::SENS_FLOW_MINHGT>) _param_sens_flow_minhgt,
(ParamFloat<px4::params::SENS_FLOW_MAXHGT>) _param_sens_flow_maxhgt,
(ParamFloat<px4::params::SENS_FLOW_MAXR>) _param_sens_flow_maxr,
(ParamFloat<px4::params::SENS_FLOW_RATE>) _param_sens_flow_rate
(ParamFloat<px4::params::SENS_FLOW_RATE>) _param_sens_flow_rate,
(ParamFloat<px4::params::SENS_FLOW_SCALE>) _param_sens_flow_scale
)
};
}; // namespace sensors

0 comments on commit ea1a6a3

Please sign in to comment.