Welcome to SLAM LiDAR repository
1.Preparation
1.Preparation
1.1Compile function package
Unzip rplidar_ros-dev-ros2 in the [Source Code] folder to get the rplidar_ros-dev-ros2 function package. Copy rplidar_ros to the src directory of the workspace you created. Here, the workspace name is rplidar_ws as an example. The path of rplidar_ws is in the ~ directory, and then return to the workspace directory to compile.
cd ~/rplidar_wscolcon build --symlink-install

The above screen description appears and the compilation is passed.
Then enter the following command to set the environment variables.
xxxxxxxxxxecho "source ~/rplidar_ws/install/setup.bash --extend" >> ~/.bashrcOpen the terminal under the rplidar_ros-dev-ros2 function package, enter the following command, and copy the rplidar.rules file under the function package to /etc/udev/rules.d.
xxxxxxxxxxsudo cp rplidar.rules /etc/udev/rules.d/Then re-plug the radar serial port.
Input following command:
xxxxxxxxxxll /dev/rplidar

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.
1.2 Run launch
Run lidar:
x
#A1 lidarros2 launch rplidar_ros rplidar_a1_launch.py#A2M12 lidarros2 launch rplidar_ros rplidar_a2m12_launch.py#A3 lidarros2 launch rplidar_ros rplidar_a3_launch.py#C1 lidarros2 launch rplidar_ros rplidar_c1_launch.py#S2 lidar、S2L lidarros2 launch rplidar_ros rplidar_s2_launch.py#s3ros2 launch rplidar_ros rplidar_s3_launch.pyLidar node data can be viewed through the following command.
xxxxxxxxxxros2 topic echo /scan

Run the radar to display the point cloud and input it into the terminal (ctrl c is required to close the node that started the lidar before),
xxxxxxxxxx#A1 lidarros2 launch rplidar_ros view_rplidar_a1_launch.py#A2M12 lidarros2 launch rplidar_ros view_rplidar_a2m12_launch.py#A3 lidarros2 launch rplidar_ros view_rplidar_a3_launch.py#C1 lidarros2 launch rplidar_ros view_rplidar_c1_launch.py#S2 lidar、S2L lidarros2 launch rplidar_ros view_rplidar_s2_launch.py#s3ros2 launch rplidar_ros view_rplidar_s3_launch.py