Add support for Lidar Lite v3HP, tested on PocketPilot

Hi,

As an attempt to use the new Lidar Lite v3HP from Garmin for my indoor localization project with PocketPilot, I have modified the existing lidar driver to make it compatible with this new rangefinder. Besides new features, this model has changed the sensor reading method:

I want to make a pull request so that I and other people can use this sensor right away without rebuilding source code.

Details of my change:

  • Add new register for v3hp-hardware
  • Change i2c bus detect from (1,0) to (2,1) to make it work with pocketpilot i2c-2 bus (this may cause conflict over other hardware)
  • Add a new lidar type: RangeFinder_TYPE_PLI2CV3HP (V3HP doesnā€™t have version register, so we cannot use autodetect as V1 and V2)
  • Modify example code in RFIND_test: read lidar at 50Hz

My commit:

Hardware connection:

Build, copy, and run example code:

./waf examples
scp build/pocket/examples/RFIND_test debian@pocketpilot-ip-addr:/home/debian
./RFIND_test

Test result:
v3hp-result

1 Like

@nghiajenius Thats really great that you added the new functionality. Are you planning on a Pull Request on ArduPilot ?
According to Garmin you can get up to 1.5kHz scan rate with this modeā€¦ I am thinking of a scanning Lidar hereā€¦humā€¦ 1 deg accuracy at 4 RPMā€¦

Hi,
Thanks for your comment. Yes, I want to make a Pull request on ArduPilot for this driver.

At 1.5kHz, it can be used for scanning, but it requires continuously polling the busy flag and very small acquisition count settings, which affects accuracy. So, I think that this application needs a different micro-controller to handle and feed the result to Ardupilot.

Yes I agree, actually I was diverging a little, but that could be an interesting use case for the Pocket because of the PRU and the QEP can act as an accurate motor control with encoder feedback ā€¦ so many projects, so little time

Keep on the good work

Oh sure, it can be a useful application for the Pocketbeagle, Iā€™ll try to evaluate the update rate limit of this sensor first because I quite doubt about its accuracy at 1.5kHz. Actually I really appreciate your effort on the PocketPilot project, and I want to add my small contribution to it too. Thank you.

1 Like

@ppoirier
has lidar lite v3hp been added to the plane library as well, or is this going to come out in the next release for both copter and plane?

@nghiajenius have you pushed the PR ?

Interestingly I tested a LidarLitev3HP yesterday with the regular driver and found that itā€™s update rate was very slow. Iā€™ll try again with this PR from @nghiajenius

@rmackay9 Iā€™m also getting the slow update rate issue, see this post. What can I do to help resolve it?

@pumesies,

Thanks for the report. So it is most likely an issue with the driver. There have been some changes made in the sensor so we need to test and then merge the PR from @nghiajenius.

Iā€™ve got a couple of events happening next week so I donā€™t think this fix will get into 3.6.0 but hopefully we can get it into a ā€œpoint releaseā€ ā€¦ i.e. Copter-3.6.1ā€¦

1 Like

Hi @anon94298870, @pumesies, @ppoirier, @rmackay9,

As far as I know, the current library only supports LidarLite V3, not V3HP. The V3HP requires us to send a measure command periodically to obtain new values, and it doesnā€™t have continuous mode as V3.

Therefore, if you want to use LidarLite V3HP, you can either use PWM connection or modify the source code as my PR here (it hasnā€™t been merged yet): https://github.com/ArduPilot/ardupilot/pull/9169. The library is shared between platforms, so I think you can use it on plane as well.

Thanks Randy so much for helping me test this driver, although I have carefully tested it myself and it could reach 50Hz update rate, more evaluation is very helpful for a stable driver. Hope to see my PR merged soon!

1 Like

Thanks for the driver update! Unfortunately Iā€™m already using all my pwm outputs, so I need to get it working on I2C. Iā€™ll try to bench test it on Plane today and let you know how it goes.

Ok, so after spending all day on it, I could not get my build environment set up to work correctly yet. Iā€™ll continue next week.

Hi, can you tell me more about your hardware setup?

Iā€™ve bench tested the updated lidar drivers, and it works very well!

I fly a electric plane, with flaps etc (hence so many pwn outputs), gps, airspeed sensor, and lidar to help with landing. I used to use a TFMini, but its range was so limited that it hardly helped at all. Iā€™m hoping the LidarLite will help me get a more accurate flare and softer landing.

1 Like

Hi @pumesies,

Iā€™m very happy to know that the driver works well on plane too. Thanks for daring to test my code! :joy: I have tested it in my quadcopter but I have no experience in plane. Did you use the Cube as your flight controller?

Yes I use a Cube. Iā€™m not sure when Iā€™ll be able to fly, maybe next week, but Iā€™ll let you know how it went.

1 Like

Thanks. A small note is that the lidar is very noisy when the range is below 30cm.

2 Likes

Thanks for the heads up, I have set the parameters to ignore the Lidar below 0.5m since itā€™s committed to the landing by that stage anyway.

So we flew the new Lidar last week, it worked a treat! The lidar activated nice and early in the glide slope, which means the flare was accurate to ensure a gentle landing. Much much better than with the TFMini.

@rmackay9 What needs to happen before this PR can be merged into the master firmware?

1 Like

Hi @pumesies,

Iā€™m so happy to know that you had a successful flight! I have followed up with reviewers and fulfilled all change requests to match Ardupilot standard, so I also hope that it will be eventually merged soon! :wink: