The Slamtec RPLidar A2 is one of the most popular 2D lidar currently available. Interfacing with a Jetson Dev Kit is straightforward. Looky here:
Background
The RPLidar A2 is a popular low cost 2D LIDAR. Slamtec sells a couple of different versions of the A2, and also sells a more capable A3 version. The prices range from ~$320 USD for the A2 to $600 for the A3. Both the A2 and the A3 have the same footprint, and use the same mounting pattern for attachment.
The RPLidars work by rotating a laser emitter and receiver. The laser emits light, the receiver receives the light. Because the receiver knows when the light was emitted, it can measure accurately how long it takes for the light to reflect back from any objects in the lights path. Then it does some maths, and calculates the distance to the object.
This is a ‘2D’ lidar in that it can measure multiple points on a given plane. The plane is determined by the orientation of the sensor. The RPLidar A2 has a scan rate of up to 15Hz, providing 4000 samples/second. The angular resolution is 0.9 degrees. The range is ~ 4-5 meters outdoors and ~14 meters indoors (much more than the claimed range of 6m).
All in all, that’s way swell for the price point. These specifications are also just about right for most slower moving robots, let’s say less than 10-15 miles per hour. To go faster than that (and not outdrive the lidar), you probably will need greater than ~25Hz scan rates. The RPLidar A3 can come pretty close at 20Hz.
In the video, we mount the RPLidar A2 on a RACECAR/J FlatNose. Note that the RPLidar A2 does not provide the performance of a Hokuyo UST-10LX lidar like on the MIT configuration of RACECAR/J, but it is around $1300 less than the Hokuyo! If you are looking at exploring lidar in a an application like a rover or other vehicle on a budget, this is a good way to go. You’ll just have to remember not to outdrive the lidar.
Installation
The RPLidars work with all of the Jetson Development Kits. There is a trick to installing the RPLidar on the Jetson. A Linux kernel driver called CP210x must be installed on the Jetson. The CP210x driver talks serial to the RPLidar over USB. Fortunately this module is installed by default in the recent L4T installations.
Attach the RPLidar to the Jetson using the supplied cables. You can then check to see if the RPLidar is recognized and the correct driver is loaded:
$ usb-devices
You should be able to find an entry similar to:
Product=CP2102 USB to UART Bridge Controller
Later in the entry you should see a line similar to:
If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=cp210x
The “Driver=cp210x” indicates that the proper module is loaded. If the driver does not load, you may be missing the driver. For a Jetson TX1 or Jetson TX2 there is a cp210x driver available on the JetsonHacks Github account.
Install RPLidar SDK
The Slamtec RPLidar Public SDK is available on Github. See the README in the repository for more informational goodness. To install the SDK:
$ git clone https://github.com/Slamtec/rplidar_sdk
$ cd rplidar_sdk/sdk
$ make
This will download the SDK and build the libraries and examples. For the Jetson, the output will be in rp_lidar/output/Linux/Release. To run the ultra_simple demo, navigate to the Release folder, and then:
$ ./ultra_simple
The RPLidar should start spinning, and data should start spewing about on the console.
Install rplidar_ros for ROS
One nicety is that there is a ROS interface for the RPLidar. For simplicity, we’ll assume that ROS is already installed on the Jetson. There are articles located on this JetsonHacks site for installing ROS.
Navigate to your Catkin Workspace src directory. Then:
$ git clone https://github.com/Slamtec/rplidar_ros
$ cd ..
$ catkin_make
The rplidar_ros node should be installed at this point. If you have rviz installed, you can view the RPLidar output:
$ roslaunch rplidar_ros view_rplidar.launch
You will see output similar to that shown in the video.
Conclusion
If you are interested in understanding lidar on a budget, the RPLidar is a good starting point. This combined with the fact that there is ROS support makes this a very good first step when adding lidar to your robotics project.
Notes
You can purchase the RPLidar at a variety of shops online. For example, you can shop at Sparkfun.
DIYRobocars had a nice article on the RPLidar A2 a few months ago. There’s more detail about the actual performance of the device than presented here.
The power plug on the RPLidar interface board appears to be 4.0mm OD x 1.7mm ID. 5V please.
28 Responses
Hello! I have been following your jestonbot builds and love your videos! Can the RPLidar A2 be powered solely from the USB Hub that is connected to the Jetson board or does the Lidar sensor require an external power supply?
It should be able to run from the USB hub if it is powered. Thanks for watching!
Thank you for the quick reply!
Hello! will rplidar work on jetson nano?
Also can this complete project be done on jetson nano instead of tx1/tx2?
Thank you for your extremely helpful videos and blogs. They’ve helped a lot!!
You can probably port it. I don’t have anything to share on this particular project. Thanks for reading!
Actually i’m a little new to all this stuff. So can you elaborate on the “porting” part please
Porting is the process of taking a given set of code, or library, and getting it to run on another machine.
Also by porting you mean like for example the code you have used in your tutorial for rplidar on tx1, i should try to upload it on nano,right?
RP LIDAR is not working on Jetson nano.
Error, cannot bind to the specified serial port /dev/ttyUSB0
I didt see any solve about this problem in internet so its not working.
You did not state what commands you tried to get this to work. Did you try to use sudo with the command?
Well thank you so much for your help. I don’t have the rplidar with me as of now.Looks like I’ll have to wait for it to come.
Thanks again
Please help me . how i can do.
Ultra simple LIDAR data grabber for RPLIDAR.
Version: 1.11.0
Error, cannot bind to the specified serial port /dev/ttyUSB0.
You’ll have to check which USB port your Lidar is connected to using “dmesg | grep tty” command and change the port in rplidar.launch file. Or you can try changing the ttyUSB* to 0/1/2 in the launch file.
Its still not working in jetson nano. Is there any video about this problem?
You have not provided any information with issue.
Will these instructions work for setting up the RPLiDAR A1M8 as well?
I don’t know, it has not been tested against the A1M8. Thanks for reading!
On tx2, if you are running any kind of slam with lidar, how fast can the map be updated? Thanks.
It depends on which SLAM application you are using.
Hi, can I know how to generate 3D mapping using RPLidar?
RPLidar is a 2D lidar. You will need to construct a mechanism to move the lidar in a x,y, and z direction.
Hi, I use Jetson Nano and try to use RPLidar without USB to Serial converter. RPLidar wired using GPIO UART and powered from GPIO too. ROS Launch file to RPLidar or simple test script from Lidar SDK work correctly and receive data from device, but RPLidar spin only few second and each time have a different time of spinning.
Please help me to solve this problem.
Thanks
I don’t know which Jetson you are using, or how you are powering it.
Hi I am working with the A1M8 2D Lidar. I have been using the provided SDK in Visual Studio 2019, and I was wondering whats the best way to get that onto my Jetson TX2. I have changed their SDK and I am unsure of the best way to run it on the Jetson. I was looking into makefiles, and using CMake, but I am unsure of how to do this.
Thanks for any help!
I am not sure what type of help you are asking about. Have you tried the SDK on your Jetson TX2 before modifying it?
hi i have a jetson nano and the rplidar a3. getting same error: Error, cannot bind to the specified serial port ttyUSB0.
I did the dialout permission. dmesg | grep tty produces:
[ 434.523062] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[ 438.098159] usb 1-2.1: cp210x converter now attached to ttyUSB0
[ 1620.059192] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[ 1706.327699] usb 1-2.1: cp210x converter now attached to ttyUSB0
[ 2350.171083] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[ 5185.876230] usb 1-2.1: cp210x converter now attached to ttyUSB0
i tested the rplidar unit in windows and it does work. i have seen other people with he same issue but as far as i can see it has not been resolved.
I would appreciate any help you can provide. thanks
update on issue: Error, cannot bind to the specified serial port ttyUSB0.
i have it working with ultra_simple and simple_grabber.
./ultra_simple /dev/ttyUSB0 256000 works. However i cannot get it to work under ros. i modified the file rplidar.launch to change the baud rate to 256000. i still get the same error. below is the rplidar.launch
Hello,
I am trying to install rplidar_ros for RPLIDAR S1 on jetson xavier developer kit. I cloned the rplidar_ros package and did catkin_make in catkin_ws, here rplidar nodes are not created.
I followed the same instructions on other virtual machine and it works fine.
I would appreciate any help.
Thank you