lightware i2c lidar - voxl m500 with flight core v2
-
Hi,
Looking at the datasheet, it appears the external i2c connector on the flight core v2 is j14 (the 12 pin connector) with pins 6 and 7 being SDA and SCL respectively. Assuming I have that correct, I wired up a lightware LW20/C lidar and connected it to the m500, but nothing appears to have changed in the mavros topics the drone outputs. Of course there's some possibility of a loose / faulty connection / bad soldering, but I checked and there is properly 3.3V across the J14 power pins, so I can assume the SDA and SCL pins are also properly connected. Is there any additional setup I need to do to get the lidar working? From reading other posts about i2c setup on the voxl, it seemed like on startup the lidar should be recognized and drivers should be started.
Thanks!
-
@jonathankampia Looking through the PX4 code it seems there is a parameter called SENS_EN_SF1XX that is by default set to 0. If it is set to 1 then it should autostart the lightware_laser_i2c on next boot. To debug you can open up the nuttx (mavlink) console on QGC and enter
lightware_laser_i2c status
to see if the driver is running or not. If it appears to be running you can trylistener distance_sensor
to see if the driver is actually publishing distance measurements. -
@Eric-Katzfey So the parameter you mentioned contains the models of the lidar in QGC, and after selecting the correct model and looking at the i2c buses we figured out that for some reason you have to unplug and plug back in the lidar after you start up the drone. Then, it will appear as a device, and we can start it manually with lightware_laser_i2c start -X -b 2. Not sure why it's necessary to do this manually and it's pretty annoying, though.
-
@jonathankampia I would also like to mention this is hooked up to a flight core v2 on firmware version 1.13.2. One of my mentors said this might be the problem, as the previous firmware version we used with the original flight cores did not have this issue
-
@jonathankampia Yes, that does sound annoying! I'm trying to understand how unplugging the unit and plugging it back in would make any difference. If you don't do this unplugging and replugging and try to run
lightware_laser_i2c start -X -b 2
manually it will fail? Even with repeated tries? PX4 doesn't know anything about what is on any particular i2c bus. When you start the driver you just tell it which bus to try. It will then try to send commands addressed to the unit on that bus and see if the unit responds. However, the unplugging / replugging is power cycling the lidar unit. So it's possible that there is a race condition in that the unit powers up but is not yet ready when px4 attempts to communicate with it. -
@jonathankampia You could also try to ask on the PX4 discord channel to see if any other PX4 users have experienced this issue.
-
I am running into this issue as well. I found there is an active issue on PX4 related to this sensor not starting automatically on startup here:
-
Also running into problem where device is not detected unless plugged in after FCV2 is already powered when running
lightware_laser_i2c start -XThis is on PX4 1.13.2 as well
-
So it's possible that there is a race condition in that the unit powers up but is not yet ready when px4 attempts to communicate with it.
I tried powering the lightware lidar via microusb and keeping all else the same to see if there was that race condition.
I found that even if the lightware lidar is already on and continually getting power from the microusb, the flightcore v2 still will not detect it unless it gets plugged in after the flightcore v2 turns on
-
Tested on 1.12.2, seeing same issue