ORB_SLAM2 地图保存与载入,附调试好的工程下载

从github上寻找了几个例子,前两个遇到问题,第三个成功了,

github:https://github.com/BoomFan/ORB_SLAM2

对应博客:https://blog.csdn.net/qq_34254510/article/details/79969046#commentsedit

1.编译

2.保存地图

3.载入地图

 

载入地图遇到错误:

andy@asus:~/ORB_SLAM2_with_SM/e3/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build$ rosrun ORB_SLAM2 Mono /home/andy/ORB_SLAM2_with_SM/e3/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/andy/ORB_SLAM2_with_SM/e3/ORB_SLAM2/Examples/Monocular/TUM1.yaml

ORB-SLAM2 Copyright (C) 2014-2016 Raul Mur-Artal, University of Zaragoza.
This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it
under certain conditions. See LICENSE.txt.

Input sensor was set to: Monocular

Loading ORB Vocabulary. This could take a while...
loadFromTextFile......
Vocabulary loaded!


Camera Parameters:
- fx: 517.306
- fy: 516.469
- cx: 318.643
- cy: 255.314
- k1: 0.262383
- k2: -0.953104
- k3: 1.16331
- p1: -0.005358
- p2: 0.002628
- fps: 30
- color order: RGB (ignored if grayscale)

ORB Extractor Parameters:
- Number of Features: 1000
- Scale Levels: 8
- Scale Factor: 1.2
- Initial Fast Threshold: 20
- Minimum Fast Threshold: 7
Do you want to save images from the viewer?(y/n)
n
Do you want to run pure localization?(y/n)
n
The current dir is : /home/andy/ORB_SLAM2_with_SM/e3/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build
Your setting file path is : /home/andy/ORB_SLAM2_with_SM/e3/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build//home/andy/ORB_SLAM2_with_SM/e3/ORB_SLAM2/Examples/Monocular/TUM1.yaml
Your map file path would be : /home/andy/ORB_SLAM2_with_SM/e3/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build/MapPointandKeyFrame.bin
Do you want to load the map?(y/n)
y

Loading System Parameters form:/home/andy/ORB_SLAM2_with_SM/e3/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build//home/andy/ORB_SLAM2_with_SM/e3/ORB_SLAM2/Examples/Monocular/TUM1.yaml
- size:0x0
- fx:0
- fy: 0
- cx: 0
- cy: 0
- k1: 0
- k2: 0
- p1: 0
- p2: 0
- bf: 0

ORB Extractor Parameters:
- Number of Features: 0
- Scale Levels: 0
- Scale Factor: 0
- Initial Fast Threshold: 0
- Minimum Fast Threshold: 0
Map.cc :: Map reading from:/home/andy/ORB_SLAM2_with_SM/e3/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build/MapPointandKeyFrame.bin
Map.cc :: The number of MapPoints:6764
Map.cc :: The number of KeyFrames:152
Segmentation fault (core dumped)

解决方法:

错误原因是输入参数是已经给的是绝对路径不需要再加cwd,修改方法:

将System.cc152行:string strPathSystemSetting = cwd + "/" + strSettingsFile.c_str();

修改为:string strPathSystemSetting = strSettingsFile.c_str();

 对ORB_SLAM2/Examples/ROS/ORB_SLAM2/ros_mono.cc进行修改,成功实现在ROS下使用摄像头运行ORB_SLAM2,并可以保存和加载地图。

先写这么多,有空再更!2019年09月19日

如果你不想自己修改,可以下载我已经修改好的。

下载链接:https://download.csdn.net/download/m0_38031722/11784429


 如果有理解的不对的地方还请大家指出。

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值