Welcome to ROSMASTER X3 repository
1. Introduction and Use of Lidar
1、Introduction and use of radar
1、Program function description
After the program runs, drive the LiDAR of Silan, turn on the radar scan data, and visualize the LiDAR scan data in RVIZ.
2、Program code reference path
Raspberry Pi PI5 master needs to enter the docker container first, Orin motherboard does not need to enter,
the location of the source code of this function is located at,
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/sllidar_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、The program starts
xxxxxxxxxx#Start the A1 radarros2 launch sllidar_ros2 sllidar_launch.py#Start A1 radar + rviz to visualize dataros2 launch sllidar_ros2 view_sllidar_launch.py#Start the S2 radarros2 launch sllidar_ros2 sllidar_s2_launch.py#Start S2 radar + rviz to visualize dataros2 launch sllidar_ros2 view_sllidar_s2_launch.pyRun the screenshot, take the launch of "A1 radar + visualization" as an example,

You can print the data of radar scans by the following command:
xxxxxxxxxxros2 topic echo /scan

4、Introduction to Silan Radar
4.1、Overview
Single-line lidar refers to a single-line radar with a single line of wiring emitted by the laser source, with triangulation ranging and TOF lidar, mainly based on robots
Most of the applications in the field. Its scanning speed is fast, the resolution is strong, the reliability is high, compared with multi-line lidar, single-line lidar has a corner frequency and The sensitivity response is faster, so the distance and accuracy of obstacles are more accurate.
4.2、the principle of ranging
The A1 radar uses the triangulation ranging method, and the S2 radar uses the tree TOF ranging method.
Triangulation ranging method
The laser triangulation ranging method mainly irradiates the measured target with a certain angle of incidence through a laser beam, and the laser reflects and scatters on the surface of the target
Radiation, at another angle using a lens to reflect the laser convergence imaging, spot imaging in CCD (Charge-coupled Device, photosensitive coupling
component) on the position sensor. When the measured object moves in the direction of the laser, the spot on the position sensor will move, and its displacement is large
The small corresponds to the moving distance of the measured object, so the distance value between the measured object and the baseline can be calculated from the spot displacement distance through algorithm design.
Since the incident light and the reflected light form a triangle, the calculation of spot displacement uses the geometric trigonometric theorem, so the measurement method is called laser
Triangulation ranging method.
TOF ranging method
TOF lidar is based on measuring the flight time of light to obtain the distance of the target. Its working principle is mainly manifested as laser emission
The device emits a modulated laser signal, which is reflected by the measured object and received by the laser detector, and the laser is emitted and the reception excitation is transmitted by measurement
The phase difference of light calculates the distance to the target.
4.3、the baud rate used
The baud rate of the A1 radar is 115200, and the baud rate of the S2 radar is 1000000.
4.4、differences in various lidar models

As can be seen from the above figure, the measurement radius, sampling speed, scanning frequency, angular resolution and other parameters are important indicators of radar working performance.
| index | description |
|---|---|
| Radius of ranging | The range of the radar measuring distance |
| Ranging sample rate | How many ranging outputs are performed in 1 second |
| Scan frequency | How many scans the radar performs in 1 second |
| Angular resolution | Angular step of two adjacent ranges |
| Measurement resolution/accuracy | The minimum change in distance can be perceived |
The high scanning frequency ensures that the LiDAR-mounted robot can achieve faster movements and the quality of the map construction. However, to increase the scanning frequency, it is not just as simple as accelerating the rotation of the internal scanning motor of LiDAR, corresponding to the need to increase the ranging sampling rate. Otherwise, when the sampling frequency is fixed, the faster scanning speed will only reduce the angular resolution. In addition to ranging distance and scanning frequency, parameters such as measurement resolution and mapping accuracy are equally important for lidar performance, which are important parameters to ensure stable performance of the robot.