Preparation before use

1. Install sdk driver

Based on the specifications of the lidar you purchased, locate the compressed file labeled "YDLidar-SDK" in the provided source code package. Extract the "YDLidar-SDK" folder; this folder contains the SDK files for this lidar. Since using the ROS function package for this lidar requires the SDK to be installed beforehand, the "YDLidar-SDK" folder contains the lidar's driver files. Open a terminal in this folder and type:

If no errors are reported during operation, the driver is successfully installed.

2. Create a new workspace and compile function packages

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

Copy the following content to the end of the file,

Then copy the decompressed source code function package under ydlidar_ws/src to the oradar_ws/src directory, and then use catkin_make to compile in the oradar_ws directory.

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

Copy the following content to the end of the file,

3. Bind radar port name

Open the terminal in the root directory of the Raspberry Pi and enter the following command,

Then copy the following content into it,

image-20240423195203336

Then re-plug the lidar serial port and enter ll /dev/ydlidar in the terminal.

image-20240423195100817

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.

Then open our docker script and add it

image-20240423195631005

4. Drive lidar

First go into the docker we provide, open a terminal in the Raspberry Pi directory and enter,

image-20240423195440851

After that, enter the following statement to open the lidar and display it in rviz,

image-20240423195805037

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