视觉SLAM十四讲slambook2/ch3/examples/plotTrajectory.cpp程序报错解决

原程序编译后出现如下报错:

/usr/local/include/pangolin/var/var.h:218:29: error: ‘class pangolin::VarValueT<bool>’ has no member named ‘Get’return var->Get();^
/usr/local/include/pangolin/var/var.h:222:29: error: ‘class pangolin::VarValueT<bool>’ has no member named ‘Get’return var->Get();^
/usr/local/include/pangolin/var/varvalue.h:99:23: error: ‘class pangolin::VarValue<bool>’ has no member named ‘str’this->str = (VarValueT<std::string>*)this;^
/usr/local/include/pangolin/var/varvalue.h:102:23: error: ‘class pangolin::VarValue<bool>’ has no member named ‘str’this->str = str_ptr;^

解决办法:找到该工程 CMakeLists.txt加入如下代码:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

即可解决

再编译仍存在问题,报错如下:

/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:14:28: error: ‘Isometry3d’ was not declared in this scopevoid DrawTrajectory(vector<Isometry3d, Eigen::aligned_allocator<Isometry3d>>);^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:14:65: error: ‘Isometry3d’ was not declared in this scopevoid DrawTrajectory(vector<Isometry3d, Eigen::aligned_allocator<Isometry3d>>);^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:14:65: error: template argument 1 is invalid
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:14:75: error: template argument 1 is invalidvoid DrawTrajectory(vector<Isometry3d, Eigen::aligned_allocator<Isometry3d>>);^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:14:75: error: template argument 2 is invalid
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp: In function ‘int main(int, char**)’:
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:18:10: error: ‘Isometry3d’ was not declared in this scopevector<Isometry3d, Eigen::aligned_allocator<Isometry3d>> poses;^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:18:47: error: the value of ‘Isometry3d’ is not usable in a constant expressionvector<Isometry3d, Eigen::aligned_allocator<Isometry3d>> poses;^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:18:10: note: ‘Isometry3d’ was not declared ‘constexpr’vector<Isometry3d, Eigen::aligned_allocator<Isometry3d>> poses;^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:18:47: error: type/value mismatch at argument 1 in template parameter list for ‘template<class T> class Eigen::aligned_allocator’vector<Isometry3d, Eigen::aligned_allocator<Isometry3d>> poses;^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:18:47: note:   expected a type, got ‘Isometry3d’
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:18:57: error: template argument 1 is invalidvector<Isometry3d, Eigen::aligned_allocator<Isometry3d>> poses;^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:18:57: error: template argument 2 is invalid
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:28:16: error: expected ‘;’ before ‘Twr’Isometry3d Twr(Quaterniond(qw, qx, qy, qz));^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:29:5: error: ‘Twr’ was not declared in this scopeTwr.pretranslate(Vector3d(tx, ty, tz));^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:30:11: error: request for member ‘push_back’ in ‘poses’, which is of non-class type ‘int’poses.push_back(Twr);^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:32:34: error: request for member ‘size’ in ‘poses’, which is of non-class type ‘int’cout << "read total " << poses.size() << " pose entries" << endl;^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp: At global scope:
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:40:28: error: ‘Isometry3d’ was not declared in this scopevoid DrawTrajectory(vector<Isometry3d, Eigen::aligned_allocator<Isometry3d>> poses) {^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:40:65: error: ‘Isometry3d’ was not declared in this scopevoid DrawTrajectory(vector<Isometry3d, Eigen::aligned_allocator<Isometry3d>> poses) {^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:40:65: error: template argument 1 is invalid
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:40:75: error: template argument 1 is invalidvoid DrawTrajectory(vector<Isometry3d, Eigen::aligned_allocator<Isometry3d>> poses) {^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:40:75: error: template argument 2 is invalid
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp: In function ‘void DrawTrajectory(int)’:
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:61:34: error: request for member ‘size’ in ‘poses’, which is of non-class type ‘int’for (size_t i = 0; i < poses.size(); i++) {^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:63:28: error: invalid types ‘int[std::size_t {aka long unsigned int}]’ for array subscriptVector3d Ow = poses[i].translation();^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:64:28: error: invalid types ‘int[std::size_t {aka long unsigned int}]’ for array subscriptVector3d Xw = poses[i] * (0.1 * Vector3d(1, 0, 0));^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:65:28: error: invalid types ‘int[std::size_t {aka long unsigned int}]’ for array subscriptVector3d Yw = poses[i] * (0.1 * Vector3d(0, 1, 0));^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:66:28: error: invalid types ‘int[std::size_t {aka long unsigned int}]’ for array subscriptVector3d Zw = poses[i] * (0.1 * Vector3d(0, 0, 1));^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:80:34: error: request for member ‘size’ in ‘poses’, which is of non-class type ‘int’for (size_t i = 0; i < poses.size(); i++) {^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:83:24: error: invalid types ‘int[std::size_t {aka long unsigned int}]’ for array subscriptauto p1 = poses[i], p2 = poses[i + 1];^
/home/sky/LQT/slambook2/ch3/examples/plotTrajectory.cpp:85:18: error: ‘p2’ was not declared in this scopeglVertex3d(p2.translation()[0], p2.translation()[1], p2.translation()[2]);

仔细阅读报错,查看代码发现主要是对 Isometry3d Vector3d等几何模块不支持,发现缺少集合模块头文件,补上头文件:

#include <Eigen/Geometry>

编译成功

若发现程序编译成功后仍不可运行,返回错误:

cannot find trajectory file at ./examples/trajectory.txt

将路径修改为绝对路径即可

// path to trajectory file
string trajectory_file = "/home/sky/LQT/slambook2/ch3/examples/trajectory.txt";

视觉SLAM十四讲slambook2/ch3/examples/plotTrajectory.cpp程序报错解决相关推荐

  1. 《视觉SLAM十四讲》(第二版)程序

    目录 clone github下代码 CH2 IDE的使用 CMake CH3 Eigen CH4 Sophus CH5 OpenCV clone github下代码 由于网络等问题,会导致git c ...

  2. Ubuntu20/视觉SLAM十四讲踩坑记录

    Ubuntu/视觉SLAM十四讲踩坑记录 Ubuntu(20)/视觉SLAM十四讲踩坑记录: 共性问题: 1.安装OpenCV后,例程仍无法找到OpenCV文件 ch3 visualizeGeomet ...

  3. 《视觉SLAM十四讲》第二版源码slambook2编译调试

    slambook2-master/ch2 编译正常,log如下: slambook2-master/ch2# mkdir build && cd build && cm ...

  4. 视觉SLAM十四讲 ch3 Ubuntu18.04 KDevelop的使用及Eigen实践 入门笔记

    视觉SLAM十四讲 ch3 Ubuntu18.04 KDevelop的使用及Eigen实践 入门笔记 一.创建KDevelop项目 二.编写程序 一.创建KDevelop项目 你的电脑上如果还没有安装 ...

  5. 视觉SLAM十四讲学习笔记-第三讲-相似、仿射、射影变换和eigen程序、可视化演示

    专栏系列文章如下: 视觉SLAM十四讲学习笔记-第一讲_goldqiu的博客-CSDN博客 视觉SLAM十四讲学习笔记-第二讲-初识SLAM_goldqiu的博客-CSDN博客 视觉SLAM十四讲学习 ...

  6. 视觉SLAM十四讲学习笔记-第三讲-旋转矩阵和Eigen库

    专栏系列文章如下: 视觉SLAM十四讲学习笔记-第一讲_goldqiu的博客-CSDN博客 视觉SLAM十四讲学习笔记-第二讲-初识SLAM_goldqiu的博客-CSDN博客 视觉SLAM十四讲学习 ...

  7. [视觉SLAM十四讲]学习笔记1-刚体运动之旋转矩阵与变换矩阵

    [视觉SLAM十四讲]学习笔记1-刚体运动之旋转矩阵与变换矩阵 1点.向量和坐标系 2 坐标系间的欧式变换 2.1 欧式变换之旋转 2.2 欧式变换之平移 3 变换矩阵与齐次坐标 4 Eigen库的简 ...

  8. 视觉SLAM十四讲(高翔第二版)

    视觉SLAM十四讲高翔第二版调试记录 前言 一.3.7可视化演示程序运行全过程Pangolin plotTrajectory.cpp 1. **在3rdparty中下载Pangolin** 2. ** ...

  9. 视觉SLAM十四讲(3):三维空间刚体运动

    本章需要掌握的知识点有:旋转矩阵,变换矩阵,四元数,欧拉角定义和数学表达:同时也要掌握Eigen库关于矩阵.几何模块的使用方法. 文章目录 3.1 旋转矩阵 3.1.1 点,向量和矩阵的关系 3.1. ...

最新文章

  1. Linux下使用ssh密钥实现无交互备份
  2. 澳洲专升硕计算机专业,澳洲计算机专升硕-纽卡斯尔大学
  3. win7如何配置access数据源
  4. The 2014 ACM-ICPC Asia Mudanjiang Regional First Round J
  5. 这种奇奇怪怪的符号,只能用latex打出来,如果实在不行,>---|-->>也行
  6. Ubuntu安装配置Python.pyDev
  7. ValueStack基础:OGNL
  8. 存储过程中while循环
  9. 地产cio揭秘:帆软大商业智能解决方案如何助力地产行业信息化
  10. 公里与英里的换算c语言函数_这些天然气单位换算你知道吗?
  11. memcached主从复制
  12. 学生DW静态网页设计 红色中国文化主题网站设计 ——美丽中国1页HTML+CSS
  13. 第十届泰迪杯数据挖掘B题电力系统负荷预测分析
  14. 三菱工控板底层源码_三菱PLC实例代码开源PLC项目源代码参考程序百度云资源下载...
  15. Flutter 网络请求王者 Dio 应用简介
  16. No silver bullet——没有银弹理论
  17. 404报错:The origin server did not find a current representation for the target resource解决的两种办法
  18. pt-diskstats 报错 Can't locate Time/HiRes.pm in @INC
  19. 华为手机为何能反超小米?
  20. 工作第十六七周:生活这么繁琐,我们还要努力爱她

热门文章

  1. Output tensors to a Model must be the output of a TensorFlow `Layer`
  2. 基于springboot的高校疫情打卡上报系统设计与实现 文档+项目源码及数据库文件+演示视频
  3. stm32cubeide烧写程序_初学STM32CubeIDE
  4. FreeCAD Addon Manager的Workbenches为空的解决方法
  5. 分享在实际项目中积累的硬件调试经验 - 调试方法,以及常见调试案例
  6. TiDB PCTP(PingCAP 认证 TiDB 数据库专家) 认证考试高分攻略
  7. Thanos 组件介绍以及使用心得
  8. SP_Flash_Tool对应MTK CPU型号速查表汇总分析
  9. c语言统计学生成绩输入一个正整数n,输入一个正整数n,再输入n个学生的成绩,计算平均分,并统计各等级成绩的个数...
  10. Seating Arrangement CSU - 1997 (思维题,是否存在n个数的序列,使得相邻啷个数的差绝对值大于d)