AP_RangeFinder: TeraRanger a to close reading is not the minimum distance #13376
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a bit of a drive by change, but as far as I can tell using the minimum distance here is unsafe. The problem with copying the minimum distance in, is that if we are to close to get a reading we could be any distance less then the minimum distance. However the logic for determing if a rangefinder is good or not only considers the driver to be out of range low, if the distance is less then the minimum distance. Logic can be seen here.
This could be combined with the following case, I kept them separate just to ensure that the meanings are preserved, and to make it easier to directly flag something like OutOfRangeLow in the future.
I don't actually have one of these units, so I can't test (or even verify) if this is a real problem (and solution). Does anyone have the hardware to actually do the test?