Welcome to ROSMASTER R2 repository
1-1. Introduction and use of SLAM lidar
1. Introduction and use of radar
1. Program function description
After the program runs, drive Silan's laser radar, turn on the radar scanning data, and visualize the laser radar scanning data in rviz.
2. Program code reference path
Raspberry Pi PI5 master control, you need to enter the docker container first,
The location of the function source code is,
xxxxxxxxxx#A1 radar~/yahboomcar_ros2_ws/software/library_ws/src/sllidar_ros2/launch/sllidar_launch.py#S2 radar~/yahboomcar_ros2_ws/software/library_ws/src/sllidar_ros2/launch/s llidar_s2_launch.py#A1 radar visualization~/yahboomcar_ros2_ws/software/library_ws/src/sllidar_ros2/launch/view_sllidar_launch.py#S2 radar visualization~/yahboomcar_ros2_ws/software/library_ws/src/sllidar_ros2/launch/view_sllidar_s2_launch.py3. Program startup
xxxxxxxxxx#Start A1 radarros2 launch sllidar_ros2 sllidar_launch.py#Start A1 radar + rviz visualization dataros2 launch sllidar_ros2 view_sllidar_launch.py#Start S2 radarros2 launch sllidar_ros2 sllidar_s2_launch.py#Start S2 radar + rviz visualization dataros2 launch sllidar_ros2 view_sllidar_s2_launch.pyRun screenshot, take the start of "A1 radar + visualization" as an example,

You can use the following command to print the data scanned by the radar,
xxxxxxxxxxros2 topic echo /scan

4. Introduction to Silan Radar
4.1. Overview
Single-line laser radar refers to a radar whose laser source emits a single-line beam. It is divided into triangulation and TOF laser radar, and is mainly used in the field of robots. It has fast scanning speed, high resolution and high reliability. Compared with multi-line laser radar, single-line laser radar has faster response in angular frequency and sensitivity, so it is more accurate in the distance and accuracy of obstacle measurement.
4.2. Distance measurement principle
A1 radar uses triangulation ranging method, and S2 radar uses tree TOF ranging method.
Triangulation distance measurement method
Laser triangulation distance measurement method mainly uses a laser beam to illuminate the target at a certain incident angle. The laser is reflected and scattered on the target surface. The reflected laser is focused and imaged at another angle by a lens. The light spot is imaged on the CCD (Charge-coupled Device) position sensor. When the object to be measured moves along the laser direction, the light spot on the position sensor will move. The displacement size corresponds to the moving distance of the object to be measured. Therefore, the distance value between the object to be measured and the baseline can be calculated by algorithm design based on the light spot displacement distance.
Since the incident light and the reflected light form a triangle, the calculation of the light spot displacement uses the geometric trigonometric theorem, so this measurement method is called laser triangulation distance measurement method.
TOF distance measurement method
TOF laser radar is based on measuring the flight time of light to obtain the distance of the target object. Its working principle is mainly manifested in that a beam of modulated laser signal is emitted by a laser transmitter, and the modulated light is received by the laser detector after being reflected by the measured object. The distance of the target can be calculated by measuring the phase difference between the emitted laser and the received laser.
4.3. Baud rate used
The baud rate of A1 radar is 115200, and the baud rate of S2 radar is 1000000.
4.4. Differences between various laser radar models


As can be seen from the above figure, parameters such as measurement radius, sampling speed, scanning frequency, and angular resolution are important indicators of radar working performance.

A higher scanning frequency can ensure that the robot equipped with the LiDAR can move at a faster speed and ensure the quality of map construction. However, increasing the scanning frequency is not as simple as simply accelerating the rotation of the scanning motor inside the LiDAR. The corresponding distance sampling rate needs to be increased. Otherwise, when the sampling frequency is fixed, a faster scanning speed will only reduce the angular resolution. In addition to the ranging distance and scanning frequency, parameters such as measurement resolution and mapping accuracy are equally important for the performance of the LiDAR. These are important parameters to ensure that the robot can have stable performance.