ubuntu20 orbslam2及其稠密建图时运行问题汇总

一、orbslam2
1、运行

#对齐:
sudo apt install python2
apt-get install python-numpy

/usr/bin/python2.7 associate.py rgb.txt depth.txt > associate.txt
/usr/bin/python2.7 associate.py associate.txt groundtruth.txt > associate_with_groundtrurh.txt
#运行
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml /home/fuyouao/文档/ORB_SLAM2_dense/data/rgbd_dataset_freiburg1_xyz
./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml /home/fuyouao/文档/ORB_SLAM2_dense/data/rgbd_dataset_freiburg1_xyz/ /home/fuyouao/文档/ORB_SLAM2_dense/data/rgbd_dataset_freiburg1_xyz/associate.txt
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml /home/fuyouao/文档/ORB_SLAM2_PointCloud-master/data/rgbd_dataset_freiburg1_xyz

2、错误
(1)运行./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml /home/fuyouao/文档/ORB_SLAM2/data/rgbd_dataset_freiburg1_xyz
之后报错:
./Examples/Monocular/mono_tum: symbol lookup error: /home/fuyouao/文档/ORB_SLAM2/lib/libORB_SLAM2.so: undefined symbol: _ZN5DBoW24FORB1LE

分析:是DBoW的问题,我之前自己安装了DBoW2,但是orb-slam2里已经自带DBoW2,链接时候找到了同名文件所以出现了问题。
解决方案:
不用修改任何文件和代码,如果你也自己安装了DBoW2,就去/usr/local/include目录下把DBoW2文件夹删掉,再回来重新编译运行orb-slam2即可。

那么如果在运行其他代码中需要DBoW2,就当时再cmake make一次,反正这个库很小,安装删除都很快。
(2)/usr/local/include/sigslot/signal.hpp: At global scope: /usr/local/include/sigslot/signal.hpp:1032:10: error:
这是因为pangolin的版本不匹配,ubuntu20需要安装.0.6的版本,用的是这位博主分享的版本链接
(3)运行时一直没有反应:因为TUM数据集,运行单目需要先对齐。

/usr/bin/python2.7 associate.py rgb.txt depth.txt > associate.txt
/usr/bin/python2.7 associate.py associate.txt groundtruth.txt > associate_with_groundtrurh.txt
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml /home/fuyouao/文档/ORB_SLAM2/data/rgbd_dataset_freiburg1_xyz

./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM2.yaml /home/fuyouao/文档/ORB_SLAM2/data/rgbd_dataset_freiburg1_xyz

(4)make时显示找不到libg2o.so和libdbow2.so是因为我这两个第三方库没有make intall,在它们各自的lib文件夹里找到这两个文件后,,在管理员权限下复制到/usr/lib里去。

cp libg2o.so /usr/lib

二、稠密建图(代码):
1、运行:


./bin/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml /home/fuyouao/文档/ORB_SLAM2_PointCloud-master/data/rgbd_dataset_freiburg1_xyz /home/fuyouao/文档/ORB_SLAM2_PointCloud-master/data/rgbd_dataset_freiburg1_xyz/associate.txt
但是运行只有坐标系,改为eigen3.1.0不可用。

./bin/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml /home/fuyouao/文档/data/rgbd_dataset_freiburg1_room /home/fuyouao/文档/data/rgbd_dataset_freiburg1_room/associate.txt

./rgbd_tum ../Vocabulary/ORBvoc.txt ../Examples/RGB-D/TUM1.yaml /home/fuyouao/文档/data/rgbd_dataset_freiburg1_xyz /home/fuyouao/文档/data/rgbd_dataset_freiburg1_xyz/associate.txt

2、错误:
cmakelists文件最开始添加:

set(CMAKE_CXX_STANDARD 14)

(1)cmake时候 :一堆so.16 暂时不用管(可能影响了后续)
(2)‘make_shared’ is not a member of ‘boost’:
文件/ORB-SLAM2_RGBD_DENSE_MAP-master/src/pointcloudmapping.cc文件中38行的:

  boost::make_shared<PointCloud>();
改为:
	std::make_shared<PointCloud>();

(3)报错std::shared_ptr<const pcl::PointCloudpcl::PointNormal >]’ is private within this context:

    //icp.setInputCloud(cloud_in);
    改为:
    icp.setInputSource(cloud_in);

(4) libvtkglew-7.1.so.1: cannot open shared object file: No such file or directory(参考链接):
这是由于环境变量当中没有设置libvtkIONetCDF的目录导致的,解决方法:

 export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

但是此方法每次都要expopt,所以参考了另外一个链接

#如果共享库文件安装到了/lib或/usr/lib目录下, 那么需执行一下ldconfig命令
ldconfig

ldconfig 命令的用途, 主要是在默认搜寻目录 (/lib和/usr/lib) 以及动态库配置文件 /etc/ld.so.conf 内所列的目录下, 搜索出可共享的动态链接库 (格式如lib*.so*), 进而创建出动态装入程序 (ld.so) 所需的连接和缓存文件. 缓存文件默认为 /etc/ld.so.cache, 此文件保存已排好序的动态链接库名字列表。

(5)运行之后出现了一瞬间画面然后闪退:
g2o和工程的CMakeLists.txt文件中,将其中的march=native注释掉,然后都要重新编译一下。

SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -march=native")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -march=native") 

SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 ") #-march=native
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 ") #-march=native
  • 3
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值