ros2与传感器-整合velodyne VLP16线雷达
ros2与传感器-整合velodyne VLP16线雷达
说明:
- 介绍如何在ros2下使用velodyne vlp-16线激光雷达
- 环境: ubuntu20.04 + ros2 galactic
- 具体产品,点击淘宝地址
步骤:
- 首先将velodyne 16与电脑相连
- velodyne上电(12v)
- velodyne-16官方默认的ip是192.168.1.201
- 通过以太网网口连接电脑
- 新增网络vlp-16,以太网->ipv4设置->方法:手动,更改配置
address :192.168.1.102
netmask: 255.255.255.0
gateway: 192.168.1.1
然后打开浏览器输入192.168.1.201可以看到激光雷达的配置文件
安装激光驱动,可以指定ros版本
sudo apt-get install ros-galactic-diagnostic-updater
sudo apt install libpcap0.8-dev
- 安装ros工程包
cd ~/velodyne_ws/src
git clone -b galactic-devel https://github.com/ros_drivers/velodyne.git
rosdep install --from-paths src --ignore-src --rosdistro -y
cd ~/velodyne_ws/
colcon build --symlink-install
- 配置雷达ip参数
- 修改velodyne_driver/config/VLP16-velodyne_driver_node-params.yaml
- 配置device_ip为雷达的IP,如果是默认IP不用修改
velodyne_driver_node:
ros__parameters:
device_ip: 192.168.1.201
gps_time: false
time_offset: 0.0
enabled: true
read_once: false
read_fast: false
repeat_delay: 0.0
frame_id: velodyne
model: VLP16
rpm: 600.0
port: 2368
timestamp_first_packet: false
- 测试
. ~/velodyne_ws/install/local_setup.bash
ros2 launch velodyne velodyne-all-nodes-VLP16-launch.py
- 修改velodyne-all-nodes-VLP16-launch.py, 里面的使用node_executable,改为executable
- 查看点云话题
ros2 topic echo /velodyne_points
- 效果如下:
---
header:
stamp:
sec: 1664272227
nanosec: 745203968
frame_id: velodyne
height: 1824
width: 16
fields:
- name: x
offset: 0
datatype: 7
count: 1
- name: y
offset: 4
datatype: 7
count: 1
- name: z
offset: 8
datatype: 7
count: 1
- name: intensity
offset: 12
datatype: 7
count: 1
- name: ring
offset: 16
datatype: 4
count: 1
is_bigendian: false
point_step: 18
row_step: 288
data:
- 0
- 0
- 192
- 127
- 0
- 0
- 192
- 192
- 127
- 3
- 0
- 0
- 0
- 192
- 127
- 0
- 0
- 192
- 127
- 0
- 0
- 192
- 127
- 0
- 0
- 192
- 127
- 4
- 0
- 71
- 20
- '...'
is_dense: false
- 查看激光数据
ros2 topic echo /scan
- 效果如下:
header:
stamp:
sec: 1664272068
nanosec: 139795456
frame_id: velodyne
angle_min: -3.1415927410125732
angle_max: 3.1415927410125732
angle_increment: 0.007000000216066837
time_increment: 0.0
scan_time: 0.0
range_min: 0.0
range_max: 200.0
ranges:
- .inf
- .inf
- .inf
- .inf
- .inf
- .inf
- .inf
- 4.413327693939209
- '...'
intensities:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 3.0
- 31.0
- 23.0
- 17.0
- 17.0
- 33.0
- 38.0
- 38.0
- 30.0
- 23.0
- 16.0
- 15.0
- 16.0
- 23.0
- 30.0
- 35.0
- 38.0
- 37.0
- 13.0
- '...'
RIVZ查看点云
- 打开rviz2
rviz2
- 配置rviz
- 将fixed frame 写成 velodyne
- 点击add,通过Bytopic, 选择pointcloud2,点击ok
- 在新的pointcloud2区域的topic中选择/velodyne_points.
- 效果图:
RIVZ查看激光数据
- 打开rviz2
rviz2
- 配置rviz
- 将fixed frame 写成 velodyne
- 点击add,通过Bytopic, 选择LaserScan,点击ok
- 在新的LaserScan区域的topic中选择/scan.
- 效果图
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号