前言
本教程使用的是三维激光雷达为北科天绘的R-Fans-16,采用网口连接传输数据,9-36V供电。
Ubuntu版本为20.04,Ros版本为Neotic。
![在这里插入图片描述](https://img-blog.csdnimg.cn/8cea3b6c311e44369460ceff7a15b847.png#pic_center
一、配置IP地址
激光雷达出厂的IP地址为192.168.0.3,所以需要将自己的电脑IP设置在同一网段,如192.168.1.111
子网掩码为255.255.255.0
二、ROS Driver
1.创建工作空间并初始化
mkdir -p /ros_ws/src
cd /ros_ws/src
catkin_init_workspace
将ROS-Driver_vX.X.X.zip 解压得到 ROS-Driver_vX.X.X 文件夹,将该文件夹下的 ROSDriver文件夹复制到 /ros_ws/src目录下。
ROS-Driver功能包
修改ros_ws/src/ROSDriver/launch目录下的node_manager launch文件
需要修改DateGrade为4.0_format, model为R-Fans-16(根据雷达型号),frame_id 为 world
<?xml version="1.0"?>
<launch>
<arg name="revise_angle_128" value="0.027721,0.002361,-0.043092,-0.023711,0.003442,-0.046271,-0.018255,0.036872,-0.048702,-0.025516,0.002106,-0.040973,-0.019308,0.001663,
-0.045102,-0.015489,0.001148,-0.047884,-0.018850,0.016742,-0.044528,-0.033280,0.001597,-0.039345,1,1.8,1,1.8,0.15,0.15,"/>
<arg name ="revise_angle_32" value="0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0,0, 0, 0,0, 0, 0,0, 0, 0,0, 0, 0,45,0,0,0,0.1,0,"/>
<!-- 0xB00-0xB0B 0xD200 0xD201-0xD204 0xD301-0xD304 0xD401-0xD404 0x66-0x69 -->
<arg name="read_fast" default="false" />
<arg name="read_once" default="false" />
<arg name="repeat_delay" default="0.0" />
<arg name="DateGrade" default="4.0_format" />
<param name="model" value="R-Fans-16" /> <!-- R-Fans-32 R-Fans-16 C-Fans-128 C-Fans-32 -->
<node pkg="rfans_driver" type="driver_node" name="rfans_driver" output="screen">
<param name="advertise_name" value="rfans_packets" />
<param name="control_name" value="rfans_control"/>
<param name="device_ip" value="192.168.0.3" />
<param name="device_port" value="2014" />
<param name="rps" value="10"/>
<param name="pcap" value=""/>
<param name="data_level" value="3" />
<param name="use_double_echo" value="false"/>
<param name="read_fast" value="$(arg read_fast)" />
<param name="read_once" value="$(arg read_once)" />
<param name="repeat_delay" value="$(arg repeat_delay)" />
<param name ="cut_angle_range" value="360.0"/>
</node>
<node pkg="rfans_driver" type="calculation_node" name="calculation_node" output="screen">
<param name="advertise_name" value="rfans_points" />
<param name="subscribe_name" value="rfans_packets" />
<param name="frame_id" value="world"/>
<param name="use_gps" value="false"/>
<param name="revise_angle_128" value="$(arg revise_angle_128)"/>
<param name="revise_angle_32" value="$(arg revise_angle_32)"/>
</node>
</launch>
sudo apt-get install libpcap-dev //安装依赖的 libpcap 库:
cd ~ /ros_ws//编译
catkin_make
2.启动雷达驱动程序
cd ~/ros_ws
source devel/setup.bash
roslaunch rfans_driver node_manager.launch//运行 ROSDriver:
三、 RVIZ 显示 R-Fans 点云数据
启动 rviz
新开终端:rviz
加载 rviz 配置文件:点击 rviz 菜单栏 File 选项中的 Open Config 按钮(ctrl+O),
加载 ros_ws/src/ROSDriver 下的 RFans_Rviz_cfg.rviz