6.2.3 LiDAR Usage Guide
Last Version: 11/09/2025
Overview
This section explains how to integrate mainstream 2D LiDAR devices under ROS 2 Humble, covering SDK compilation, driver-package creation, and usage instructions for YDLidar and RPLidar.
After completing the following steps, your YDLidar or RPLidar device will be ready to use with ROS 2 Humble.
YDLidar Driver Setup
Build the YDLidar SDK
The YDLidar ROS 2 driver depends on the official YDLidar-SDK, which must be compiled and installed manually:
git clone https://github.com/YDLIDAR/YDLidar-SDK.git
cd YDLidar-SDK
mkdir build && cd build
cmake ..
cmake --build . -- -j8
sudo cmake --install .
Build the ROS 2 Driver Package
Create and build the ROS 2 package for the YDLidar driver:
mkdir -p ~/demo_ws/src && cd ~/demo_ws/src
git clone https://github.com/YDLIDAR/ydlidar_ros2_driver.git --branch=humble --depth 1
cd ~/demo_ws
source /opt/ros/humble/setup.bash
colcon build
RPLidar Driver Setup (rdlidar)
This section explains how to set up the RPLidar driver by building the ROS 2 driver package.
Build the ROS 2 Package
mkdir -p ~/demo_ws/src && cd ~/demo_ws/src
git clone https://github.com/allenh1/rplidar_ros.git --branch=ros2 --depth 1
cd ~/demo_ws
source /opt/ros/humble/setup.bash
colcon build