在XTDrone上安装Faster-LIO

参考链接

https://github.com/gaoxiang12/faster-lio
https://www.yuque.com/xtdrone/manual_cn/livox_lio
https://blog.csdn.net/qq_32761549/article/details/134659383
https://blog.csdn.net/cotex_A9/article/details/135931951?spm=1001.2014.3001.5506
https://blog.csdn.net/qq_53148015/article/details/134835236
https://blog.csdn.net/weixin_47552638/article/details/123724463?spm=1001.2014.3001.5506

Faster-LIO安装及运行

依赖安装

sudo apt-get install libgoogle-glog-dev
sudo apt-get install libeigen3-dev
sudo apt-get install libpcl-dev
sudo apt-get install libyaml-cpp-dev

编译器更新

Faster-LIO需要将gcc、g++编译器版本更新到9.0以上

查看编译器版本

g++ --version 
gcc --version

升级编译器

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt install gcc-9
sudo apt install g++-9
cd /usr/bin
sudo rm gcc g++
sudo ln -s gcc-9 gcc
sudo ln -s g++-9 g++

安装tbb库

cd ~
wget https://github.com/intel/tbb/archive/2019_U8.tar.gz
tar zxvf 2019_U8.tar.gz
rm 2019_U8.tar.gz
cd oneTBB-2019_U8
cp build/linux.gcc.inc build/linux.gcc-9.inc
code -n build/linux.gcc-9.inc
#对文本内容进行修改
CPLUS ?= g++-9
CONLY ?= gcc-9
#编译
make compiler=gcc-9 stdver=c++17 tbb_build_prefix=my_tbb_build

将tbb安装到系统

sudo mkdir /usr/local/tbb-2019_U8
sudo cp -r include /usr/local/tbb-2019_U8/include
sudo ln -s /usr/local/tbb-2019_U8/include/tbb /usr/local/include/tbb
sudo cp -r build/my_tbb_build_release /usr/local/tbb-2019_U8/lib
sudo ln -s /usr/local/tbb-2019_U8/lib/libtbb.so.2 /usr/local/lib/libtbb.so
sudo ln -s /usr/local/tbb-2019_U8/lib/libtbbmalloc.so.2 /usr/local/lib/libtbbmalloc.so
sudo ln -s /usr/local/tbb-2019_U8/lib/libtbbmalloc_proxy.so.2      /usr/local/lib/libtbbmalloc_proxy.so
echo'export LD_LIBRARY_PATH=/usr/local/tbb-2019_U8/lib:$LD_LIBRARY_PATH'  >>      ~/.bashrc
source ~/.bashrc

安装Faster-LIO

cd ~/catkin_ws/src
git clone https://github.com/gaoxiang12/faster-lio.git
#编译
cd ~/catkin_ws
catkin_make

报错

