下载代码
1
git
相关环境
报错1:error: static assertion failed: std::map must have the same value_type as its allocator
1
2
3
4
5
6
7
/usr/include/c++/9/bits/stl_map.h: In instantiation of ‘class std::map<ORB_SLAM2::KeyFrame*, g2o::Sim3, std::less<ORB_SLAM2::KeyFrame*>, Eigen::aligned_allocator<std::pair<const ORB_SLAM2::KeyFrame*, g2o::Sim3> > >’:
/home/ubuntu/CODE/ORB_SLAM2_grid_navigation/src/Optimizer.cc:818:37: required from here
/usr/include/c++/9/bits/stl_map.h:122:71: error: static assertion failed: std::map must have the same value_type as its allocator
122 | static_assert(is_same<typename _Alloc::value_type, value_type>::value,
| ^~~~~
compilation terminated due to -Wfatal-errors.
loopclosing.h中修改
1
2
3
4
5
typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,
Eigen::aligned_allocator<std::pair<const KeyFrame* , g2o::Sim3> > > KeyFrameAndPose;
// 改成
typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,
Eigen::aligned_allocator<std::pair< KeyFrame* const, g2o::Sim3> > > KeyFrameAndPose;
报错2:Failed to invoke rospack to get compile flags for package ‘ORB_SLAM2’. Look above for errors from rospack itself. Aborting. Please fix the broken dependency!
执行build_ros.sh 需要 把ROS包放到 catkin_ws/src
下,就是你的工作目录下
报错3:error: ‘CV_LOAD_IMAGE_UNCHANGED’ was not declared in this scope
将CV_LOAD_IMAGE_UNCHANGED
换成cv::IMREAD_UNCHANGED
报错4:CV_CAP_PROP_FRAME_HEIGHT 和 CV_CAP_PROP_FRAME_WIDTH
CV_
改成cv::
build_ros.sh cmake_lists中mono相关的都删了
同样的 指定 opencv地址和c++编译版本
1
2
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_PREFIX_PATH "/usr/local/opencv3/share/OpenCV")