Skip to content
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

drivers: Accept entire distance sensor signal strength range #22365

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sverrevr
Copy link
Contributor

Solved Problem

The reason for this commit is that we had a flight where the distance sensor was in practice disabled for large parts of the flight as the signal strength being read from the sensor was lower than 70/255 which is today's threshold. Looking at the sensor data itself we see that there were a lot of measurements with good quality that should not have been discarded.

See for example this section here where all data is discarded for more than 20 seconds even thought the sensor data is perfect
image

To explore where the limit should be, we set the minimal signal strength to 0 so that the signal strength is directly mapped to distance_sensor/signal_quality

What we saw from our experiments were that we only had outlier measurements where the signal strength was 0. Any non zero values corresponded to a good measurement. See comments below for plots

Looking at the datasheet we have the following documentation: https://static.garmin.com/pumac/LIDAR-Lite_v3HP_Instructions_EN.pdf
image

So signal strength is already capped with a lower threshold calculated based on the noise floor. From this its not unreasonable that all non-zero measurements are likely good.

Furthermore, at least for the terrain estimator, its not a problem if outliers are not removed at this step, as there already is outlier detection there. Is this also the case if the distance sensor is used directly in the EKF?

Changelog Entry

For release notes:

Accept entire distance sensor signal strength
New parameter: None
Documentation:  

Test coverage

Flying again in the same location where the problem was first observed yielded good result where the distance sensor was used and no bad measurements were accepted.

Context

Related links, screenshot before/after, video

@sverrevr
Copy link
Contributor Author

Logs from mapping entire signal strength to 0-100 signal quality:
image
Note that most of the "spikes" here are actual things covering the sensor, such as the drone flying over a wall.

The only thing that looks like a measurement error is this which has signal strength 0
image

Note that the signal quality drops when entering and exiting an edge:
image
image
Some of these have non zero value, but the outliers are not very large.

Here is a region with low signal strength, but good data:
image

For our use-case it would be better to keep these small outliers when entering/exiting an edge, than loosing a lot of good data under normal flight.

@sverrevr sverrevr marked this pull request as ready for review November 14, 2023 12:46
@sverrevr
Copy link
Contributor Author

Very open for discussion on philosophy on how this value should be chosen.

@sverrevr
Copy link
Contributor Author

The parameters where introduced here: #12756

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-community-q-a-november-22-2023/35324/1

@MaEtUgR
Copy link
Member

MaEtUgR commented Nov 22, 2023

Communitiy Q&A call: Let's open the full sensor quality range on the driver level but add a quality threshold downstream at the EKF to make sure it can be tuned for the particular sensor and use case. As a reference it should be similar to EKF2_RNG_QLTY_T but a threshold for the quality such that it's not just zero or higher.

@sverrevr
Copy link
Contributor Author

Communitiy Q&A call: Let's open the full sensor quality range on the driver level but add a quality threshold downstream at the EKF to make sure it can be tuned for the particular sensor and use case. As a reference it should be similar to EKF2_RNG_QLTY_T but a threshold for the quality such that it's not just zero or higher.

Do we want the default value to be accepting the entire range or still have the threshold at 70/255?

@dagar
Copy link
Member

dagar commented Nov 23, 2023

Communitiy Q&A call: Let's open the full sensor quality range on the driver level but add a quality threshold downstream at the EKF to make sure it can be tuned for the particular sensor and use case. As a reference it should be similar to EKF2_RNG_QLTY_T but a threshold for the quality such that it's not just zero or higher.

Do we want the default value to be accepting the entire range or still have the threshold at 70/255?

For now it should still default to the current behaviour (ekf2 takes it unless 0/invalid), but someone with this newer lidarlite can start setting it if truly necessary.

Before this commit many valid measurements were discarded as the signal strength was lower than 70/255. Based on our experiments we have only seen outlier measurements when the signal strength is identically equal 0.  Furthermore outliers are removed in the terrain estimator making it not that critical if some outliers are not picked up here.
The lower cap on sensor quality is moved from the driver to the EKF2. The default value is chosen to be the same as was previously in the driver, 70/255 ~= 27
@sverrevr sverrevr force-pushed the accept-entire-distance-sensor-signal-strength branch from 8f655cf to 059a52b Compare December 12, 2023 09:19
@sverrevr
Copy link
Contributor Author

From flight test with the new parameter.
At the start i had EKF2_RNG_QMIN = 90, and then only small sections of the data was accepted
Then i changed to EKF2_RNG_QMIN = 0 and moslty everything was accepted (bit unsure what happened a bit after the 1:1:40 mark)
Then I changed to EKF2_RNG_QMIN = 100 and everything was rejected

image

@sverrevr
Copy link
Contributor Author

I think the PR is ready for a new review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants