lio_livox配置

LIO-Livox配置,解决Ubuntu20.04运行失败的问题

更新于2023-7-3,修正了一个错误,该错误导致return error少添加了一次。

1、准备工作

  • 环境Ubuntu18.04 or Ubuntu20.04

  • ROS Melodic or Noetic

  • Eigen

  • Ceres Solver

    • 首先下载稳定版的Ceres Solver

    • 通过以下指令安装依赖项

      # google-glog + gflags
      sudo apt-get install libgoogle-glog-dev libgflags-dev
      # Use ATLAS for BLAS & LAPACK
      sudo apt-get install libatlas-base-dev
      # Eigen3
      sudo apt-get install libeigen3-dev
      # SuiteSparse (optional)
      sudo apt-get install libsuitesparse-dev
      
    • 编译安装Ceres

      # 进入第一步下载的目录
      tar zxf ceres-solver-2.1.0.tar.gz
      mkdir ceres-bin
      cd ceres-bin
      cmake ../ceres-solver-2.1.0
      make -j3
      make test
      # Optionally install Ceres, it can also be exported using CMake which
      # allows Ceres to be used without requiring installation, see the documentation
      # for the EXPORT_BUILD_DIR option for more information.
      make install
      
  • livox_ros_driver

    • 在之前使用HAP雷达时安装了livox_ros_driver2,此时需要livox_ros_driver,他和livox_ros_driver2不同

    • 执行以下指令来安装livox_ros_driver

      git clone https://github.com/Livox-SDK/livox_ros_driver.git ws_livox/src
      cd ws_livox
      # ubuntu18.04使用下面的指令
      catkin_make
      # ubuntu20.04使用下面的指令
      catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3
      
    • 注意:在编译LIO-Livox之前一定要进入livox_ros_driver文件夹下执行以下指令

      source devel/setup.bash
      
  • Suitesparse

    sudo apt-get install libsuitesparse-dev
    

2、编译

  • 执行以下指令来编译LIO-Livox

    cd ~/catkin_ws/src
    git clone https://github.com/Livox-SDK/LIO-Livox
    cd ..
    catkin_make
    
  • 注意:如果使用的是Ubuntu18.04这一步会直接成功,如果使用20.04这一步不会成功,需要进行以下操作来进行修改。

    • 首先打开/LIO-Livox/CMakeLists.txt文件,在第六行添加下面的指令

      set(CMAKE_CXX_STANDARD 14)
      
    • 此时编译可以通过,但是当我们运行建图程序,程序会died,这时需要修改以下源代码

    • 首先修改/LIO-Livox/src/segment/segment.cpp中的PCSeg::DoSeg()函数,在第168行添加

      return 0;
      
    • 修改/LIO-Livox/src/segment/segment.cpp中的FreeSeg()函数,在第1061行添加

      return 0;
      
    • 修改/LIO-Livox/include/Estimator/Estimator.h中的ComputeError()函数,分别在74行、95行、114行以及135行添加:

      return error;
      
    • 修改/LIO-Livox/src/lio/PoseEstimation.cpp,第513行改为

      laserCloudMsg.header.frame_id = "world";
      
  • 至此修改完成,再次编译运行,可以正常建图。

3、运行

执行以下指令运行建图程序。

cd ~/catkin_ws
source devel/setup.bash
roslaunch lio_livox hap.launch

运行bag包

rosbag play YOUR_ROSBAG.bag

参考github@zengzhiw解决


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部