AP_RangeFinder_VL53L0X

Hello

I am using the 3.6 -Dev firmware since it is the only one that should support the VL53L0X range finder.
the strange thing is that in “sonarrange” I get values of 0.01 that go higher (about 1.27~1.28 and than get stuck) if I increase the distance of an object in-front of it.
From my understanding I should get other values.
The “sonarvoltage” remain “0”.
I have checked this VL53L0X with Arduino lib - https://github.com/adafruit/Adafruit_VL53L0X and it seems to work OK.

What didnt I set right?
By the way I power the Pixracer via USB power.

These two parameters made it work for me:

RNGFND_ADDR 41
RNGFND_TYPE 16

You might want to double check the I2C address i2cdetect on a raspberry pi though, I’m not sure why it was 0x29 (=41 in decimal) in my case… it’s not what it is supposed to be according to the data sheet.

Edit: Sorry, I didn’t read your post right, you are getting range values, so the sensor should be working in theory. The voltage does not matter, because it is not an analog sensor.

Did you adjust

RNGFND_MIN_CM 2
RNGFND_MAX_CM 120

and set

RNGFND_GNDCLEAR 7

according to your setup? Your values seem normal btw, the range of the device is to about 120 cm (=1,2m). Are you sure it is not working properly?

Dear Moobsen

The range finder works but stop working after a few min if the external LED is connected.
I have investigated more and it seems if I set the VL53L0X.CPP timing instead of 33ms to 61ms.
I think it is a bug with the I2C scheduler that try to send or get data when the I2C is not free…
But even when I get data from the range finder I still get bad lidar health…

I see you have filed a bug report, I guess the discussion should continue there. Unfortunately your problem eludes my knowledge.
What I can say is that I am using that range finder and the px4flow sensor both on I2C. I recently experienced some weird behavior, where the range sensor would apparently stop working for a short period of time and then start to work again. I have not looked into that, but it might very well be related to the timing issue you are describing.

It somehow I wasn’t aware that we even supported this range finder. We need to make a better wiki page (easy) and dig into this issue a bit.

A random guess is that we are not properly getting/releasing the I2C semaphore when talking to this device but that shouldn’t actually happen because our I2C manager code does this automatically for us… so it could be something else.

Anyway, I’ve added it to our to-do list for 3.6 and ordered a couple of these lidar so hopefully we can figure out what’s going on.

Update: wiki page added here. Thanks for the input on what the parameters should be, that made it easier.

Dear rmackay9

I have seen the wiki page, it only refer to one sensor what if you want to add more then one…?

Shaddow,

I think with some flight controllers, two I2C ports are available (like on a Pixhawk2) so that would be a good solution. We don’t currently support (as far as I know) a way to handle more than 2.

Hi,

the only reference to the VL53L1X lidar i found is that it is not yet supported - could anybody state what is the issue with that model? it seems like it is same i2c device - is there any reason it is not in the 3.6 build support list? I could not find anything about it on this site.

The VL53L1X does look very interesting indeed.

I took a glance at the API and there seem to be some significant differences between the VL53L0X and VL53L1X driver. Just because they both use I2C does not mean that the 0X driver automatically works for the 1X version. So basically somebody needs to write/port the VL53L1X driver to ardupilot.

1 Like

@moobsen @Paul_Atkin1
When first released, there was a ‘‘show stopper’’ on the SparkFun Github:
Because ST has chosen not to release a complete datasheet we are forced to reverse engineer the interface from their example code and I2C data stream captures.

Now I see that POLOLU released their own version 3 weeks ago, and the drivers seems to be better integrated (actually it looks a lot like the vl53l0x).: https://github.com/pololu/vl53l1x-arduino

So I just ordered one from RobotShop :slight_smile:

Very cool. :slight_smile:

You do know that ST released a sample driver under BSD-3 license?

http://www.st.com/content/st_com/en/products/embedded-software/proximity-sensors-software/stsw-img007.html#getsoftware-scroll

Yes, as written on the POLOLU github above :
Most of the functionality of this library is based on the VL53L1X API provided by ST (STSW-IMG007),

Received and tested.
It seems ok indoor

The above test is in my garage looking at different walls, below it aims at a wall an then I open the garage door to let the bright light in.
As you can see , the signal gets ‘‘flooded’’ , so it requires mode tuning, and maybe some IR filtering in order to get used outdoor.

I used this sketch on an Arduino Nano: https://github.com/pololu/vl53l1x-arduino/tree/master/examples/Continuous

1 Like

Hi , i am trying to put in vl53l0x into the i2c chain, after compass - is it supposed to work? i see board gets voltage and signal lines are at 3v, but cannot get it to show up in the copter Status output. is it guaranteed to have address 41 or can it be anything else?

also, if it is attempted to be used as a second rangefinder with a direction for front - what field in the real time data view is supposed to show its range?

This is working no problem, try removing compass just to make sure you dont get conflicting address.
As for the second rangefinder, if you use another vl053, its a little bit complicated on a FC because you have to pull the sensor shunt line low in order to change address of the second unit and there is no code for it on ardupilot, I did it on the POC using arduino: Avoidance Experiments with the POC and Benewake TFMINI

ok, thx, i wil need to setup arduino bench then to understand why it refuses to communicate.
first lidar is the tfmini on the serial port looking down, so i wanted to play with a second one on the I2C bus to look forward but so far it is not showing up no matter what. i tried to disable serial port for TFMini to make this vl053 the only lidar in the setup but sonarrange value was always 0. i can only suspect units i got from pololu may be setup differently, and it will need some work to figure out what is the deal.

If you can test with an arduino that would be best.
The setup with a TFMINI and VL53L0x should work ok, just remember that you need to CTRL-F in mission planner to see the ‘‘RADAR’’

hi, i am not sure what is the deal with this lidar.

i tried it now on 2 different FCs. on none of them it is getting recognized or works, when configured as specified.
i just finally found time to plug it to arduino board to test - i see it prints data perfectly fine and is reporting back address 41 - (i presume function below returns decimal number) and correct range from the loop as below:
void loop()
{
Serial.print(sensor.readRangeContinuousMillimeters());
Serial.print(sensor.getAddress());
if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

Serial.println();
}

i do not know if it is important or not - but i got those sensors from pololu, and sketch uses their library. is it a same one that is in the ardupilot?

i am really lost what the heck ardupilot wants in order to work with this lidar. i have now 3.6 rc6 loaded.
configuration done as wiki states -
RNGFND_TYPE = 16 (VL53L0X)
RNGFND_ADDR = 41 (I2C Address of lidar in decimal). The sensor’s default I2C address is 0x29 hexademical which is 41 in decimal.
RNGFND_SCALING = 1
RNGFND_MIN_CM = 5
RNGFND_MAX_CM = 120. This is the distance in cm that the rangefinder can reliably read.
RNGFND_GNDCLEAR = 10

what may be missing in this thing? sonarrange always stays at 0, message on ‘bad lidar health’ is always on.

please limit the range by aiming at a distance of about 40-50 cm
You will have this error if the lidar is aomed at over 150 cm

i had lidar on the same bench where i had it with arduino, pointed at my monitor 30cm away. had perfect printout in arduino, when connected to auav x2 board - i only get bad lidar health error and sonarrange remains at 0. very puzzling, and with 0 debug capabilities in ardupilot for i2c bus - go figure.

i am not sure at all what to do - in this test lidar was the only device on i2c bus.

i have 4 of those lidars, wanted to put them on 3 models i have - as it was supposed to be so simple, just a daisy chain after compass - but it simply does not work at all, on none of models. odd.

does it all still work on your model fine with 3.6 rc6? do you power this lidar from same serial port or i2c bus port or separate? i tried now to power it from 3.3 and 5v - neither did any good. but i did not try yet to power it from a separate bec.