RPLidar User Manual

1.ROS-SDK Installation

Before installing, please make sure you have ROS installed.

First, you need to create a workspace where the package will be stored :

> mkdir -p ~/catkin_ws/src
> cd ~/catkin_ws/
> catkin_make
> export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/catkin_ws/src
> source ~/catkin_ws/devel/setup.bash 

Then, clone this project to your catkin's workspace src folder and build the project.

> cd ~/catkin_ws/src
> git clone https://github.com/robopeak/rplidar_ros.git
> cd ..
> catkin_make 

At this point, the RPLidar-SDK has been successfully installed.

2.Use of RPLidar-SDKs

Check and configure USB port

> ls -l /dev |grep ttyUSB
> sudo chmod 666 /dev/ttyUSB0

According to the first command USB Set the port number to the second command.

After completing the installation, you will need to remap the USB serial port name.In the official radar launch file, the default USB serial port name of A1/A3 Radar is /dev/ttyUSB0, which is usually fine, but occasionally there are cases where the actual serial port name of the A1/A3 radar is not the /dev/ttyUSB0. Instead, it is on /dev/ttyUSB1 or some other serial port.
There is no way to assure this, it may change randomly each time, and your configuration needs to be updated.

Although we could just go to the launch file and change /dev/ttyUSB0 to the actual serial port name (maybe /dev/ttyUSB1 or /dev/ttyUSB2), it's very time-consuming and troublesome to do this every time. So we can use a rules file based on the hardware ID to make the port remap to a fixed name and we don't have to manually change the serial port name every time.

For fixed rplidar port, you can using the script file to remap the USB port name:

> cd ~/catkin_ws/src/rplidar_ros/scripts
> ./create_udev_rules.sh

Note: After completing the previous operation, replug the A1/A3 RPLidar again to take effect.

Once you have change the USB port remap, you can change the launch file about the serial_port value.

The default serial port name in the official launch file is /dev/ttyUSB0, you need to change the ttyUSB0 to the mapped name rplidar in the .rules file. 微信截图_20220722143728.png

How to change the A1 radar launch file:

> cd ~/catkin_ws/src/rplidar_ros/launch
> gedit rplidar.launch

Change the value of serial_port to /dev/rplidar.

How to change the A3 radar launch file:

> cd ~/catkin_ws/src/rplidar_ros/launch
> gedit rplidar_a3.launch

Change the value of serial_port to /dev/rplidar.

Then, you can then launch the RPlidar driver with the roslaunch rplidar_ros xxx.launch command.

> roslaunch rplidar_ros view_rplidar.launch      # for rplidar A1
> roslaunch rplidar_ros view_rplidar_a3.launch   # for rplidar A3

If everything is working properly, you should see rplidar's scan result in the rviz. 微信截图_20220722123148.png

results matching ""

    No results matching ""