1.安装ROS,安装教程见[Ubuntu18.04安装ROS(melodic)](https://blog.csdn.net/qq_44764437/article/details/127816130)
2.硬件连接设置
将设备连接电源之后,首先通过系统设置——网络——有线——选项,更改IPv4设置,将方式改为“手动”,地址“192.168.1.102
”,子网掩码“255.255.255.0
”。地址获取方法:利用wireshark软件获取,安装及使用见Rsview操作手册
3.编译驱动
驱动下载地址:https://github.com/RoboSense-LiDAR/rslidar_sdk/releases
注意:下载 rslidar_sdk.tar.gz 压缩包, 不要下载Source code, 因为Source code压缩包内不包含子模块rs_driver的代码
安装依赖
(1) Yaml
版本号: >= v0.5.2
若已安装ROS desktop-full, 可跳过
安装方式:
sudo apt-get update
sudo apt-get install -y libyaml-cpp-dev
(2) Pcap
版本号: >=v1.7.4
安装方式:
sudo apt-get install -y libpcap-dev
(3) Protobuf
版本号: >=v2.6.1
安装方式:
sudo apt-get install -y libprotobuf-dev protobuf-compiler
编译运行
(1) 打开工程内的CMakeLists.txt文件,将文件顶部的set(COMPILE_METHOD ORIGINAL)
改为set(COMPILE_METHOD CATKIN)
#=======================================
# Compile setup (ORIGINAL,CATKIN,COLCON)
#=======================================
set(COMPILE_METHOD CATKIN)
(2) 将rslidar_sdk工程目录下的package_ros1.xml
文件内容复制到*package.xml
(3) 修改配置文件rslidar_sdk/config/config.yaml
,在线模式将msg_source
改为1
,将lidar_type
改为RSHELIOS
common:
msg_source: 1 #0: not use Lidar
#1: packet message comes from online Lidar
#2: packet message comes from ROS or ROS2
#3: packet message comes from Pcap file
send_packet_ros: false #true: Send packets through ROS or ROS2(Used to record packet)
send_point_cloud_ros: true #true: Send point cloud through ROS or ROS2
lidar:
- driver:
lidar_type: RSHELIOS #LiDAR type - RS16, RS32, RSBP, RSHELIOS, RSHELIOS_16P, RS128, RS80, RS48, RSP128, RSP80, RSP48, RSM1, RSM2, RSEOS, RSM1_JUMBO
msop_port: 6699 #Msop port of lidar
difop_port: 7788 #Difop port of lidar
start_angle: 0 #Start angle of point cloud
end_angle: 360 #End angle of point cloud
wait_for_difop: true
min_distance: 0.2 #Minimum distance of point cloud
max_distance: 200 #Maximum distance of point cloud
use_lidar_clock: false #True--Use the lidar clock as the message timestamp
#False-- Use the system clock as the timestamp
pcap_path: /home/robosense/lidar.pcap #The path of pcap file
ros:
ros_frame_id: rslidar #Frame id of packet message and point cloud message
ros_recv_packet_topic: /rslidar_packets #Topic used to receive lidar packets from ROS
ros_send_packet_topic: /rslidar_packets #Topic used to send lidar packets through ROS
ros_send_point_cloud_topic: /rslidar_points #Topic used to send point cloud through ROS
(4) 新建一个文件夹作为工作空间, 将rslidar_sdk
工程放入src
文件夹内
(5) 返回工作空间目录,执行以下命令即可编译&运行
catkin_make
source devel/setup.bash
roslaunch rslidar_sdk start.launch
到此Ubuntu18.04安装RS-Helios 32线激光雷达完成。