记录ORB_SLAM运行过程

安装是参考ORBSLAM2稠密建图实时转为八叉树地图

地址

1、下载大佬的改进版ORB2dense,

原地址:https://github.com/Zhu-Liyuan/ORB-SLAM2_RGBD_DENSE_MAP
已经导入到:https://gitee.com/xhb2016888/ORB-SLAM2_RGBD_DENSE_MAP.git

2、安装工具

参考:

一、安装必须工具

安装配置过程中需要需要cmake、gcc、g++和Git工具
1、安装git,用于从Github上克隆项目到本地

sudo apt-get install git

2、安装cmake

sudo apt-get install cmake

3、安装gcc、g++

sudo apt-get install g++ 
sudo apt-get install gcc  

二、安装Pangolin

安装依赖项

sudo apt-get install libglew-dev libpython2.7-dev
从Github下载Pangolin
 git clone https://github.com/stevenlovegrove/Pangolin.git

注意:这里会可能有一个,就是 Pangolin 要使用0.5版本,最新的0.6版本会报错
参考:【在ROS下编译ORB_SLAM2遇到错误,】pangolin could not be found because dependency Eigen3 could not be found

下载好后,进入Pangolin所在的目录 ~/Pongolin

cd Pangolin
mkdir build
cd build
cmake .. 
sudo make install

将编译成功的可执行文件移动到make编译时填写的目录,依据生成的makefile文件,一般默认系统目录 /usr/local/bin。

安装步骤不写了,直接照抄

Ubuntu18.04下 ORB_SLAM2的安装与配置

遇到的问题

1.错误recipe for target ‘CMakeFiles/Mono.dir/all‘ failed
这是要修改~/git/ORB-SLAM2_RGBD_DENSE_MAP/Examples/ROS/ORB_SLAM21/CMakeLists.txt

2。编译Pangolin时遇到的错

  • 在执行make -j4的时候可能会遇到如下问题:No package 'xkbcommon’
sudo apt-get install libxkbcommon-dev
  • 可能遇到问题:No package ‘wayland-protocols’ found
sudo apt-get install wayland-protocols

3. 运行SLAM时,报opencv没有

执行:

rosrun ORB_SLAM21 RGBD Vocabulary/ORBvoc.bin Astra+.yaml 

/home/xhb/git/ORB-SLAM2_RGBD_DENSE_MAP/Examples/ROS/ORB_SLAM21/RGBD: error while loading shared libraries: libopencv_core3.so.3.3: cannot open shared object file: No such file or directory

查看系统程序情况 参考linux下查看opencv安装路径以及版本号

在目录 /home/xhb/git/ORB-SLAM2_RGBD_DENSE_MAP/Examples/ROS/ORB_SLAM21/查看RGBD 的需要的库

ldd RGBD

发现 opencv需要3.3版本,查看linux下的opencv安装版本:

pkg-config opencv --modversion

发现电脑里只有 3.2版本的,还发现 boost 也没有 安装
参考Ubuntu 中编译boost 1.74.0 & 测试验证 & cmake & Conan设置

再安装OpenCV
参考在ubuntu下安装opencv3高版本

4. rospack: error while loading shared libraries: librospack.so: cannot open shared object file: No suc

在.bashrc文件中加入
export LD_LIBRARY_PATH=/opt/ros/indigo/lib

安装 Octmap

参考ROS 八叉树地图构建 - 安装 octomap 和 octomap_server 建图包!

sudo apt-get install ros-melodic-octomap*
sudo apt-get install ros-melodic-octomap-rviz-plugins

打开 ROS 的工作空间必须包含 src 目录,比如 ~/ros/rtabmap_ws/src/

git clone https://gitee.com/liqing415/octomap_mapping.git
cd ..
catkn_make

执行 :

roslaunch octomap_server octomap_mapping.launch

运行ORB_SLAM 3

安装

参考Ubuntu18.04安装ORB_SLAM3并运行测试

由于已经安装了orb_slam2,坑都踩完了,直接获取代码,编码就可以 了

