ubuntu14.04 VI-MEAN编译与运行

VI-MEAN是基于单目和IMU的具有稠密地图重建的SLAM,全名:Real-time Monocular Dense Mapping on Aerial Robots using Visual-Inertial Fusion是2017年香港科技大学发表的论文之一.

代码地址:https://github.com/dvorak0/VI-MEAN

下面说一下如何编译运行这个代码:根据github上面的顺序

1:opencv+CUDA8.0

使用的是opencv2.4.8,我试过了opencv2.4.11也可以

(1)CUDA8.0安装:参见我的博客https://blog.csdn.net/qq_38589460/article/details/82824878

下面说说编译过程中可能遇到的问题:

(2) 在编译Opencv2.4.8的时候,出现opencv-2.4.8/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp(51): error: a storage class is not allowed in an explicit specialization

打开opencv-2.4.8/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp
将所有的 template <> static 去掉static重新编译即可.

(3)可能出现CUDA中thrust文件相关错误

# find the thrust directory
find /usr/local/cuda -type d -name "thrust" 
# clone the 1.8.3 thrust from github
git clone https://github.com/thrust/thrust.git -b 1.8.3
# diff them
diff -u thrust /usr/local/cuda/include/thrust
# backup the cuda/thrust
sudo mv /usr/local/cuda/include/thrust /usr/local/cuda/include/thrust_old
# move the thrust to cuda dir
sudo mv ./thrust/thrust /usr/local/cuda/include/thrust

在graphcuts.cpp中将
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) 
改为
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000)

2:eigen和ceres直接官网下载安装即可

3:PCL1.8安装

参照我的博客:https://blog.csdn.net/qq_38589460/article/details/82529324

或是直接按照源码安装的方式安装,但是需注意都要添加C++11标准

Modify line 112 of CMakeLists.txt in PCL to say SET(CMAKE_CXX_FLAGS "-Wall -std=c++11 ...

4:编译PCL_ROS

根据https://github.com/personalrobotics/OpenChisel说明直接编译即可,编译完成之后放在如下目录中

5:修改部分编译文件

修改VI_MEAN中的camera_model,feature_tracker,self_calibration_estimator,stereo_mapper文件夹中的CMakeLists,设定opencv版本(默认就不用修改,因为我安装了多版本opencv,所以需要自己设定目录),

set(OpenCV_DIR "/usr/local/opencv248/share/OpenCV")
find_package(OpenCV 2.4.8 REQUIRED)

将stereo_mapper中的CMakeLists做如下修改,去掉CUDA_NVCC_FLAGS里面的-std=c++11(我的是这样,不然会报错)

set(CUDA_NVCC_FLAGS
   ${CUDA_NVCC_FLAGS};
    #    -std=c++11 -O3 -gencode arch=compute_30,code=sm_30  # T440s
    #    -std=c++11 -O3 -gencode arch=compute_53,code=sm_53  # tx1
   -O3 -gencode arch=compute_61,code=sm_61  # gtx 980 Ti / 1080
  )

6:直接catkin_make

7:下载数据包,github里面的:

8:运行:

(1)我运行sample只有图像显示,没有轨迹,不知道怎么回事,如果有运行显示轨迹了的,望指教!

(2)运行另外两个均有轨迹和稠密地图显示,不过有很多错误提示,暂时没管了,后面再查.

(3)效果图:

猜你喜欢

转载自blog.csdn.net/qq_38589460/article/details/83215807