ORB SLAM2在Ubuntu 16.04上的运行配置

安装依赖

安装OpenGL

1. 安装opengl Library
$sudo apt-get install libgl1-mesa-dev
2. 安装opengl utility
$sudo apt-get install libglu1-mesa-dev
3. 安装opengl utility toolkit
$sudo apt-get install freeglut3-dev

安装GLEW

$sudo apt-get install libglew-dev

安装boost

$sudo apt-get install libboost-dev libboost-thread-dev libboost-filesystem-dev

安装编译基础库

$sudo apt-get install build-essential

安装Pangolin

1. 下载链接:https://github.com/stevenlovegrove/Pangolin
注:可以使用git进行clone,也可以直接download zip

2. 编译安装步骤
$cd Pangolin
$mkdir build
$cd build
$cmake ..
$make
$sudo make install
$make doc (生成文档)

安装OpenCV

必选依赖:sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
可选依赖:sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
源码下载链接:http://opencv.org/downloads.html (选择2.4.xx,3.x.xx版本都可以,新版本的ORBSLAM2已经支持OpenCV3.xx.xx)
编译安装步骤(以OpenCV2.4.xx为例):
$cd opencv-2.4.xx
$mkdir build
$cd build
$cmake ..
$make
$sudo make install

安装Eigen3

源码下载地址:http://eigen.tuxfamily.org/index.php?title=Main_Page
安装依赖:sudo apt-get install libxmu-dev libxi-dev
编译安装步骤:
$cd eigen
$mkdir build
$cd build
$cmake ..
$make
$sudo make install

安装BLAS and LAPACK库

sudo apt-get install libblas-dev
sudo apt-get install liblapack-dev

编译ORB SLAM2

1. 下载源码

git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2

2. 编译

$cd ORB_SLAM2
$chmod +x build.sh
$./build.sh

3. 16.04上编译错误解决

1) OpenCV找不到

错误信息:

Configuring and building Thirdparty/DBoW2 ...
mkdir: cannot create directory ‘build’: File exists
-- OpenCV ARCH:
-- OpenCV RUNTIME:
-- OpenCV STATIC: OFF
CMake Warning at /home/melanie/tools/opencv-2.4.13/cmake/OpenCVConfig.cmake:163 (message):
Found OpenCV Windows Pack but it has not binaries compatible with your
configuration.

You should manually point CMake variable OpenCV_DIR to your build of OpenCV
library.
Call Stack (most recent call first):
CMakeLists.txt:27 (find_package)

CMake Error at CMakeLists.txt:27 (find_package):
Found package configuration file:

/home/melanie/tools/opencv-2.4.13/cmake/OpenCVConfig.cmake

but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.

-- Configuring incomplete, errors occurred!
See also "/home/melanie/source/SmartCar/ORM_SLAM2/ORB_SLAM2/Thirdparty/DBoW2/build/CMakeFiles/CMakeOutput.log".
make: *** No targets specified and no makefile found. Stop.

解决方案:
因为我的OpenCV用源码编译安装的路径默认是/usr/local/share/OpenCV/,所以在这里手动给cmake指定OpenCV的路径
修改build.sh如下:
cd Thirdparty/DBoW2
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=/usr/local/share/OpenCV/
make

2)强制类型转换问题

错误信息:

/home/melanie/tools/eigen/Eigen/src/Core/AssignEvaluator.h:817:3: error: static assertion failed: YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY
EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar);
^
CMakeFiles/ORB_SLAM2.dir/build.make:350: recipe for target ‘CMakeFiles/ORB_SLAM2.dir/src/Optimizer.cc.o‘ failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/Optimizer.cc.o] Error 1
CMakeFiles/Makefile2:178: recipe for target ‘CMakeFiles/ORB_SLAM2.dir/all‘ failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target ‘all‘ failed
make: *** [all] Error 2

解决方案:

打开Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h,将以下代码
template <typename MatrixType>
class LinearSolverEigen: public LinearSolver<MatrixType>
{
public:
typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix;
typedef Eigen::Triplet<double> Triplet;
typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, SparseMatrix::Index> PermutationMatrix;

修改为:

template <typename MatrixType>
class LinearSolverEigen: public LinearSolver<MatrixType>
{
public:
typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix;
typedef Eigen::Triplet<double> Triplet;
typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int> PermutationMatrix;

3)usleep未定义:

错误信息:

/home/melanie/source/SmartCar/ORM_SLAM2/ORB_SLAM2/src/Viewer.cc:159:28: error: ‘usleep’ was not declared in this scope
usleep(3000);
^
CMakeFiles/ORB_SLAM2.dir/build.make:494: recipe for target ‘CMakeFiles/ORB_SLAM2.dir/src/Viewer.cc.o‘ failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/Viewer.cc.o] Error 1
CMakeFiles/Makefile2:178: recipe for target ‘CMakeFiles/ORB_SLAM2.dir/all‘ failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target ‘all‘ failed
make: *** [all] Error 2

解决方案:

在source文件的开头增加include
#include <unistd.h>

需要增加unistd.h的文件有:
Examples/Monocular/mono_euroc.cc
Examples/Monocular/mono_kitti.cc
Examples/Monocular/mono_tum.cc
Examples/RGB-D/rgbd_tum.cc
Examples/Stereo/stereo_euroc.cc
Examples/Stereo/stereo_kitti.cc
src/LocalMapping.cc
src/LoopClosing.cc
src/System.cc
src/Tracking.cc
src/Viewer.cc

