编译g2o_with_orbslam2

1.修改g2o/types/slam2d/edge_se2_pointxy_bearing.cpp

t.setRotation(t.rotation().angle()+_measurement);  --->>>  t.setRotation((Eigen::Rotation2Dd)(t.rotation().angle()+_measurement));

2.修改g2o/solvers/eigen/linear_solver_eigen.h

typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, SparseMatrix::Index> PermutationMatrix;  --->>>  typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, SparseMatrix::StorageIndex> PermutationMatrix;

(报错信息关键字:YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)

3.修改g2o/g2o/examples/tutorial_slam2d/simulator.cpp: 80行

VectorXd probLimits(MO_NUM_ELEMS);   --->>>   VectorXd probLimits;  probLimits.resize(MO_NUM_ELEMS);

(报错信息关键字:FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)

编译ORB_SLAM2_modified

1.编译DBoW2

cd ~/ORB_SLAM2_modified/Thirdparty/DBoW2
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j8

2.编译ORB_SLAM2_modified

cd ~/ORB_SLAM2_modified
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j8

编译完成之后发现只能显示不能保存,然后查看代码进行修改:

在/src/pointcloudmapping.cc中加入PCL保存头文件

#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>

然后在PointCloudMapping::viewer -->> while()函数最后面加入

    if(globalMap->points.size())
{
pcl::io::savePCDFileASCII ("test_pcd.pcd", *globalMap);
cout<< endl << "Saved PCD Successful!!" << endl;
}
}
}

编译ORB_SLAM2_modified——ROS

1.更改~/ORB_SLAM2-master/Examples/ROS/ORB_SLAM2/src/ros_mono.cc中(更改接口,否则运行黑屏)(RGBD 即Kinect同理)

ros::Subscriber sub = nodeHandler.subscribe("/camera/image_raw", , &ImageGrabber::GrabImage,&igb);
>
ros::Subscriber sub = nodeHandler.subscribe("/usb_cam/image_raw", , &ImageGrabber::GrabImage,&igb);

2.修改CMakeLists.txt

在相似位置添加

find_package( PCL 1.7 REQUIRED )
${PCL_INCLUDE_DIRS}

