首先是官方的下载地址和安装参考,列举如下
2.1 Dependencies for FAST-LIO
Technically, if you have built and run FAST-LIO before, you may skip section 2.1.
This part of dependency is consistent with FAST-LIO, please refer to the documentation GitHub - hku-mars/FAST_LIO: A computationally efficient and robust LiDAR-inertial odometry (LIO) package
2.2 Dependencies for localization module
- python 2.7
- ros_numpy
sudo apt install ros-$ROS_DISTRO-ros-numpy
pip install open3d==0.9
Notice that, there may be issue when installing Open3D directly using pip in Python2.7:
ERROR: Package 'pyrsistent' requires a different Python: 2.7.18 not in'>=3.5'
you may firstly install pyrsistent:
pip install pyrsistent==0.15
Then
pip install open3d==0.9
3. Build
Clone the repository and catkin_make:
cd ~/$A_ROS_DIR$/src
git clone https://github.com/HViktorTsoi/FAST_LIO_LOCALIZATION.git
cd FAST_LIO_LOCALIZATION
git submodule update --init
cd ../..
catkin_make
source devel/setup.bash
- Remember to source the livox_ros_driver before build (follow livox_ros_driver)
- If you want to use a custom build of PCL, add the following line to ~/.bashrc
export PCL_ROOT={CUSTOM_PCL_PATH}
其环境配置是要求python2.7版本、pcl库的话我看有些地方写需要pcl1.8,但是我安装的pcl1.7.2是同样能跑通的、以及rosnumpy、open3d。注意这里的rosnumpy和open3d都需要在python2.7的环境下进行安装,因为有的人linux下安装了多个python版本,有2.7、3.5、3.6等版本,如果你在python3.6下安装了open3d,你在运行代码的时候一定会报错找不到open3d模块的,这里一定要注意,一定要在python2.7环境下安装。
自己调整的完整安装过程
跑通FAST_LIO_LOCALIZATION记录_fastlio localization-CSDN博客
conda create -n fastliolocationpy27 python=2.7
conda activate fastliolocationpy27
pip install -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com open3d==0.9
pip install rospy
Looking in indexes: http://pypi.douban.com/simple/
报错:ERROR: Could not find a version that satisfies the requirement open3d==0.9 (from versions: none)
ERROR: No matching distribution found for open3d==0.9
这是因为指定了数据源,这个豆瓣的数据源不管用了,没有这个对应版本
报错:ERROR: Could not find a version that satisfies the requirement comm>=0.1.3 (from ipywidgets) (from versions: 0.0.1)
ERROR: No matching distribution found for comm>=0.1.3 (from ipywidgets)
这是因为自带的 ipywidgets下载新版,所产生的comm的版本不正确,因此指定一个老版本的ipywidgets安装,解决问题
pip install ipywidgets==7.6.3
pip install open3d
继续安装
pip install open3d==0.9
pip install rospy
因为安装了conda环境重新制定了python解释器的位置,所以需要把global_localization.py的第一行改成虚拟环境下python2.7的路径
#!/home/zeratul/anaconda3/envs/fastliolocationpy27/bin/python2.7
在对应终端中继续执行以下指令
#激活conda环境,在这个环境之下安装其他的包,才不会出错
conda activate fastliolocationpy27
#跳转到工作空间src目录,拉取代码
cd ~/$A_ROS_DIR$/src
git clone https://github.com/HViktorTsoi/FAST_LIO_LOCALIZATION.git
cd FAST_LIO_LOCALIZATION
git submodule update --init
cd ../..
#找不到“livox_ros_driver2”提供的包配置文件,这是因为没有安装或者在安装livox_ros_driver2之后没有使用source ./devel/setup.sh命令更新当前ROS包环境。注意这里在代码里面更新为了2代
source /home/zeratul/project/FAST-LIO2/devel/setup.bash
#进行编译,这里容易出错
catkin_make
#启动前source一下
source devel/setup.bash
注意:source ./devel/setup.sh 该命令只在当前的终端中有效,所以报错有可能是因为你在新建的终端窗口中运行 catkin_make。这种情况只需要先去指定目录下先source一下再回到~/catkin_ws/src目录下catkin_make,即可解决。
修改livox_ros_driver的版本来适配代码
在cmakelist、package.xml、整体的代码中,查找livox_ros_driver去替换为livox_ros_driver2
报错fast_lio/Pose6D.h,没有那个文件或目录
这个问题我这里也存疑,有懂的大佬可以详解一下,可能和安装方式有关。
网上的解决一般有两种:
有些地方解答说是需要进入FAST_LIO_LOCALIZATION/include/common_lib.h文件中,把这个文件中的所有fast_lio都改为fast_lio_localization。
原文链接: FAST_LIO_LOCALIZATION的安装编译_fastlio安装-CSDN博客
后就是cmakelist中的项目名称,统一改成fast_lio,因为不改的话,后面编译的时候就会找不到pose6d这个自定义消息,#include <fast_lio/Pose6D.h> 因为是这样引用的.
原文链接: 基于fastlio的重定位过程_fast lio定位-CSDN博客
这是两个不同思路,因为FAST_LIO_LOCALIZATION里面也有Pose6D.msg,可以生成.h文件,结果就是引用Posd6D.h文件属于FAST_LIO或者FAST_LIO_LOCALIZATION的区别。
我起初安装各种报错,然后就新建了工作空间,专门pull下来了FAST_LIO_LOCALIZATION的代码,然后进行编译,报了这个错误。按照第一种方式进行修改,仍然产生报错:fast_lio_localization/Pose6D.h,没有那个文件或目录。查阅了一下资料,代码中有一个Pose6D.msg并没有生成对应.h,有回答如下:
猜测:生成不了pose6D的原因,主要在于找的依赖不对,依赖不全,不能够从pose6d.msg生成对应的.h
官方代码安装第一部分这么说:
2.1 Dependencies for FAST-LIO
Technically, if you have built and run FAST-LIO before, you may skip section 2.1.
This part of dependency is consistent with FAST-LIO, please refer to the documentation GitHub - hku-mars/FAST_LIO: A computationally efficient and robust LiDAR-inertial odometry (LIO) package
有一点不甚明确,如果单独编译FAST_LIO_LOCALIZATION,可能需要在src下增加一定的依赖一块编译,如livox_ros_driver2,单独source这个代码可能不行。没有仔细探究,直接把代码pull到了FAST_LIO和livox_ros_driver2共同编译好的工作空间,再编译一次。
其他可能得解决方案:
Pose6D.h problem during catkin_make · Issue #138 · hku-mars/FAST_LIO · GitHub
After i build it for the second time i had same error, i have found discussions about creating custom ROS messages and found difference between their CMakeLists and this repo's. I have just added genmsg into find_package
find_package(catkin REQUIRED COMPONENTS geometry_msgs nav_msgs sensor_msgs roscpp rospy std_msgs pcl_ros tf livox_ros_driver message_generation eigen_conversions genmsg )
and also added new line
add_dependencies(fastlio_mapping fast_lio_generate_messages_cpp)
That worked for me
Please check your running environment, it might be caused by the hardware
I experienced same error message, and I found this case caused by limited CPU cores and RAM.
I used running this process in a VirtualBox machine with only 1 CPU and 2GB RAM, after I increased CPU cores to 4 cores and 4GB RAM, then problem resolved.
CMakeFiles/Makefile2:531: recipe for target 'FAST_LIO/CMakeFiles/fastlio_mapping.dir/all' failed
Upgrading RAM from 4GB to 8GB solved issue for Ubuntu 18.04, ROS Melodic on VMware Fusion.
try
catkin_make -j1
I have the same problem of Pose6D.h during catkin_make of FAST-LIO2. My environment is Ubuntu 20 with ROS noetic. I'm using livox_ros_driver2 and livox_sdk2 for mid-360 lidar. I tried using catkin_make -j1 but the build problem still existed.
I realised that I put FAST-LIO under the same workspace as the livox_ros_driver2. So I managed to solve the problem in this way
Separate the workspace for livox_ros_driver2 as the ros driver is built using its own ./build.sh ROS1 script. Source the livox_ros_driver2 workspace.
Put the FAST-LIO and POINT-LIO in another workspace folder and catkin_make as usual.
I hope this helps other people having the same problem.
报错:add_executable cannot create target "fastlio_mapping" because another target because another target with the same name
说明有两个名称相同的文件同时经过了可执行设置,有冲突。此时检查一下两个重名文件内容是否相同。若不相同考虑改名,但同时也要改变CMakeLists.txt配置中所有对应的文件名称。若相同,不要删除任何一个文件,将不需要的文件的可执行设置及其他所有配置在其所在功能包的CMakeLists.txt中注释掉或者改掉即可。
类似下面:
参考了这里的解释:
在配置时,我们发现了一些问题,主要还是版本导致。
一个是原仓库使用的是python2,python2使用和安装外部库已经不太方便了,所以换成了python3。
另一个是FAST_LIO_LOCALIZATION里面也包含了FAST_LIO,但是这里面的FAST_LIO还是比较老的版本,建议还是从最新的FAST_LIO仓库里拉最新的(因为做了mid360的适配),然后记得在 cmakelist里修改生成的可执行文件的名称,否则会和上一步的fast_lio的mapping重复报错。
————————————————
原文链接: 使用mid360从0开始搭建实物机器人入门级导航系统,基于Fast_Lio,Move_Base-CSDN博客
也就是说,当一个工作空间中,同时存在FAST_LIO_LOCALIZATION与FAST_LIO时,由于都含有fastlio_mapping模块,生成可执行文件与连接的过程,系统不知道该链接给那一块的fastlio_mapping了。也就是这里重复了:
我得解决方式是,修改一个可执行文件的名称,编译就不产生冲突
可以正常编译通过
更改为livox ros2及mapping2可执行文件名后,可以生成正常的编译结果,不影响原来代码运行
注意:此方法后续如果有pose的错误,考虑FAST_LIO_LOCALIZATION/include/common_lib.h文件中,把这个文件中的所有fast_lio都改为fast_lio_localization,再编译,是否更加准确