LiDAR Integration with ROS1

LiDAR Integration with ROS2 Humble and Ubuntu 22.04 on Raspberry Pi

Connect RPLiDAR to Raspberry Pi

  • Connect RPLiDAR to Raspberry Pi using Micro USB Cable.
    • Flashing green light indicates normal activity of sensor
  • Check permissions of rplidar’s serial-port
ls -l /dev |grep ttyUSB
  • output should look similar to:
crw-rw----  1 root   dialout 188,   0 Jan  3 14:59 ttyUSB 
  • Add write authority: (such as /dev/ttyUSB0)
sudo chmod 666 /dev/ttyUSB0

Create Workspace

https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Creating-A-Workspace/Creating-A-Workspace.html

  • source ROS2 environment (main ROS2 installation as underlay)
source /opt/ros/humble/setup.bash
  • create directory and cd into src folder
mkdir -p rplidar_ros2/src
cd rplidar_ros2/src

Install RPLIDAR ROS Package

  • Clone repo into the workspace src folder
git clone https://github.com/babakhani/rplidar_ros2
  • Build the package
cd rplidar_ros2
colcon build --symlink-install --parallel-workers 2
  • Source the environment
source install/setup.bash
  • Check if RPLidar package is found in installed ROS2 package list
ros2 pkg list | grep rplidar
  • Output:
rplidar_ros

Run rplidar_ros2

  • Start a rplidar node using launch file and view scan result in rviz
    • Rviz will open with a map of the RPLIDAR’s surroundings.
    • The laser scanner 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.
ros2 launch rplidar_ros view_rplidar.launch.py

picture 1