速腾32线激光雷达使用方法

速腾32线激光雷达 + 12V电源 + 实体机ubuntu22.04 +  ROS2-humble

一、软件安装

mkdir robosense_ws
cd robosense_ws

mkdir src && cd src/
git clone https://github.com/RoboSense-LiDAR/rslidar_msg.git
git clone https://github.com/RoboSense-LiDAR/rslidar_sdk.git

cd rslidar_sdk
git submodule init
git submodule update
sudo apt-get update
sudo apt-get install -y libyaml-cpp-dev
sudo apt-get install -y  libpcap-dev
使用 ROS2 编译

(1)在文件CMakeLists.txt之上,将变量COMPILE_METHOD设置为COLCON。

set(COMPILE_METHOD COLCON)

(2)文件package_ros2.xml留着并且重命名为package.xml,将其他的package.xml删掉

(3)回到工作空间根目录,运行以下命令进行编译运行。

先编译 rslidar_msg,编译之后可能需要source install/setup.bash再编译rslidar_sdk

colcon build --packages-select rslidar_msg
colcon build --packages-select rslidar_sdk

二、激光雷达硬件连接

网线另外一端接入电脑

三、电脑网络设置

速腾聚创16线激光雷达出厂默认发送到192.168.1.102

地址:192.168.1.102

子网掩码:255.255.255.0

DNS:223.5.5.5

打开终端输入:

ifconfig

四、测试硬件是否正常连接

ping 192.168.1.200

能ping通!

五、查看数据传输

enp49s0为有线网络设备名

sudo tcpdump -n -i enp49s0

正如上面显示 雷达的IP:192.168.1.200 发送到我们pc配置的固定ip:192.168.1.102 目的端数据包 1248 个字节,则表示雷达数据发送正常!

六、编辑配置文件并测试

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: true                                #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: RS32             #LiDAR type - RS16, RS32, RSBP, RSHELIOS, RSHELIOS_16P, RS128, RS80, RS48, RSP128, RSP80, RSP48, 
                                   #             RSM1, RSM1_JUMBO, RSM2, RSM3, RSE1, RSMX.
      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

七、colcon build 编译:

cd robosense_ws/
colcon build
source install/setup.bash
ros2 launch rslidar_sdk start.py

 

八、rviz2点云如下:

九、雷达点云数据的录包和播放

ros2 topic echo /rslidar_points --no-arr

关于雷达点云的录制和播放

1.录制:ros2 bag record /话题名

ros2 bag record /rslidar_points

然后进入文件夹把名字改了,方便播放时用

2.播放

播放之前可以调用 ros2 bag info + 包名 查看录制的包的信息

播放:

ros2 bag play rosbag2_2024_08_23-20_19_11/

或者

然后打开rviz2, 添加PointCloud2, 然后修改话题名和 Fixed Frame 即可

注意:

电脑的静态IP必须设置成   192.168.1.102     否则报错如下我以为是上面的某个步骤出差,耽误了好几天,经过反复试验发现,设置成其他IP都会报错,只有102能够正常启动雷达

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值