要在SLAM 中运行RGBD 数据集,必须把图片列表文件和深度图片列表文件合并成 associations.txt

实例1:
python associate.py home/z/ORB_SLAM2/Data/rgbd_dataset_freiburg2_pioneer_360/rgb.txt home/z/ORB_SLAM2/Data/rgbd_dataset_freiburg2_pioneer_360/depth.txt > associations.txt  
实例2:
python associate.py ~/Downloads/dataset/rgb/rgbd_dataset_freiburg1_room/rgb.txt ~/Downloads/dataset/rgb/rgbd_dataset_freiburg1_room/depth.txt > associations.txt

之后运行 rgbd_tum
参数格式:/rgbd_tum path_to_vocabulary path_to_settings path_to_sequence path_to_association

  • rgbd_tum:要运行的程序
  • path_to_vocabulary: 语义词典,也就是 ./Vocabulary/ORBvoc.txt
  • path_to_settings:设置文件,这里要设置相机信息
  • path_to_sequence :就是绝对路径的 accelerometer.txt
./Examples/RGB-D/rgbd_tum ./Vocabulary/ORBvoc.txt ./Examples/RGB-D/TUM2.yaml ~/Downloads/dataset/rgb/rgbd_dataset_freiburg1_room/ ~/Downloads/dataset/rgb/rgbd_dataset_freiburg1_room/accelerometer.txt

相机yaml文件设置

根据相机发布的camera_info话题获取相应 数据

# K:相机内参矩阵,使用焦距(fx, fy)和主点坐标(cx, cy),单位为像素,内参矩阵可以将相机坐标中的3D点投影到2D像素坐标
# K = [fx	0	cx][0	fy 	cy][0 	0	1]
# Camera calibration and distortion parameters (OpenCV) 
Camera.fx: 473.91754150390625
Camera.fy: 473.91754150390625
Camera.cx: 328.7590637207031
Camera.cy: 241.86683654785156

# 1280_1024
# 640_480
Camera.width: 640
Camera.height: 480
  
# Camera frames per second 
Camera.fps: 30.0

# D435的Baseline基线长度为50毫米。Camera.bf = ybaseline (in meters) * fx。
# Astar+ Baseline 	75mm × 473.91754150390625 / 1000
# IR projector baseline times fx (aprox.)
Camera.bf: 35.543815613
编译ORB_SLAM 3时报Perhaps you should add the directory containing `roscpp.pc‘

花了好多时间 ,都没有查到原因,最后还是终于解决 ,见
编译ORB_SLAM 3时报Perhaps you should add the directory containing `roscpp.pc‘

Failed to load module “canberra-gtk-module”

终于编译完了SLAM 3,结果又报这个错

Gtk-Message: 10:58:07.155: Failed to load module "canberra-gtk-module"
^CMakeCurrent: Not available with non-pangolin window.

执行

sudo apt-get install libcanberra-gtk-module

参考【解决方案】完美解决Ubuntu中:Failed to load module “canberra-gtk-module”

fatal error: sophus/se3.hpp: No such file or directory

没有 安装李群代数库

git clone https://gitee.com/javenst/Sophus.git
# git clone https://github.com/strasdat/Sophus.git
cd Sophus
mkdir build
cd build
cmake ..
make
sudo make install


但是安装过程中,报没有 fmt 库的错

Found Eigen3: /usr/include/eigen3 (Required is at least version "3.3.0") 
CMake Warning at CMakeLists.txt:43 (find_package):
  By not providing "Findfmt.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "fmt", but
  CMake did not find one.

  Could not find a package configuration file provided by "fmt" with any of
  the following names:

    fmtConfig.cmake
    fmt-config.cmake

  Add the installation prefix of "fmt" to CMAKE_PREFIX_PATH or set "fmt_DIR"
  to a directory containing one of the above files.  If "fmt" provides a
  separate development package or SDK, be sure it has been installed.

于是又要先安装

# git clone  https://github.com/fmtlib/fmt.git
git clone https://gitee.com/Coxhuang/fmt.git
mkdir build
cd build
cmake ..
make 
sudo  make install
  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值