Skip to content
Snippets Groups Projects
Commit 3377ec18 authored by DanielePettenuzzo's avatar DanielePettenuzzo Committed by Beat Küng
Browse files

vl53lxx driver: add saturation when distance goes beyond max_distance

parent ad49509b
No related branches found
No related tags found
No related merge requests found
......@@ -72,8 +72,6 @@
#include <board_config.h>
#define NAN_F 0.0F/0.0F
/* Configuration Constants */
#ifdef PX4_I2C_BUS_EXPANSION3
#define VL53LXX_BUS PX4_I2C_BUS_EXPANSION3 // I2C port (I2C4) on fmu-v5
......@@ -659,7 +657,13 @@ VL53LXX::collect()
report.timestamp = hrt_absolute_time();
report.type = distance_sensor_s::MAV_DISTANCE_SENSOR_LASER;
report.orientation = _rotation;
report.current_distance = distance_m;
if(distance_m > 2.0f){
report.current_distance = 2.0f;
} else {
report.current_distance = distance_m;
}
report.min_distance = VL53LXX_MIN_RANGING_DISTANCE;
report.max_distance = VL53LXX_MAX_RANGING_DISTANCE;
report.covariance = 0.0f;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment