-
Notifications
You must be signed in to change notification settings - Fork 18.7k
AP_Proximity: LD06/LD19 gets mode filter #30107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AP_Proximity: LD06/LD19 gets mode filter #30107
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a mode filter for sensor readings to help reduce noise when operating outdoors while also addressing fixes related to distance reporting and minor comment improvements.
- Introduces a mode filter template specialization for uint16_t values.
- Updates the AP_Proximity LD06 header to include the mode filter and adds a new filter member variable.
- Modifies the distance processing logic in the LD06 source file to apply the filter and pushes corrected distance values to the database.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
libraries/Filter/ModeFilter.cpp | Added template instantiation for ModeFilter<uint16_t,3>. |
libraries/AP_Proximity/AP_Proximity_LD06.h | Added include and a new mode filter member; potential type mismatch. |
libraries/AP_Proximity/AP_Proximity_LD06.cpp | Updated distance processing to use the mode filter and improved the use of the confidence threshold. |
5ae87d3
to
33724b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a mode filter to reduce noise in sensor readings for the LD06 sensor while also addressing miscellaneous fixes related to distance reporting and code improvements.
- Added a new ModeFilter instantiation for uint16_t in the filter library.
- Updated AP_Proximity LD06 sensor processing to apply the mode filter and use confidence thresholds.
- Adjusted the values pushed to the OA database and refined comments and variable definitions.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
libraries/Filter/ModeFilter.cpp | Added a new template instantiation for uint16_t filtering. |
libraries/AP_Proximity/AP_Proximity_LD06.h | Included the mode filter header and introduced the filter object. |
libraries/AP_Proximity/AP_Proximity_LD06.cpp | Modified distance conversion to use the filter; added confidence threshold check; updated database_push call. |
Comments suppressed due to low confidence (1)
libraries/AP_Proximity/AP_Proximity_LD06.cpp:173
- [nitpick] Verify that applying the mode filter to the raw sensor value (in mm) before converting to meters meets the intended measurement accuracy.
const float distance_m = _dist_filt_mm.apply(UINT16_VALUE(_response[i + 1], _response[i])) * 0.001;
33724b4
to
1438aac
Compare
31a87f5
to
c33c754
Compare
add confidence threshold definition remove unused definitions
c33c754
to
fde25e3
Compare
I've fixed up the autotest and rebased on master. Personally I think this is ready to merge now |
This alternative to PR #30050 adds a mode filter to try and remove the noise from the sensor readings when used outdoors
This PR also includes these fixes:
This has not yet been tested on real hardware nor in the simulator
The relevant 4.6.0-beta discussion is here