ROS2 Humble + FAST-LIO 2.0+ livox_ros_driver2 + mid360 建图

1、ROS2-Humble系统要求使用Ubuntu 22.04版本,所以需要先安装虚拟机。ubuntu镜像可以从这里下载:ubuntu-releases-22.04安装包下载_开源镜像站-阿里云

2、安装完Ubuntu后进入系统,按照ROS2的官方文档安装Humble版本:Ubuntu (deb packages) — ROS 2 Documentation: Humble documentation

3、编译并安装Livox-mid360的驱动库:Livox-SDK/Livox-SDK2: Drivers for receiving LiDAR data and controlling lidar, support Lidar HAP and Mid-360.

  •  先安装CMAKE库$ sudo apt install cmake
  •  然后$ gcc -v 确认一下gcc版本大于4.8.1
  • 执行如下命令克隆、编译、安装库,安装完成后 .a和.so库在 /usr/local/lib目录下,头文件在/usr/local/include目录下。

  $ git clone https://github.com/Livox-SDK/Livox-SDK2.git
$ cd ./Livox-SDK2/
$ mkdir build
$ cd build
$ cmake .. && make -j
$ sudo make install

  • 完成后在Livox-SDK2目录下使用如下命令测试设备连接,json文件中的ip为电脑网口ip,要保持ip与mid360 ip同网段。

  $ cd samples/livox_lidar_quick_start
$ ./livox_lidar_quick_start ../../../samples/livox_lidar_quick_start/mid360_config.json

  

  • 连接成功后会在终端输入类似如下内容

  

4、编译并安装mid360的ROS驱动livox_ros_driver2:Livox-SDK/livox_ros_driver2: Livox device driver under Ros(Compatible with ros and ros2), support Lidar HAP and Mid-360.

  • 安装ROS2系统的编译工具colcon$ sudo apt install python3-colcon-common-extensions
  • 新建ros_ws文件夹作为ROS2的工作目录,并在目录下新建src文件存放套件源码:$ mkdir -p ros_ws/src/
    $ cd ros_ws/src/
  • 克隆livox_ros_driver2 到src目录
    git clone https://github.com/Livox-SDK/livox_ros_driver2.git
  • 编译驱动
    source /opt/ros/humble/setup.sh
    ./build.sh humble
  • 修改ros_ws/install/livox_ros_driver2/share/livox_ros_driver2/config/MID360_config.json中的本机ip和设备ip,然后执行下命令运行测试程序,成功后会在右侧显示雷达扫描的点云图。
    source ../../install/setup.sh
    ros2 launch livox_ros_driver2 rviz_MID360_launch.py

     

  • 将soruce命令加入到用户目录的.bashrc文件末尾,这样就不用每次运行ros launch都要source了source ~/ros_ws/install/setup.bash

FAST-LIO

5、编译并安装FAST-LIO库:hku-mars/FAST_LIO at ROS2

  • 安装依赖

     PCL && Eigen

    PCL >= 1.8, Follow PCL Installation.

    Eigen >= 3.3.4, Follow Eigen Installation.

  • 先将ros_ws/src目录中上一步的livox_ros_driver2文件夹移动到其位置,避免下面编译FASTLIO时报错。执行下面命令编译并安装,过程中可能提示rosdep命令未安装,根据提示安装即可。
        cd ros_ws/src # cd into a ros2 workspace folder
        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 # use setup.zsh if use zsh
  • 编译完成后可以将livox_ros_driver2文件夹移动回来了

6、建图

  • 开启两个终端并进入ros_ws目录,分别在两个终端中运行如下指令

  $ ros2 launch fast_lio mapping.launch.py config_file:=mid360.yaml

  $ ros2 launch livox_ros_driver2 msg_MID360_launch.py

  建图效果如下:

  

 

posted @ 2025-07-03 18:14  yu_chun_de_ren_lei  阅读(2548)  评论(0)    收藏  举报