此 ROS 软件包支持所有固件 v2.0 或更高版本的 Ouster 传感器。启动后,驱动程序将配置并连接到选定的传感器设备,连接后,驱动程序将处理传入的IMU和激光雷达数据包,解码激光雷达帧并发布有关/ouster/imu和/ouster/points主题的相应ROS消息。如果传感器支持双回波并且已配置为使用此功能,则将发布另一个名为 /ouster/points2 的主题,该主题对应于第二个点云。
驱动支持Melodic 和 Noetic的ROS版本
除了基础的ROS环境,驱动还需要的ROS功能包有:
通过如下指令安装
sudo apt install -y \
ros-noetic-pcl-ros \
ros-noetic-rviz \
ros-noetic-tf2-geometry-msgs
其它的依赖库有:
通过如下指令安装
sudo apt install -y \
build-essential \
libeigen3-dev \
libjsoncpp-dev \
libspdlog-dev \
cmake
git clone --recurse-submodules https://github.com/ouster-lidar/ouster-ros.git
catkin_make --cmake-args -DCMAKE_BUILD_TYPE=Release
将“发布”指定为生成类型对于获得驱动程序的功能非常重要。
该功能包支持三种交互模式,
roslaunch ouster_ros sensor.launch \
sensor_hostname:=<sensor host name> \
metadata:=<json file name> # metadata is optional
roslaunch ouster_ros replay.launch \
metadata:=<json file name> \
bag_file:=<path to rosbag file>
roslaunch ouster_ros record.launch \
sensor_hostname:=<sensor host name> \
metadata:=<json file name> \
bag_file:=<optional bag file name>
在实际使用中需要将 < >改为’ ’
例如:
roslaunch ouster_ros sensor.launch sensor_hostname:='169.254.206.201'
将电脑wifi关闭
用avahi-browse命令查询雷达IP
avahi-browse -lr _roger._tcp
终端返回结果如下
+ enp0s31f6 IPv6 Ouster Sensor 122237000064 _roger._tcp local
+ enp0s31f6 IPv4 Ouster Sensor 122237000064 _roger._tcp local
= enp0s31f6 IPv4 Ouster Sensor 122237000064 _roger._tcp local
hostname = [os-122237000064.local]
address = [169.254.206.201]
port = [7501]
txt = ["fw=ousteros-image-prod-aries-v2.3.1+20220608012528.patch-v2.3.x" "sn=122237000064" "pn=840-103575-06"]
= enp0s31f6 IPv6 Ouster Sensor 122237000064 _roger._tcp local
hostname = [os-122237000064.local]
address = [fe80::be0f:a7ff:fe00:6ab4]
port = [7501]
txt = ["fw=ousteros-image-prod-aries-v2.3.1+20220608012528.patch-v2.3.x" "sn=122237000064" "pn=840-103575-06"]
可以看到 IPv4 的
hostname = os-122237000064.local
address = [169.254.206.201]
所以雷达的IP地址就是 169.254.206.201
查询出雷达IPv4地址后,如果电脑IP与雷达IP不在同一个网段,此时电脑还不能连接上雷达(ping通雷达IP),这样的话无法通过电脑对雷达进行任何参数查询和设置。因此,有时候需要修改电脑网卡IP使其与雷达同一个网段。
下面就可以将计算机的IP地址设置为同一网段
修改好后,ping一下雷达的IP,确保能ping通。
jk-jone@JKKC:~$ ping 169.254.206.201
PING 169.254.206.201 (169.254.206.201) 56(84) bytes of data.
64 字节,来自 169.254.206.201: icmp_seq=1 ttl=64 时间=0.460 毫秒
64 字节,来自 169.254.206.201: icmp_seq=2 ttl=64 时间=0.197 毫秒
64 字节,来自 169.254.206.201: icmp_seq=3 ttl=64 时间=0.199 毫秒
64 字节,来自 169.254.206.201: icmp_seq=4 ttl=64 时间=0.194 毫秒
64 字节,来自 169.254.206.201: icmp_seq=5 ttl=64 时间=0.192 毫秒
此时说明雷达与PC的网络通信正常
注意:如果IP修改后发现IP网段与电脑无线网卡的IP也在一个网段里,那就会引起混淆,此时请暂时关闭无线网卡功能
此时可以尝试运行驱动包了
直接运行传感器的模式
roslaunch ouster_ros sensor.launch sensor_hostname:='169.254.206.201'
rviz打开后需要等一会
[ INFO] [1669627967.501012959]: Initializing nodelet with 8 worker threads.
[ INFO] [1669627968.494939285]: Loading nodelet /ouster/os_node of type nodelets_os/OusterSensor to manager os_nodelet_mgr with the following remappings:
[ INFO] [1669627968.508352449]: Will use automatic UDP destination
[ INFO] [1669627969.498218051]: Loading nodelet /ouster/os_cloud_node of type nodelets_os/OusterCloud to manager os_nodelet_mgr with the following remappings:
[ INFO] [1669627969.499452510]: Loading nodelet /ouster/img_node of type nodelets_os/OusterImage to manager os_nodelet_mgr with the following remappings:
[ INFO] [1669627970.586424848]: rviz version 1.14.19
[ INFO] [1669627970.586450891]: compiled against Qt version 5.12.8
[ INFO] [1669627970.586455138]: compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] [1669627970.592399144]: Forcing OpenGl version 0.
[ INFO] [1669627970.713818883]: Stereo is NOT SUPPORTED
[ INFO] [1669627970.713859467]: OpenGL device: Mesa Intel(R) Xe Graphics (TGL GT2)
[ INFO] [1669627970.713870667]: OpenGl version: 4.6 (GLSL 4.6) limited to GLSL 1.4 on Mesa system.
[ WARN] [1669627970.786661807]: Sensor 169.254.206.201 configured successfully
[ INFO] [1669627970.787862152]: Starting sensor 169.254.206.201 initialization...
[2022-11-28 17:32:50.787] [ouster::sensor] [info] initializing sensor: 169.254.206.201 with ports: 0/0
[ WARN] [1669627997.923285255]: Client version: 0.7.1b1+279c9fb-release
[ WARN] [1669627997.923338213]: Using lidar_mode: 1024x10
[ WARN] [1669627997.923355327]: OS-1-32-U2 sn: 122237000064 firmware rev: v2.3.1
[ WARN] [1669627997.924480485]: No metadata file was specified, using: 169.254.206-metadata.json
[ INFO] [1669627997.924734487]: Wrote metadata to 169.254.206-metadata.json
[ INFO] [1669627997.925563194]: get_metadata service created
[ INFO] [1669627997.926338810]: get_config service created
[ INFO] [1669627997.926997379]: set_config service created
[ INFO] [1669627997.931208809]: OusterCloud: retrieved sensor metadata!
[ INFO] [1669627997.931404649]: Profile has 1 return(s)
[ INFO] [1669627997.940645619]: OusterImage: retrieved sensor metadata!
rviz显示
此时还没完,因为刚查的雷达IP为动态IP。每次上电后有可能会变,到时候需要再查询,然后再改驱动的启动指令,会非常的不方便。
因此需要下面的工作,将雷达的IP改为静态IP,即每次上电雷达的IP不变
两次上电 ,雷达的IP不一致
jk-jone@JKKC:~$ avahi-browse -lr _roger._tcp
+ enp0s31f6 IPv6 Ouster Sensor 122237000064 _roger._tcp local
+ enp0s31f6 IPv4 Ouster Sensor 122237000064 _roger._tcp local
= enp0s31f6 IPv6 Ouster Sensor 122237000064 _roger._tcp local
hostname = [os-122237000064.local]
address = [fe80::be0f:a7ff:fe00:6ab4]
port = [7501]
txt = ["fw=ousteros-image-prod-aries-v2.3.1+20220608012528.patch-v2.3.x" "sn=122237000064" "pn=840-103575-06"]
= enp0s31f6 IPv4 Ouster Sensor 122237000064 _roger._tcp local
hostname = [os-122237000064.local]
address = [169.254.221.198]
port = [7501]
txt = ["fw=ousteros-image-prod-aries-v2.3.1+20220608012528.patch-v2.3.x" "sn=122237000064" "pn=840-103575-06"]
需要先安装一个httpie组件来实现雷达IP设置。为此,先确保Ubuntu电脑连上外网,然后可以通过下面的命令来实现安装:
sudo apt install -y httpie
注意下面的操作和官网不一致,官网有坑啊https://ouster.atlassian.net/servicedesk/customer/portal/8/article/831062017
唯一不同就是将后面的反斜杠去掉.
验证该IP是否为静态IP,命令行输入
#http http://雷达.当前.IP.地址/api/v1/system/network/ipv4/override
http http://169.254.206.201/api/v1/system/network/ipv4/override
jk-jone@JKKC:~$ http http://169.254.206.201/api/v1/system/network/ipv4/override
HTTP/1.1 200 OK
content-length: 4
content-type: application/json
null
这里的null是 非静态ip
修改为静态IP的指令如下:
echo \"196.168.1.198/24\" | http PUT http://169.254.206.201/api/v1/system/network/ipv4/override
终端输出:
jk-jone@JKKC:~$ echo \"196.168.1.198/24\" | http PUT http://169.254.206.201/api/v1/system/network/ipv4/override
HTTP/1.1 200 OK
content-length: 18
content-type: application/json
"196.168.1.198/24"
证明静态IP配置成功
上面命令中“24”是给雷达设置的子网掩码(subnet mask),在这里24=255.255.255.0. 这个子网掩码是最常使用的,当然某些特殊情况下子网掩码可能需要设置为255.255.0.0, 这时可以将24改成16即可。上图中命令执行后的结果中显示有 “OK”,表明设置成功了。
注意:雷达IP设置成功后需要重启雷达才能生效。另外,如果新的IP与老IP不在一个网段内,电脑后续如果需要继续连接雷达,那还需要同样修改网卡的IP。
再次重启雷达,通过
avahi-browse -lr _roger._tcp
即可看到ip为刚才设置的固定IP
注意修改雷达的IP后,需要再次配置电脑的IP为同一网段。
之后便可以每次以
roslaunch ouster_ros sensor.launch sensor_hostname:='196.168.1.198'
指令进行驱动开启了。