File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ void AP_Proximity_LD06::parse_response_data()
170
170
171
171
// Gets the distance recorded and converts to meters
172
172
const float angle_deg = correct_angle_for_orientation (start_angle + angle_step * (i / MEASUREMENT_PAYLOAD_LENGTH));
173
- const float distance_m = UINT16_VALUE (_response[i + 1 ], _response[i]) * 0.001 ;
173
+ const float distance_m = _dist_filt_mm. apply ( UINT16_VALUE (_response[i + 1 ], _response[i]) ) * 0.001 ;
174
174
const float confidence = _response[i + 2 ];
175
175
176
176
// ignore distance that are out-of-range or have low confidence
Original file line number Diff line number Diff line change 29
29
#if AP_PROXIMITY_LD06_ENABLED
30
30
31
31
#include " AP_Proximity_Backend_Serial.h"
32
+ #include < Filter/ModeFilter.h>
32
33
33
34
#define MESSAGE_LENGTH_LD06 47
34
35
@@ -62,6 +63,9 @@ class AP_Proximity_LD06 : public AP_Proximity_Backend_Serial
62
63
// Store for error-tracking purposes
63
64
uint32_t _last_distance_received_ms;
64
65
66
+ // distance filter applies to raw measurements
67
+ ModeFilterUInt16_Size3 _dist_filt_mm {1 };
68
+
65
69
// face related variables
66
70
AP_Proximity_Boundary_3D::Face _last_face;// /< last face requested
67
71
float _last_angle_deg; // /< yaw angle (in degrees) of _last_distance_m
You can’t perform that action at this time.
0 commit comments