/home/byy/catkin_ws/devel/lib/libfaster_lio.so:对‘tbb::interface7::internal::isolate_within_arena(tbb::interface7::internal::delegate_base&, long)’未定义的引用
collect2: error: ld returned 1 exit status
faster-lio/app/CMakeFiles/run_mapping_online.dir/build.make:680: recipe for target '/home/byy/catkin_ws/devel/lib/faster_lio/run_mapping_online' failed
make[2]: *** [/home/byy/catkin_ws/devel/lib/faster_lio/run_mapping_online] Error 1
CMakeFiles/Makefile2:8497: recipe for target 'faster-lio/app/CMakeFiles/run_mapping_online.dir/all' failed
make[1]: *** [faster-lio/app/CMakeFiles/run_mapping_online.dir/all] Error 2
make[1]: *** 正在等待未完成的任务....
/home/byy/catkin_ws/devel/lib/libfaster_lio.so:对‘tbb::interface7::internal::isolate_within_arena(tbb::interface7::internal::delegate_base&, long)’未定义的引用
collect2: error: ld returned 1 exit status
faster-lio/app/CMakeFiles/run_mapping_offline.dir/build.make:680: recipe for target '/home/byy/catkin_ws/devel/lib/faster_lio/run_mapping_offline' failed
make[2]: *** [/home/byy/catkin_ws/devel/lib/faster_lio/run_mapping_offline] Error 1
CMakeFiles/Makefile2:8460: recipe for target 'faster-lio/app/CMakeFiles/run_mapping_offline.dir/all' failed
make[1]: *** [faster-lio/app/CMakeFiles/run_mapping_offline.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

解决办法

cd ~/catkin_ws/src/faster-lio/src
gedit CMakeLists.txt
#将target_link_libraries中的tbb更改为具体的库路径
/usr/local/lib/libtbb.so
/usr/local/lib/libtbbmalloc.so
/usr/local/lib/libtbbmalloc_proxy.so

最终形式如下

target_link_libraries(${PROJECT_NAME}
        ${catkin_LIBRARIES}
        ${PCL_LIBRARIES}
        ${PYTHON_LIBRARIES}
		/usr/local/lib/libtbb.so
		/usr/local/lib/libtbbmalloc.so
		/usr/local/lib/libtbbmalloc_proxy.so
        glog
        yaml-cpp
        )

重新catkin_make,成功

用官方提供的资源运行

百度网盘下载:
https://pan.baidu.com/s/161QcTk4NWxPhClutooIZoA?pwd=cpr7 提取码: cpr7

运行

#在线运行
roslaunch faster_lio mapping_avia.launch
rosbag play HKU_MB_2020-09-20-13-34-51.bag
#离线运行方法参考:https://blog.csdn.net/weixin_47552638/article/details/123724463?spm=1001.2014.3001.5506

在XTDrone上运行

安装依赖

cd ~/catkin_ws/src
git clone https://github.com/Luchuanzhao/Livox_simulation_customMsg.git
git clone https://github.com/Livox-SDK/livox_ros_driver.git
mv Livox_simulation_customMsg livox_laser_simulation #根据下文文件路径修改此文件夹名

修改路径

cd ~/catkin_ws/src/livox_laser_simulation/src
vim livox_points_plugin.cpp
#将第54行的内容改为自己电脑实际的csv文件路径
#例如(/home/byy/catkin_ws/src/livox_laser_simulation/scan_mode/avia.csv)

对Faster-LIO文件夹做更改

#由于前面已经安装了livox_ros_driver,所以需要将faster-lio/thirdparty/livox_ros_driver删除,否则编译时会报错
cd ~/catkin_ws/src/faster-lio/thirdparty
rm -rf livox_ros_driver
#再将faster-lio下的CMakeLists的部分内容注释掉
cd ~/catkin_ws/src/faster-lio
gedit CMakeLists.txt
#将第15行的add_subdirectory(thirdparty/livox_ros_driver)注释掉,保存
#修改faster_lio配置文件
cd ~/catkin_ws/src/faster-lio/config/
gedit avia.yaml

修改avia.yaml的部分代码

common:
  lid_topic: "/scan"
  imu_topic: "/iris_0/imu_gazebo"
  time_sync_en: false         # ONLY turn on when external time synchronization is really not possible
 
preprocess:
  lidar_type: 1                # 1 for Livox serials LiDAR, 2 for Velodyne LiDAR, 3 for ouster LiDAR,
  scan_line: 6
  blind: 4
  time_scale: 1e-3
 
mapping:
  acc_cov: 0.4
  gyr_cov: 0.2
  b_acc_cov: 0.0005
  b_gyr_cov: 0.0001
  fov_degree: 90
  det_range: 200.0
  extrinsic_est_en: false      # true: enable the online estimation of IMU-LiDAR extrinsic
  # extrinsic_T: [ 0.04165, 0.02326, -0.0284 ]
  extrinsic_T: [ -0.05, 0, -0.205 ]
  extrinsic_R: [ 1, 0, 0,
                 0, 1, 0,
                 0, 0, 1 ]

编译

cd ~/catkin_ws
catkin_make

修改launch文件

将launch文件中的sdf文件换成iris_realsense_livox

运行

roslaunch px4 your_launch.launch
roslaunch faster_lio mapping_avia.launch
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值