1. Radar basics

Slam lidar tutorial materials: http://www.slamtec.com/cn/Support

Lidar technology email address: support@slamtec.com

Lidar wiki: http://wiki.ros.org/rplidar

LiDAR SDK: https://github.com/Slamtec/rplidar_sdk

LiDAR ROS: https://github.com/Slamtec/rplidar_ros

Lidar tutorial: https://github.com/robopeak/rplidar_ros/wiki

Before using lidar, you need to declare the [RPLIDAR_TYPE] variable in advance in the [.bashrc] file according to different radar models. Open the [.bashrc] file

If there is no sentence below in [.bashrc], you need to add it manually according to the purchased radar model. If there is this sentence, modify the radar model directly. For example: Silan a1 lidar

Note: For rosmaster series cars equipped with s2l radar, the radar startup method is the same as s2. Just change it to s2 here.

After modification, refresh the environment variables

1.1. Overview

Single-line lidar refers to a radar whose line beam emitted by the laser source is a single line. It can be divided into triangular ranging and TOF lidar. It is mainly used in the field of robotics. It has fast scanning speed, strong resolution and high reliability. Compared with multi-line lidar, single-line lidar responds faster in angular frequency and sensitivity, so it is more accurate in measuring distance and accuracy of obstacles.

20180925165636342

1.2. Silan radar components

Taking Silan Technology's single-line lidar as an example, it is mainly composed of four core components: laser, receiver, signal processing unit and rotating mechanism.

RPLIDAR adopts a coordinate system that follows the left-hand rule. The front of the sensor is defined as the x-axis of the coordinate system. The origin of the coordinate system is the rotation center of the ranging core. The rotation angle increases with clockwise rotation. The specific coordinate system definition is shown in the figure below: (For details, please see the supporting manual)

| A1 | A2, A3 | | :------------------------------------------------ -: | :------------------------------------------------- ---: | | 6117 | 6118 | | S1 | S2 | | 6118 | 6118 |

1.2.1. Laser

The laser is the laser emitting mechanism in lidar. During operation, it lights up in a pulsed manner. Silan Technology's RPLIDAR A3 series radar lights up and goes out 16,000 times per second.

1.2.2. Receiver

After the laser emitted by the laser hits an obstacle, the reflected light will be concentrated on the receiver through the lens group through reflection from the obstacle.

1.2.3. Signal processing unit

The signal processing unit is responsible for controlling the emission of the laser and processing the signals received by the receiver. Based on this information, the distance information of the target object is calculated.

1.2.4. Rotating mechanism

The above three components constitute the core components of measurement. The rotating mechanism is responsible for rotating the above-mentioned core components at a stable speed to scan the plane and generate real-time floor plan information.

image-20210914115829206

1.3. Principle of single-line lidar

The working principle of the single-wire mechanical rotating radar is as shown in the figure below:

20200512204828561

1.3.1. Trigonometric ranging method

The laser triangulation ranging method mainly uses a beam of laser to illuminate the measured target at a certain incident angle. The laser is reflected and scattered on the target surface. At another angle, a lens is used to converge and image the reflected laser. The spot is imaged on the CCD (Charge-coupled Device, photosensitive coupling component) on the position sensor. When the measured object moves along the direction of the laser, the light spot on the position sensor will move, and its displacement corresponds to the movement distance of the measured object. Therefore, the distance between the measured object and the baseline can be calculated from the light spot displacement distance through algorithm design. value. Since the incident light and the reflected light form a triangle, the geometric triangle theorem is used to calculate the spot displacement, so this measurement method is called the laser triangulation ranging method.

According to the angular relationship between the incident beam and the normal line of the surface of the measured object, the laser triangulation ranging method can be divided into two types: oblique type and direct type.

1. Direct type

image-20210914120518557

As shown in Figure 1, when the laser beam is vertically incident on the surface of the object to be measured, that is, when the incident light is collinear with the normal line of the surface of the object to be measured, it is a direct laser triangulation method.

2. Oblique shot type

When the angle between the incident laser beam and the normal line of the surface of the object being measured is less than 90° in the optical path system, the incident mode is oblique. The optical path diagram shown in Figure 2 is a laser triangulation oblique optical path diagram.

image-20210914120552057

The laser emitted by the laser is incident on the surface of the object being measured at a certain angle with the normal line of the object surface. The reflected (scattered) light is concentrated through the lens at B and is finally collected by the photosensitive unit.

