From unboxing RPLIDAR to running in ROS in 10 minutes flat

We received our RPLIDAR this morning and, just as kids on Christmas day, we were very eager to play with it right away.

But I’ll hold my horses, as I can hear you ask: “and what exactly is a RPLIDAR?”

A RPLIDAR is a low cost LIDAR sensor (i.e., a light-based radar, a “laser scanner”) from Robo Peak suitable for indoor robotic applications. Basically a cheaper version of that weird rotating thing you see on top of the Google self-driving cars. You can use it for collision avoidance and for the robot to quickly figure out what’s around it.

Google self-driving car from https://www.google.com/selfdrivingcar

Google self-driving car from https://www.google.com/selfdrivingcar

We bought some sensors for our incoming robotic fleet that will take over the world (the true aim of our Cloud Robotics initiative), and this is the first arrival.

I didn’t have ROS installed on my system and I really wanted to get going, so while TMB proceeded with the HW unboxing and config I got started with the SW on my laptop.

Here’s the RPLIDAR in all its might:

RPLIDAR

RPLIDAR

Mind you, I run Ubuntu 14.04, so if your OS is different the process might need some adjustment.
The whole thing is quite straightforward. The RPLIDAR starts spinning as soon as you plug it in your laptop USB port. The software part involves installing ROS, providing it some basic configuration, creating a workspace, downloading the ROS node for the RPLIDAR, and building it with catkin. Although it looks like a lot of commands it takes a very short time.
Anyhow, here’s the quick and dirty list of commands I entered to get it working:

### Install ros (Jade) according to this guide: http://wiki.ros.org/jade/Installation/Ubuntu
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-key 0xB01FA116
sudo apt-get update
sudo apt-get install ros-jade-desktop-full

### init ros
sudo rosdep init
rosdep update
echo "source /opt/ros/jade/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt-get install python-rosinstall

### Create a ROS Workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace

### Clone the ROS node for the Lidar in the catkin workspace src dir
git clone https://github.com/robopeak/rplidar_ros.git

### Build with catkin
cd ~/catkin_ws/
catkin_make

### Set environment when build is complete
source devel/setup.bash

### Launch demo with rviz
roslaunch rplidar_ros view_rplidar.launch

Result:

Screenshot from 2016-01-20 12:02:06Rviz will pop-up and show a background grid. The “view” from the laser scanner will be marked in red. The laser scanner is positioned at the center of the grid, it has a range of roughly 15cm to 6 meters, so you’ll be able to see everything around it on its scanning plane within that range.

Troubleshooting
If you get permission errors on accessing the USB device with ROS take a look here:
http://question2722.rssing.com/browser.php?indx=42655234&last=1&item=4

TL;DR – run this:

sudo gpasswd --add ${USER} dialout
su ${USER}

Then cd to catkin dir and run the last two commands above.

 

 

2 thoughts on “From unboxing RPLIDAR to running in ROS in 10 minutes flat

  1. I did the same steps for running rplidar A1 scan data But it gives error after running “roslaunch rplidar_ros view_rplidar.launch” .i also write following lines before running rplidar node.
    ls -l /dev |grep ttyUSB
    sudo chmod 666 /dev/ttyUSB0

    But no use. it gives the error:
    [rplidarNode-2] process has died [pid 3116, exit code 255,]

    Can you please help me??

    • Hi memona

      It’s kinda hard to tell what the error could be in your configuration. But somehow it looks like the launch file can’t find the correct usb device or is missing a symlink to it. Please check if you have included the udev rules for creating a symlink to the device. A script to create those rules can be found here: https://github.com/robopeak/rplidar_ros/blob/master/scripts/create_udev_rules.sh

      For more help i would need a bit more information about the error or the setup you did.

      I hope this hint helps you to get it running.

Leave a Reply

Your email address will not be published. Required fields are marked *