Spread the love
Reference Sites
http://www.slamtec.com/en/Support#rplidar-a-series
https://github.com/Slamtec/rplidar_sdk
https://github.com/SkoltechRobotics/rplidar
Instructions.
Connect all of the Lidar cables to a USB port on your Raspberry pi or Jetson.
Make sure the USB cable is a data cable. If you have done this correctly, you should see two green lights as shown below and the lidar will spin.

At the Linux command, type:
usb-devices
You should see the following. If you do not see the Lidar (Manufacturer: Silicon Labs.) the Lidar is not connected properly. Check your connections and USB cable type.

Now make sure the data is coming through /dev/ttyUSB0.
cd /dev
ls

Install the Python3 packages.
sudo apt install python3-pip
sudo pip3 install rplidar
Python3 Code.
Create a python3 file called lidar2.py
from rplidar import RPLidar
lidar = RPLidar('/dev/ttyUSB0')
info = lidar.get_info()
print(info)
health = lidar.get_health()
print(health)
for i, scan in enumerate(lidar.iter_scans()):
print('%d: Got %d measurments' % (i, len(scan)))
if i > 10:
break
lidar.stop()
lidar.stop_motor()
lidar.disconnect()
Run python code
sudo python3 lidar2.py

Additional Resources
https://github.com/zlite/rplidar