Whether it is the direct or oblique laser triangulation ranging method, it can achieve high-precision, non-contact measurement of the measured object, but the resolution of the direct type is not as high as that of the oblique type.

Silan Technology's RPLIDAR series lidar also uses the oblique laser triangulation ranging method. During each ranging process, the RPLIDAR series lidar will emit a modulated infrared laser signal. The reflection generated by the laser signal after hitting the target object will be received by the RPLIDAR visual acquisition system, and then processed by the DSP embedded inside the RPLIDAR. The device solves the problem in real time, and the distance value between the illuminated target object and the RPLIDAR and the current angle information will be output from the communication interface. Driven by the motor mechanism, the ranging core of RPLIDAR will rotate clockwise, thereby achieving 360-degree all-round scanning and ranging detection of the surrounding environment.

1.3.2. TOF time-of-flight 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 as follows: a modulated laser signal is emitted through a laser transmitter. The modulated light is received by the laser detector after being reflected by the object being measured. The distance to the target can be calculated by measuring the phase difference between the emitted laser and the received laser. .

image-20210914120619928

Under the condition of distant objects, its measurement accuracy remains accurate and stable. At the same time, TOF radar is not inferior in its ability to resist light interference due to its ultra-short light pulse characteristics. It can achieve stable ranging and high-precision mapping even under strong light of 60Klx outdoors.

Generally speaking, triangular ranging lidar and TOF lidar have their own difficulties in implementation. In principle, TOF radar has a longer ranging distance. In some occasions where distance is required, TOF radar is the most common, while The manufacturing cost of triangular ranging lidar is relatively low, and its accuracy can meet most industrial-grade civilian requirements, so it has also attracted much attention in the industry.

1.4. Lidar A1M8

image-20210914145016404

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

IndicatorDescription
Ranging radiusRadar measuring distance range
Ranging sampling rateHow many ranging outputs are performed in one second
Scanning frequencyHow many times the radar scans in one second
Angular resolutionAngle step between two adjacent ranging
Measurement resolution/accuracyMinimum distance change can be perceived

A higher scanning frequency can ensure that the robot equipped with lidar can move at a faster speed and ensure the quality of map construction. However, increasing the scanning frequency is not as simple as accelerating the rotation of the lidar's internal scanning motor. Correspondingly, it is necessary to increase the ranging sampling rate. Otherwise, when the sampling frequency is fixed, 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 to lidar performance. These are important parameters to ensure that the robot can have stable performance.

7b2aa26039954693b1ac971784d5f56f

1.5. Application scenarios

Thanks to the advancement of lidar technology, the measurement radius, ranging frequency, distance resolution and angular resolution of lidar have been greatly improved, which can help various applications obtain larger scenes and richer contour information. It plays an indispensable and important role in many fields such as robot autonomous positioning and navigation, space environment surveying and mapping, and security and defense.

bf80a8d72091442a971c2fcfcf6cbaa2

1.6. Function package rplidar ros

Clone this project into the src folder of your workspace and run catkin_make to build rplidarNode and rplidarNodeClient.

1.6.1. Remap USB serial port

When starting the radar function package, you may encounter that the serial port permissions are not executable. There are two solutions: 1) Add permissions directly; 2) Remap the USB serial port

  1. Directly add permission method

This method only works this time.

Check the permissions of rplidar serial port:

Add write permission: (such as /dev/ttyUSB0)

  1. Remapping USB serial port method

This method works long term.

In the rplidar_ros function package path, install USB port remapping

Re-plug the LiDAR USB interface and use the following command to modify the remapping:

image-20210914151239649

1.6.2. Code testing

You should see rplidar's scan results in rviz.

image-20210914151139732

<PI5 needs to open another terminal to enter the same docker container

image-20240408144126098

You should see rplidar's scan results in the console

image-20220223163925300

1.6.3. Map construction test

image-20220223163145915

lidarframes

rp_rosgraph

1.7. Source code analysis

From the test in section [1.6], it can be seen that the lidar data does not have 360° data. There is a small gap. That is because the data behind the lidar is blocked.

rplidar.launch file

If you do not need to filter radar data, comment or delete the following content in the [rplidar.launch] file

Then modify the [rplidarNode] node

Users can handle it according to the actual situation.