Add a distance sensor, vl53lxx on pixhawk

Hi all,

I’m trying to use a vl53lxx via i2c, a kind of distance sensor on Firmwarev1.8.0 and using nsh to debug.
Entering vl53lxx start in the nsh interface to start vl53lxx.cpp, and then enter vl53lxx test for a test. I can see the report.distance data printed, and the data is basically correct. But when I put printing infomation in collect function in vl53lxx.cpp, the report.distance data is 0.

nsh> vl53lxx start
nsh> vl53lxx test

I am a kind of newbie programmer so any tips would be appreciated.

Thank you.

Hi @Lawliet, are you using a vl53l0x sensor? The driver actually does not function for the vl53l1x.

If your sensor is the 0x, make sure you are starting the driver on the correct bus or make sure that you start the driver with -a to try all busses.

My general advice would also be to upgrade to the v1.10 release, improvements have been made to that driver and you’ll probably benefit by being on the latest stable firmware.

I hope this helps!

-Mark

Thank you for your reply. I have upgraded it to v1.10 release and have a new problem now. Could you please tell me how to put vl53l0x into compile file and where I can make vl53l0x self-starting?

Hi @Lawliet, it should be compiled in by default for almost all hardware except the fmu-v2. You can run vl53lxx status even sipmly vl53lxx to get usage parameters back from the driver. If the driver is not compiled into your binary it should say unrecognized command.

If you would like it to start automatically you can either customize the system startup, or you can just add the startup commands you need into rc.sensors, e.g. vl53lxx start -a.

Good luck!