mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
pmw3901: set quality to zero if flow below threshold
This commit is contained in:
committed by
Lorenz Meier
parent
a4a9b02ff1
commit
f72e9e4385
@@ -57,6 +57,7 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
#include <float.h>
|
||||
|
||||
#include <conversion/rotation.h>
|
||||
|
||||
@@ -601,7 +602,15 @@ PMW3901::collect()
|
||||
report.integration_timespan = _flow_dt_sum_usec; //microseconds
|
||||
|
||||
report.sensor_id = 0;
|
||||
report.quality = 255;
|
||||
|
||||
// This sensor doesn't provide any quality metric. However if the sensor is unable to calculate the optical flow it will
|
||||
// output 0 for the delta. Hence, we set the measurement to "invalid" (quality = 0) if the values are smaller than FLT_EPSILON
|
||||
if (fabsf(report.pixel_flow_x_integral) < FLT_EPSILON && fabsf(report.pixel_flow_y_integral) < FLT_EPSILON) {
|
||||
report.quality = 0;
|
||||
|
||||
} else {
|
||||
report.quality = 255;
|
||||
}
|
||||
|
||||
/* No gyro on this board */
|
||||
report.gyro_x_rate_integral = NAN;
|
||||
|
||||
Reference in New Issue
Block a user