foreword
This article records the process of adapting Leishen Intelligent C16 multi-line radar in Ubuntu 18.04-melodic, using the recently popular domestic ROS development board Luban Cat (LubanCat) for adaptation.
Prepare hardware
A set of Leishen intelligent C16 multi-line radar kit (radar main body, power adapter, network cable - used for communication)
a ROS development board Luban cat, used to provide Ubuntu18.04-melodic system environment
expected result
Connect the LslidarC16 radar to the main controller of Luban cat, you can view the output pointcloud point cloud through rviz, and read the LaserScan point cloud data.
hardware introduction
1. About radar
Radium Smart C16 multi-line laser radar, using 16 laser lines, can reach a scanning frequency of 20HZ, corresponding to an angular resolution of up to 0.09 degrees, with an accuracy of ±3cm, and can accurately detect the position and shape of objects.
2. About Luban cat
LubanCat is a brand of Linux and Android card computer series launched by Wildfire Technology. This series of boards are cheap and easy to use, with a high degree of adaptability to the operating system, and a lot of open source teaching materials , so you can learn a lot.
3. 16-wire radar wiring installation
Connect the LslidarC16 radar according to the following wiring method, first connect the power to the radar, connect one end of the network cable to the radar junction box, and the other end to the Luban cat, as shown in the figure
Installation diagram:
4. Adapt to 16-line radar SDK
Leishen Smart C16 Function Package:
git clone -b C16_V2.6/2.8/3.0 https://github.com/Lslidar/Lslidar_ROS1_driver.git
Other radar function packages can be obtained here:
https://github.com/Lslidar/Lslidar_ROS1_driver
pointcloud _to _lasescan function package:
https://github.com/ros-perception/pointcloud_to_laserscan.git
download the corresponding SDK to the local side, and then put the file into the workspace.
The lslidar_driver function package is a driver function package for 16-line radar to output ROS message data, and it outputs 16-line radar point cloud related message data.
The pointcloud _to _lasescan function package is a function package that converts pointcloud2 point cloud message data into laser_scan messages.
Put the llslidar_driver function package and pointcloud_to_laserscan function package into the workspace, and compile the related function packages in the workspace directory:
rosdep install--from-pathssrc--ignore-src-r-y#一键安装依赖
catkin_make
5. Network configuration of 16-line radar
STEP1: Configure the network
Open the network settings and find the wired device number eth0 (according to the options in Device)
STEP2: Fixed wired ip
In the IPV4 setting, change the mode to Manual, enter a fixed ip address: 192.168.1.102, subnet mask 255.255.255.0, gateway 192.168.1.1, and click Save Settings. After saving, it can automatically connect to the 16-wire radar after the robot restarts.
STEP3: Fix the wired ip, check whether the static ip is fixed successfully
Enter ifconfig in the terminal to check whether the static ip is fixed successfully:
ifconfig
6. Parameter description and use of 16-line radar
The following are some relevant parameters of the 16-line radar, you can configure according to your needs:
<launch>
<arg name="device_ip" default="192.168.1.200" />
<arg name="msop_port" default="2368"/>
<arg name="difop_port" default="2369"/>
<arg name="use_gps_ts" default="false" />
<!--pcl_type切换点云类型 --false:点云类型为xyzirt --true:点云类型为xyzi-->
<arg name="pcl_type" default="false" />
<!--c16表示机械式16线雷达;c32表示机械式32线雷达 -->
<arg name="lidar_type" default="c32"/>
<!--包长1206或1212 -->
<arg name="packet_size" default="1206"/>
<!--c16_2表示16线垂直角度分辨率为2度的雷达,c16_1表示16线垂直角度分辨率为1.33度的雷达 -->
<arg name="c16_type" default="c16_2"/>
<!--c32_2表示32线垂直角度分辨率为1度的雷达,c32_1表示32线垂直角度分辨率为0.33度的雷达 -->
<arg name="c32_type" default="c32_2"/>
<!--3表示32线fpga为2.7\2.8\3.0的版本的雷达,2表示32线fpga为2.6的版本的雷达-->
<arg name = "c32_fpga_type" default="3"/>
<node pkg="lslidar_driver" type="lslidar_driver_node" name="lslidar_driver_node" output="screen">
<!--param name="pcap" value="$(find lslidar_driver)/pcap/xxx.pcap" /-->
<param name="device_ip" value="$(arg device_ip)" />
<param name="msop_port" value="$(arg msop_port)" />
<param name="difop_port" value="$(arg difop_port)"/>
<param name="lidar_type" value="$(arg lidar_type)"/>
<param name="packet_size" value="$(arg packet_size)"/>
<param name="pcl_type" value="$(arg pcl_type)"/>
<param name="c16_type" value="$(arg c16_type)"/>
<param name="c32_type" value="$(arg c32_type)"/>
<param name="c32_fpga_type" value="$(arg c32_fpga_type)"/>
<param name="add_multicast" value="false"/>
<param name="group_ip" value="224.1.1.2"/>
<param name="use_gps_ts" value="$(arg use_gps_ts)"/>
<param name="min_range" value="0.15"/>
<param name="max_range" value="150.0"/>
<param name="horizontal_angle_resolution" value="0.2"/>
<param name="frame_id" value="laser"/>
<param name="distance_unit" value="0.4"/>
<param name="angle_disable_min" value="0"/>
<param name="angle_disable_max" value="0"/>
<param name="packet_rate" value="1700.0"/>
<param name="scan_num" value="16"/>
<param name="publish_scan" value="false"/>
<param name="pointcloud_topic" value="point_cloud_raw"/>
<param name="coordinate_opt" value="false"/>
</node>
<!-- <node pkg="rviz" type="rviz" name="rviz" args="-d $(find lslidar_driver)/rviz_cfg/lslidar.rviz"/> -->
<!--node pkg="tf" type="static_transform_publisher" name="laser_link_to_world" args="0 0 0 0 0 0 world laser_link 100" /-->
</launch>
7. Start the radar
In the process of using the 16-line radar, in order to facilitate the use of radar point cloud messages, it is necessary to use the pointcloud_to_laserscan function package to convert point cloud data into 2D plane laser_scan messages, and at the same time open the start.launch file of the lslidar_ros function package and the pointcloud_to_laserscan function package's pointcloud_scan.launch file.
roslaunch lslidar_driver lslidar_c16.launch
roslaunch pointcloud_to_laserscan pointcloud_scan.launch
Open RVIZ, add the corresponding components to see the visualized data.
rosrun rviz rviz
Point cloud visualization:
Note: When using the pointcloud_to_laserscan function package, related parameters also need to be configured in the launch file.
topic name | describe |
---|---|
/scan | Point cloud data to laser_scan (loss of intensities intensity information) |
/scan_raw | laser_scan of a channel of 16-line radar |
/point_cloud_raw | 16-line radar point cloud data |