Welcome to YDLIDAR TW3 repository
1.Lidar drive
1. Environment Setup
Before starting the environment Settings, it is necessary to install the CP210X serial port driver first. For the installation tutorial, please refer to the PC software usage tutorial. If you use the virtual machine we provide, after installing the driver and connecting the radar to the computer, you can directly execute the fourth step of driving the radar without setting up the environment.
1. Install the SDK Driver
Based on the specifications of the radar 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 radar. Since using the ROS function package for this radar requires prior SDK installation, the YDLidar-SDK folder contains the radar's driver files. Open a terminal within this folder and type:
mkdir buildcd buildcmake ..make -j4sudo make installIf no errors occur during the process, the driver installation is successful.
2. Creating a new workspace and compiling the package
(Recommended) The first method involves extracting the ydlidar_ws.zip file from the source code to your root directory, and then directly using catkin_make to compile.
xxxxxxxxxxcd ydlidar_wscatkin_make
After successful compilation, add the workspace path to your .bashrc file.
xxxxxxxxxxsudo gedit ~/.bashrc
Copy the following content to the end of the file
xxxxxxxxxxsource ~/ydlidar_ws/devel/setup.bash --extend
The second method involves creating a self-named workspace. For example, let's say the name is ydlidar_ws. Enter the following in the terminal:
xxxxxxxxxxmkdir ydlidar_wscd ydlidar_wsmkdir srccd srccatkin_init_workspace
Then copy the extracted source code from ydlidar_ws/src to the ydlidar_ws/src directory, and then compile it using catkin_make in the ydlidar_ws directory.
xxxxxxxxxxcd ydlidar_wscatkin_make
After successful compilation, add the workspace path to your .bashrc file.
xxxxxxxxxxsudo gedit ~/.bashrc
Copy the following content to the end of the file:
xxxxxxxxxxsource ~/oradar_ws/devel/setup.bash --extend
3. Bind the radar port name
Open a terminal in the ydlidar_ws workspace and enter the following command:
xxxxxxxxxxchmod 0777 src/ydlidar_ros_driver/startup/*sudo sh src/ydlidar_ros_driver/startup/initenv.sh 
Then reconnect the radar serial port and enter ll /dev/ydlidar in the terminal.

If the above content appears, it means that the binding was successful. The last character is not necessarily 0; it will change depending on the order in which the devices are inserted.
4. Driving the Radar
Save and exit, then open a new terminal and enter the following command to activate the radar and display it in rviz.
xxxxxxxxxxroslaunch ydlidar_ros_driver lidar_view.launch

If the above picture appears, it indicates that all the preparatory work has been completed.