在“Set{”上面加入

add_definitions( ${PCL_DEFINITIONS} )
link_directories( ${PCL_LIBRARY_DIRS} )

修改

find_package(OpenCV 2.3. REQUIRED)
>
find_package(OpenCV 3.2. REQUIRED) (本机Opencv版本号)

修改

${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o/lib/libg2o.so
>
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_calibration_odom_laser.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_cli.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_core.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_csparse_extension.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_ext_csparse.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_ext_freeglut_minimal.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_hierarchical.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_incremental.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_interactive.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_interface.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_opengl_helper.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_parser.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_simulator.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_solver_cholmod.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_solver_csparse.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_solver_dense.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_solver_eigen.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_solver_pcg.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_solver_slam2d_linear.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_solver_structure_only.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_stuff.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_tutorial_slam2d.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_types_data.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_types_icp.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_types_sba.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_types_sclam2d.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_types_sim3.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_types_slam2d.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_types_slam2d_addons.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_types_slam3d.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_types_slam3d_addons.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o_with_orbslam2/lib/libg2o_viewer.so

3.编译

cd ~/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j8

编译遇到的错误

1.遇到:*** No rule to make target '/usr/lib/x86_64-linux-gnu/libproj.so', needed by '../lib/libORB_SLAM2.so'。 停止。

解决办法:

sudo apt-get install libproj-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libproj.so. /usr/lib/x86_64-linux-gnu/libproj.so

2.遇到:/usr/bin/ld: 找不到 -lvtkproj4

解决办法:

在CMakeLists.txt中加上以下内容

find_package(OpenCV 3.2. REQUIRED)
find_package(Eigen3 3.1. REQUIRED)
find_package(Pangolin REQUIRED)
find_package( G2O REQUIRED )
find_package( PCL 1.7 REQUIRED ) list(REMOVE_ITEM PCL_LIBRARIES "vtkproj4") include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/include
${EIGEN3_INCLUDE_DIR}
${Pangolin_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
)

 其他问题请参考另外两篇文章:

https://www.cnblogs.com/haijian/p/10226678.html  Ubuntu配置ORB-SLAM2过程中的问题
https://www.cnblogs.com/haijian/p/9734014.html Ubuntu 16.04 orb-slam2配置

Ubuntu 16.04 编译ORB_SLAM2_modified的更多相关文章

  1. PHP7 学习笔记(一)Ubuntu 16.04 编译安装Nginx-1.10.3、 PHP7.0.9、Redis3.0 扩展、Phalcon3.1 扩展、Swoole1.9.8 扩展、ssh2扩展(全程编译安装)

    ==================== PHP 7.0 编译安装================== wget http://cn2.php.net/get/php-7.0.9.tar.bz2/fr ...

  2. Ubuntu 16.04 编译安装 ss

    在网上没有找到合适的适合ubuntu的ss客户端, 考虑到ss的编译安装其实就带了ss-local这样的客户端, 于是在Ubuntu下编译安装了ss. 首先去github上下载最新的安装包 https ...

  3. Ubuntu 16.04 编译安装&&用dpkg安装--zabbix3.4

    编译安装zabbix3.4,官方有教程,但是遇到一些报错: 总结下来,需要安装这些环境: 更新系统: apt update apt upgrade 先装这些: apt-get install libm ...

  4. UBUNTU 16.04 编译 OPENJDK8

    参考了几篇文章,和错误查询,最后总结如下 一.下载 我比较倾向于使用mercurial来获取源代码,虽然你得挑网络稳定的时候更新,但是易更新. 从官网查找一下,可以通过以下步骤完成源代码的下载 1. ...

  5. ubuntu 16.04 编译安装 amule (开启GUI)

    安装依赖 $ -dev libgeoip-dev zlib1g-dev libupnp-dev libboost-all-dev libwxbase3.-dev libwxgtk3.-dev buil ...

  6. ubuntu 16.04 编译安装 trl8291cu系列 无线网卡驱动

    1 先 下载git包 和相关编译工具 sudo apt-get update sudo apt-get install git linux-headers-generic build-essentia ...

  7. ubuntu 16.04 编译安装 python3.9

    下载 python包 wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz 解压 tar zxf Python-3.9.1.tgz ...

  8. Ubuntu 16.04 编译OpenCV 问题解决stdlib.h: No such file or directory

    https://blog.csdn.net/xinyu391/article/details/72867510 https://ask.csdn.net/questions/365969

  9. [Android 编译(一)] Ubuntu 16.04 LTS 成功编译 Android 6.0 源码教程

    本文转载自:[Android 编译(一)] Ubuntu 16.04 LTS 成功编译 Android 6.0 源码教程 1 前言 经过3天奋战,终于在Ubuntu 16.04上把Android 6. ...

随机推荐

  1. android中builder模式的使用

    变种的Builder模式的自动化生产实现: AS安装插件  Innerbuilde 新建User类 public class User { private final String name; //必 ...

  2. Checkbox 多选框

    Checkbox 多选框 一组备选项中进行多选 ¶基础用法 单独使用可以表示两种状态之间的切换,写在标签中的内容为 checkbox 按钮后的介绍. 在el-checkbox元素中定义v-model绑 ...

  3. nodejs之express中间件路由使用

    1.express 中间件使用 /* * 中间件:就是匹配路由之前和匹配路由之后做的一系列操作 */ var express = require('express'); var app = new e ...

  4. Java编写时钟 Applet 程序

    简单分析: package clockApplet; import java.applet.Applet; import java.awt.Color; import java.awt.Graphic ...

  5. 阶段3 2.Spring_01.Spring框架简介_06.spring的体系结构

    资料内提供了spring 的开发包 docs:文档 libs:jar包 schema:约束

  6. 运行上次失败用例(--lf 和 --ff)

    前言 “80%的bug集中在20%的模块,越是容易出现bug的模块,bug是越改越多“平常我们做手工测试的时候,比如用100个用例需要执行,其中10个用例失败了,当开发修复完bug后,我们一般是重点测 ...

  7. LoadRunner 技巧之 自动关联

    LoadRunner 技巧之 自动关联 这一节讲loadunner 关联的问题,其实这个东西理解起来简单,但说起来比较麻烦. 关联的原理:                               ...

  8. Function Expression

    One of the key characteristics of function declarations is function declaration hoisting, whereby fu ...

  9. Akka系列(六):Actor解决了什么问题?

    前言..... 文档来源于  : What problems does the actor model solve? Actor解决了什么问题? Akka使用Actor模型来克服传统面向对象编程模型的 ...

  10. CentOS7之SVN服务配置

    操作系统:CentOS Linux release 7.2.1511 (Core)    Subversion软件版本:subversion-1.7.14-10.el7.x86_64 1.首先检查sv ...