Ubuntu18.04+cuda10.0+cilantro配置surfelwarp

配置过程简介:

surfelwarp的官方文档

1.新建一个项目目录Project,然后依次运行:

sudo apt install git
git clone https://github.com/weigao95/surfelwarp.git
git clone https://github.com/stevenlovegrove/Pangolin.git
git clone https://github.com/kzampog/cilantro.git

此时项目目录的结构应为:

Project/ # 根目录
|-- surfelwarp/ # surfelwarp项目
| |-- …
|
|-- Pangolin/ # Pangolin项目
| |-- …
|
|-- cilantro/ # cilantro项目
| |-- …

2.在配置前务必检查库的版本,这些库版本出现差错则会编译失败。

  • cmake>= 3.16

cmake安装

  • Eigen 3.3.9

    在surfelwarp/external/eigen3.4文件夹下运行命令:

    mkdir build 
    cd build
    cmake ..
    sudo make install
    

    [注] : 安装成功后

    DEIGEN_INCLUDE_DIR= /usr/local/include/eigen3

    Eigen3_DIR= /usr/local/share/eigen3/cmake

  • gcc >=6 ubuntu18.04自带gcc7

  • CUDA10.0对应的nvida显卡驱动版本在410以上

  • CUDA 10

    cuda10.0安装
    cudnn安装教程

  • boost 1.74

    boost安装

3.构建Pangolin项目:

构建时处于Project目录下

在运行命令前,需要将Pangolin项目的依赖文件安装完成:

sudo apt install libgl1-mesa-dev
sudo apt install libglew-dev

构建:

cd Pangolin
mkdir build_static && mkdir install_static
cd build_static
cmake -DCMAKE_INSTALL_PREFIX=../install_static -DBUILD_SHARED_LIBRARIES=OFF -DCUDA_ARCH=61 ..
make -j8 && make install
cd ../..                               # 返回Project目录

此处eigen版本必须为3.4,否则会在构建surfelwarp过程中出现CUDA的编译错误,这是由于老版本的eigen没有CUDA 9以上版本的支持。

4.构建cilantro项目:

在cilantro文件夹下运行以下命令:

git checkout e9eb9f3c5c75710eb6cfeeb6313b5a73aaa06a28
mkdir build_static && mkdir install_static
cd build_static
cmake -DCMAKE_INSTALL_PREFIX=../install_static -DBUILD_SHARED_LIBRARIES=OFF -DPangolin_DIR=../../Pangolin/install_static/lib/cmake/Pangolin  -DCUDA_ARCH=61 ..
make -j4 && make install
cd ../..

5.构建surfelwarp:

安装相关依赖:

sudo apt-get install libopencv-dev libglfw3 libglfw3-dev

修复make时的include路径报错

修改 surfelwarp/common 文件夹下的 point_cloud_typedefs.h 的第13行:

#include 

修改 surfelwarp/visualization 文件夹下的 PointCloudVisualizer.cpp 的第17和18行:

#include 
#include 

修复run时 读取.json路径报错

修改 /home/wya/project/SW/surfelwarp/apps/surfelwarp_app/main.cpp

#include "common/common_utils.h"
#include "common/ConfigParser.h"
#include "core/SurfelWarpSerial.h"
#include 

int main(int argc, char** argv) {
	using namespace surfelwarp;
	//Get the config path
	std::string config_path;

	config_path = "/home/wya/project/SW/surfelwarp/test_data/boxing_config.json";

auto& config = ConfigParser::Instance();
config.ParseConfig(config_path);

执行编译命令:

cd surfelwarp
mkdir build && cd build
cmake -DVISUALIZATION_LIBRARY=cilantro -Dcilantro_DIR=../../cilantro/install_static -DCUDA_ARCH=61 ..
make -j8

surfelwarp配置成功:

wangya@wangya-ZHENGJIUZHE-REN9000-25ICZ:~/project/SW-Demo/surfelwarp/build$ cmake -DVISUALIZATION_LIBRARY=cilantro -Dcilantro_DIR=../../cilantro/install_static -DCUDA_ARCH=61 ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found CUDA: /usr/local/cuda-10.0 (found suitable version "10.0", minimum required is "9") 
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- Found OpenCV: /usr (found version "3.2.0") 
-- Found Boost: /usr/local/lib/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0") found components: system filesystem 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/wangya/project/SW-Demo/surfelwarp/build


Ubuntu18.04+cuda10.0+cilantro配置surfelwarp_第1张图片

注意事项:构建surfelwarp时需要先安装boost,且需要使用cilantro可视化而非pcl,否则会默认使用pcl编译并报错。

Run Instructions

修改boxing_config.json文件

将数据文件和训练好的模型在json文件中设置好路径。

"data_prefix":"/home/wya/project/SW/boxing/data",
"gpc_model_path":"/home/wya/project/SW/gpc/sintel_small_speed",

surfelwarp/build/apps/surfelwarp_app路径下运行./surfelwarp_app /path/to/config

Run result

Ubuntu18.04+cuda10.0+cilantro配置surfelwarp_第2张图片

Ubuntu18.04+cuda10.0+cilantro配置surfelwarp_第3张图片

Ubuntu18.04+cuda10.0+cilantro配置surfelwarp_第4张图片

你可能感兴趣的:(slam,c++)