4) CUDA错误

安装了CUDA的机器编译的时候会出现CUDA相关错误,修改build.sh如下:
cd Thirdparty/DBoW2
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=/usr/local/share/OpenCV/ -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF
make -j
......
echo "Configuring and building ORB_SLAM2 ..."

mkdir build
cd build
-cmake .. -DCMAKE_BUILD_TYPE=Release
+cmake .. -DCMAKE_BUILD_TYPE=Release -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF
make -j

时间: 2024-08-07 19:20:04

ORB SLAM2在Ubuntu 16.04上的运行配置的相关文章

在Ubuntu 16.04上用sytemd启动OpenVPN Client的正确方式

Ubuntu 16.04默认使用systemd管理服务的启动.停止.重新启动和状态查看等.由于之前用习惯了sysv的服务管理方式,用sytemd还很不习惯,有很多不甚了了地方.今天中午准备在Ubuntu 16.04上部署一套OpenVPN用于远程管理阿里云的十几台Linux主机,期间遇到了一个关于systemd的问题,在此记录一下,供需要者查看和了解. systemd所管理的服务通常位于:/lib/systemd/system/,如果细心的话会发现有些xxx.service中有带"@"

Ubuntu 16.04上安装SkyEye及测试

说明一下,在Ubuntu 16.04上安装SkyEye方法不是原创,是来自互联网,仅供学习参考. 1.检查支持软件包 gcc,make,vim(optional),ssh,subversionbinutils-dev (bfd)atk-dev (libatk1.0-dev)gtk+-2.0-dev (libgtk2.0-dev)pkg-configpango-dev (libpango1.0-dev)freetype2-dev (libfreetype6-dev)glib-dev (libgli

使用 Nginx 在 Ubuntu 16.04 上托管 ASP.NET Core

使用 Nginx 在 Ubuntu 16.04 上托管 ASP.NET Core 准备工作 服务器主机:腾讯云主机 Ubuntu 16.04 64位 客户端软件:putty.exe; WinSCP 5.13.2 在 Ubuntu 中安装 ASP.NET Core 微软在 .NET Core指南 提供了在不同操作系统中安装运行 ASP.NET Core 的帮助文档,请选择 linux-prerequisites 部分,并找到和自己服务器所安装操作系统相同的内容进行安装即可. 注册Microsoft

在Ubuntu 16.04上安装Joomla系统

Joomla !是一个流行的内容管理系统(CMS),它是仅次于Wordpress的第二大流行的CMS.到2017年,约有3.3%的网站使用Joomla !作为他们的CMS.本文介绍了如何在Ubuntu 16.04上一键安装Joomla ! 步骤1:安装Apache更新存储库列表.apt-get update安装Apache web服务器.apt-get install apache2使用 LAMP stack 一键安装包安装Joomla!,我们需要安装MySQL并将其链接到PHP.apt-get

在Ubuntu 16.04上安装Concrete5

介绍 Concrete5是用PHP编写的开源内容管理系统(CMS).它的设计是为了便于使用,并提供了一个允许用户直接从页面编辑内容的web界面.Concrete5可以安装在Ubuntu 16.04上实现一键安装. 先决条件 本教程假设您已经创建了一个新的Vultr云计算实例,运行Ubuntu 16.04,并有根访问权限. 步骤1:安装Apache.MySQL和PHP以及其他依赖项 Comcrete5在一键安装包上运行.您需要安装Apache.PHP.MySQL和许多其他必需的依赖项. apt-g

(译)综合指南:通过Ubuntu 16.04上从Source构建来安装支持GPU的Caffe2

(译)综合指南:通过Ubuntu 16.04上从Source构建来安装支持GPU的Caffe2 译者注: 原文来自:https://tech.amikelive.com/node-706/comprehensive-guide-installing-caffe2-with-gpu-support-by-building-from-source-on-ubuntu-16-04/?tdsourcetag=s_pctim_aiomsg, 不得不说该文作者知识比较丰富,研究比较深入,环境的配置讲解比较详

在Ubuntu 16.04上使用Apache安装phpBB

PhpBB是一个开源的公告板程序.本文将向您展示如何在Ubuntu 16.04上在Apache webserver上安装phpBB.它是使用phpBB 3.2.1编写的,但是这里提供的说明可能也适用于新版本的phpBB.先决条件本文假设您已经使用Ubuntu 16.04创建了一个Vultr云计算实例,并以root身份登录. 步骤1:安装Apache更新存储库列表.apt-get update安装Apache web服务器.apt-get install apache2步骤2:安装MySQLphp

Ubuntu 14.04 上安装和配置 FTP 服务器 ProFTPD

proftpd的配置方式类似apache,比vsftpd更易用,xampp就集成了proftpd. apt-cache search proftpd 搜索相关包 sudo apt-get install proftpd-basic 安装 安装时默认作为一个standalone server运行proftpd,如果每天的ftp请求量少,可以安装为inetd服务,节省服务器资源. 这里我使用默认值,安装为standalone server. sudo netstat -antp|grep proft

解决Ubuntu 16.04 上Android Studio2.3上面运行APP时提示DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs的问题

本人工作环境:Ubuntu 16.04 LTS + Android Studio 2.3 AVD启动之后,运行APP,报错提示: DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs 搜索后发现这是因为未关闭android studio上的instant app所致. File->settings->Buil,Execution,Deployment->Instant Run->Disable it. 详情请参看以下sta