# Lslidar_M10_N10_V2.5.3_231110_ROS使用说明
## 1.Introduction
Lslidar_M10_N10_V2.5.3_231110_ROS is the lidar ros driver in linux environment, which is suitable for M10 ,M10_GPS,M10_P,M10_PLUS,N10,N10_PLUS and L10 lidar. The program has tested under ubuntu 20.04 ros noetic , ubuntu18.04 ros melodic and ubuntu16.04 ros kinetic.
## 2.Dependencies
- #### ros
To run lidar driver in ROS environment, ROS related libraries need to be installed.
**Ubuntu 16.04**: ros-kinetic-desktop-full
**Ubuntu 18.04**: ros-melodic-desktop-full
**Ubuntu 20.04**: ros-noetic-desktop-full
**Installation**: please refer to [http://wiki.ros.org]
- #### ros dependencies
```bash
# install
sudo apt-get install ros-$ROS_DISTRO-pcl-ros ros-$ROS_DISTRO-pluginlib ros-$ROS_DISTRO-pcl-conversions ros-$ROS_DISTRO-diagnostic-updater
```
- #### other dependencies
~~~bash
sudo apt-get install libpcap-dev
sudo apt-get install libboost${BOOST_VERSION}-dev #Select the appropriate version
~~~
## 3.Compile && Run
- This is a Catkin package. Make sure the package is on `ROS_PACKAGE_PATH` after cloning the package to your workspace. And the normal procedure for compling a catkin package will work.
```bash
mkdir -p ~/lidar_ws/src
#Copy the whole lidar ROS driver directory into ROS workspace, i.e "~/lidar_ws/src".
cd ~/lidar_ws
catkin_make
source devel/setup.bash
#run
roslaunch lslidar_driver lslidar_net.launch #net lidar
roslaunch lslidar_driver lslidar_serial.launch #serial lidar
```
## 4.Introduction to parameters
- The content of the lslidar_serial.launch file is as follows, and the meaning of each parameter is shown in the notes.
#### When using serial port radar, serial port permissions should be granted
~~~bash
sudo chmod 777 /dev/ttyUSB0 #ttyUSB0 is lidar serial port
~~~
~~~xml
#lidar type:M10 M10_P M10_PLUS M10_GPS N10 N10_PLUS L10
#lidar connection serial port
#interface select: net or serial
#lidar coordinates
#Topic name of lidar scan
#Crop angle start
#Crop angle end
#lidar receiving distance min
#lidar receiving distance max
#lidar use GPS timing
#Using angle compensation
#Lidar Release Scanning Theme
#Lidar Release pointcloud2 Theme
#M10_P lidar This value needs to be filled in,Uncertain, please contact technical support.
#Using the txt file reading function
#Visualization
~~~
- The content of the lslidar_net.launch file is as follows, and the meaning of each parameter is shown in the notes.
~~~xml
#lidar scan/point cloud coordinate system name
#lidar ip
#Main data Stream Output Protocol packet port
#lidar destination IP
#Device Information Output Protocol packet port
#lidar type:M10 M10_P M10_PLUS M10_GPS N10 N10_PLUS L10M10_GPS N10 N10_PLUS L10
#interface select: net or serial
#Whether to add multicast
#multicast ip
#设置激光数据topic名称
#Crop angle start
#Crop angle end
#lidar receiving distance min
#lidar receiving distance max
#lidar use GPS timing
#Using angle compensation
#Lidar Release Scanning Theme
#Lidar Release pointcloud2 Theme
#M10_P lidar This value needs to be filled in,Uncertain, please contact technical support.
#Using the pcap file reading function
#Visualization
~~~
## 5.Command controlled radar
- Run lidar drive,open new terminal
~~~bash
#lidar type: M10 M10_GPS M10_PLUS N10 N10_PLUS
rostopic pub -1 /lslidar_order std_msgs/Int8 "data: 0" #close radar
rostopic pub -1 /lslidar_order std_msgs/Int8 "data: 1" #open radar
#lidar type: M10 M10_GPS M10_P
rostopic pub -1 /lslidar_order std_msgs/Int8 "data: 2" #no filtering
rostopic pub -1 /lslidar_order std_msgs/Int8 "data: 3" #normal filtering
rostopic pub -1 /lslidar_order std_msgs/Int8 "data: 4" #close range filtering
rostopic pub -1 /lslidar_order std_msgs/Int8 "data: 100" #Lidar sends device packets
#Only M10 Start stop version
rostopic pub -1 /lslidar_order std_msgs/Int8 "data: 30" #close radar & stop send data
~~~
#### Offline pcap mode:
- Modify the following parameters of the launch file
~~~bash
#uncomment
#Uncomment to read the data from the pcap file, and add the comment to read the data from the lidar
~~~
#### Offline txt mode:
- Modify the following parameters of the launch file
~~~bash
#uncomment
#Uncomment to read the data from the pcap file, and add the comment to read the data from the lidar
~~~