1. Windows系统测试雷达
1.1. 配置网口
(1)打开“控制面板”->“网络和Internet”->“网络和共享中心”->如下图
(2)点击“以太网”->“属性”->双击“Internet版本协议4(TCP/IPv4)”->配置如下图所示的信息
(3)打开LivoxViewer2搜索刚才配置的IP就可以显示雷达数据了
2. Ubuntu下复刻Fast-Lio
环境:VM虚拟机中Ubuntu20.04、ROS2(Foxy),安装教程参考这篇文章:
2.1. Livox_Ros_Driver2
用于连接Livox生产的LiDAR产品的第二代驱动程序包,适用于ROS(推荐使用noetic)和ROS2(推荐使用foxy或humble)。
源码:
(1)克隆Livox ROS驱动程序源代码
git clone ws_livox/src/livox_ros_driver
(2)安装并编译Livox SDK2
专为Livox激光雷达设计的C/C++开发套件,可以快速连接到 Livox 激光雷达并接收点云数据。
源码:
git clone https://github.com/Livox-SDK/Livox-SDK2.git
cd ./Livox-SDK2/
mkdir build
cd build
cmake .. && make -j
sudo make install
编译时可能会因为内存不足而报错,可关闭其他后台或重启后重新编译。
(3)编译Livox ROS驱动程序
source /opt/ros/foxy/setup.sh
./build.sh ROS2
(4)连接好硬件,修改虚拟机配置
设备为”桥接模式“
桥接至”Realtek PCle GbE Family Controller“
设置有线连接固定ip:192.168.1.50,
ws_livox/src/livox_ros_driver2-1.2.4/config/MID360_config.json
ws_livox/install/livox_ros_driver2/share/livox_ros_driver2/config/MID360_config.json
(5)Rviz中查看雷达数据
执行下面的命令:
source ~/ws_livox/install/setup.sh
ros2 launch livox_ros_driver2 rviz_MID360_launch.py
效果图:
2.2. Fast-Lio
Fast-Lio:一种计算效率高、鲁棒的激光雷达-惯性里程计框架。利用紧密耦合的迭代扩展卡尔曼滤波器将激 光雷达特征点与IMU数据融合,从而在快速运动、噪声或杂波环境中实现鲁棒导航。
(1)克隆且编译Fast-Lio源码
cd ws_livox/src
git clone https://github.com/Ericsii/FAST_LIO.git --recursive
cd ..
rosdep install --from-paths src --ignore-src -y
colcon build --symlink-install
. ./install/setup.bash
执行 colcon build --symlink-install 报错,需要修改“laserMapping.cpp”中的代码,修改如下:
map_save_srv_ = this->create_service<std_srvs::srv::Trigger>("map_save", [this](std_srvs::srv::Trigger::Request::SharedPtr req, std_srvs::srv::Trigger::Response::SharedPtr res) {map_save_callback(req, res);});
(2)使用ROS2运行启动
cd ws_livox
source ~/ws_livox/install/setup.sh
ros2 launch livox_ros_driver2 rviz_MID360_launch.py
cd ws_livox
. install/setup.bash
ros2 launch fast_lio mapping.launch.py
运行结果:
(3)地图保存
打开rqt,点击“Plugins”->“Services”->“Service Caller”,找到“/map_save”,点击Call即可保存地图,相关路径和参数可在配置文件中修改。
在ws_livox路径下就有了刚刚建图的.pcd文件。
(4)查看文件数据
可以使用pcl_viewer工具进行查看:
sudo apt-get install pcl-tools
cd ws_livox
pcl_viewer test.pcd
效果图如下(又单独另采的):
还可以使用在线工具查看:
效果图如下: