Preparation

1. Create a new workspace and compile function packages

Take the creation name rplidar_ws as an example, input following command:

Copy the decompressed rplidar_ros function package to the rplidar_ws/src directory.

Then, in the directory of rplidar_ws, use catkin_make to compile.

After the compilation is passed, add the path of the workspace to .bashrc.

Copy the following content to the end of the file.

2. Bind lidar port name

Open the terminal, input the following command, and copy the rplidar.rules file under the function package to /etc/udev/rules.d.

Then, re-plug the lidar wiring and enter the command ll /dev/rplidar in the terminal.

image-20231101113808346

The above content indicates that the binding is successful. The end is not necessarily 0 and changes according to the order in which the devices are inserted.

3. Test Lidar

Reopen a terminal, input following command to open the lidar and display it in rviz.

image-20231101114118841

When the above screen appears, it means that all preparations have been completed.