1、建立工作空间,下载segmap程序包
安装依赖项
$ sudo apt-get install python-wstool doxygen python3-pip python3-dev python-virtualenv
设置工作空间配置
$ mkdir -p ~/segmap_ws/src
$ cd ~/segmap_ws
$ catkin init
$ catkin config --merge-devel
$ catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release
下载segmap源码
$ cd src
$ git clone https://github.com/ethz-asl/segmap.git
$ wstool init
$ wstool merge segmap/dependencies.rosinstall
$ wstool update
2、源码安装tensorflow1.8
参考网站: (https://tensorflow.google.cn/install/install_sources#ConfigureInstallation)
注意事项:
“Clone the TensorFlow repository” 步骤
$ git clone https://github.com/tensorflow/tensorflow
改为:
$ git clone -b r1.8 https://github.com/tensorflow/tensorflow
步骤
“Build the pip package”
$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
改为:
$ bazel build --config=opt --define framework_shared_object=false
tensorflow:libtensorflow_cc.so
剩下的步骤不用执行
3、编译tensorflow_ros_cpp程序包
设置 CMakeLists.txt 内 tensorflow 的路径
修改:
set(TF_BAZEL_LIBRARY “CATKIN_DEVEL_PREFIX/…/libtensorflow_cc.so” CACHE STRING “Path to the bazel-compiled Tensorflow C++ library”)
set(TF_BAZEL_SRC_DIR “${CATKIN_DEVEL_PREFIX}/…/tensorflow-include-base” CACHE STRING “Path to the Tensorflow sources directory”)
内的 tensorflow 的库路径和源码路径为步骤 1 确定的路径
例如:
set(TF_BAZEL_LIBRARY “/home/ubuntu/tensorflow-r1.8/bazel-bin/tensorflow/libtensorflow_cc.so” CACHE STRING “Path to the bazel-compiled Tensorflow C++ library”)
set(TF_BAZEL_SRC_DIR “/home/ubuntu/tensorflow-r1.8” CACHE STRING “Path to the Tensorflow sources directory”)
编译
$ cd ~/segmap_ws
$ catkin build tensorflow_ros_cpp
4、编译segmapper程序包
直接编译会出现3个错误,分别安装如下功能包即可:
$sudo apt-get install autoconf automake libtool
$ git clone https://github.com/doxygen/doxygen.git
$ cd doxygen
$ mkdir build
$ cd build
$ cmake …
$ make
$ sudo make install
$ git clone https://github.com/ros-perception/pcl_conversions/tree/indigo-devel
$ cd pcl_conversions
$ mkdir build
$ cd build
$ cmake …
$ make
$ sudo make install
编译segmapper程序包
$ cd ~/segmap_ws
$ catkin build segmapper