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

multiranger discard range measurements larger with bad status #1088

Merged
merged 2 commits into from
Aug 2, 2022

Conversation

knmcguire
Copy link
Contributor

This should fix #874. Here in the multiranger, it will first check if the vl53l1 returns a valid range measurements status, and if not it will output the maximum value of an int16_t

Two questions here:

  1. Should I do this also for the z-ranger/flowdeck?
  2. Do we want to still output the measurement but just include the ranging status in the logging variable?

@@ -96,7 +96,11 @@ static uint16_t mrGetMeasurementAndRestart(VL53L1_Dev_t *dev)
}

status = VL53L1_GetRangingMeasurementData(dev, &rangingData);
range = rangingData.RangeMilliMeter;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the most important change, the rest is just formatting

@knmcguire
Copy link
Contributor Author

with discussion with @krichardsson, we decided to add a parameter which presents a filter flag, that indicates for which statuses the measurement, if it should let the measurement through or not, based on these values:

#define VL53L1_RANGESTATUS_RANGE_VALID 0
/*!<The Range is valid. */
#define VL53L1_RANGESTATUS_SIGMA_FAIL 1
/*!<Sigma Fail. */
#define VL53L1_RANGESTATUS_SIGNAL_FAIL 2
/*!<Signal fail. */
#define VL53L1_RANGESTATUS_RANGE_VALID_MIN_RANGE_CLIPPED 3
/*!<Target is below minimum detection threshold. */
#define VL53L1_RANGESTATUS_OUTOFBOUNDS_FAIL 4
/*!<Phase out of valid limits - different to a wrap exit. */
#define VL53L1_RANGESTATUS_HARDWARE_FAIL 5
/*!<Hardware fail. */
#define VL53L1_RANGESTATUS_RANGE_VALID_NO_WRAP_CHECK_FAIL 6
/*!<The Range is valid but the wraparound check has not been done. */
#define VL53L1_RANGESTATUS_WRAP_TARGET_FAIL 7
/*!<Wrapped target - no matching phase in other VCSEL period timing. */
#define VL53L1_RANGESTATUS_PROCESSING_FAIL 8
/*!<Internal algo underflow or overflow in lite ranging. */
#define VL53L1_RANGESTATUS_XTALK_SIGNAL_FAIL 9
/*!<Specific to lite ranging. */
#define VL53L1_RANGESTATUS_SYNCRONISATION_INT 10
/*!<1st interrupt when starting ranging in back to back mode. Ignore data. */
#define VL53L1_RANGESTATUS_RANGE_VALID_MERGED_PULSE 11
/*!<All Range ok but object is result of multiple pulses merging together.
* Used by RQL for merged pulse detection
*/
#define VL53L1_RANGESTATUS_TARGET_PRESENT_LACK_OF_SIGNAL 12
/*!<Used by RQL as different to phase fail. */
#define VL53L1_RANGESTATUS_MIN_RANGE_FAIL 13
/*!<User ROI input is not valid e.g. beyond SPAD Array.*/
#define VL53L1_RANGESTATUS_RANGE_INVALID 14
/*!<lld returned valid range but negative value ! */
#define VL53L1_RANGESTATUS_NONE 255
/*!<No Update. */

Copy link
Contributor

@krichardsson krichardsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet!

@krichardsson krichardsson merged commit 5343ef8 into master Aug 2, 2022
@krichardsson krichardsson deleted the fix-noisy-max-range branch August 2, 2022 06:56
@krichardsson krichardsson added this to the 2022.09 milestone Sep 7, 2022
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.

Multiranger deck gives odd values when out of range
2 participants