I purchased an RPLidar A2 for hobby use last year but didn’t have time to try it out until this recent break (I got a puppy and took a week off work to take care of it – now the downtime means hobby stuff).

Quickstart Instructions

Setup for this thing is not that easy. The quick start guide says to go to http://go.slamtec.com/rplidar/a2/download but I think that page no longer exists and you have to know to go to the downloads page and get the SDK from there.

Then once you get the SDK, you need to read the Manual to get build, drivers, and usage instructions. There’s no readme in the SDK itself.

I’m documenting stuff here for next time I try to set this up on another computer.

Installing the CP210x USB to UART Bridge Driver

The RPLidar comes with a little chip that converts USB to TTY, which is what the actual lidar unit uses (but you want to connect with USB for convenience). That chip requires a driver that is only included in some versions of Linux. If you aren’t seeing a result for ls /dev | grep ttyUSB then download it here from the SILabs website.

VCP Driver Download

The installation goes as follows:

  1. Extract the tarball
  2. make ( your cp210x driver )
  3. cp cp210x.ko /lib/modules/`uname -r`/kernel/drivers/usb/serial
  4. insmod /lib/modules/`uname -r`/kernel/drivers/usb/serial/usbserial.ko
  5. insmod cp210x.ko

Running the Demos

There are two important demo programs. The first is simple_grabber which grabs two rounds of laser data and prints a histogram to your command line.

The second is more useful: ultra_simple continuously fetches the RPLidar scan data and writes the output to the console. This is probably more along the lines of what you’d do in production.

The C++ code behind these applications is open source and available in the sdk download at /sdk/app/ultra_simple/main.cpp and /sdk/app/simple_grabber/main.cpp. The source is really readable.

Going Forward

OK now that I’ve seen my lidar actually take measurements, I’d like to collect some cool data about my room! I could manually write the software to do that, but what most people do is connect their RPLidar to ROS and use the libraries there to work with the 3d point data.

Hopefully I’ll get to that part soon!