Cartographer安装及过程中出现的问题

安装步骤

1.更新

sudo apt-get update

2.依赖

sudo apt-get install -y \
    cmake \
    g++ \
    git \
    google-mock \
    libboost-all-dev \
    libcairo2-dev \
    libeigen3-dev \
    libgflags-dev \
    libgoogle-glog-dev \
    liblua5.2-dev \
    libsuitesparse-dev \
    libwebp-dev \
    ninja-build \
    protobuf-compiler \
    python-sphinx

3.安装ceres

git clone https://github.com/ceres-solver/ceres-solver.git
cd ceres-solver
mkdir build
cd build
cmake ..
make -j8
sudo make install

问题:

nvcc fatal : Unsupported gpu architecture ‘compute_80’
internal/ceres/CMakeFiles/ceres_cuda_kernels.dir/build.make:75: recipe
for target
‘internal/ceres/CMakeFiles/ceres_cuda_kernels.dir/cuda_kernels.cu.cc.o’
failed make[2]: ***
[internal/ceres/CMakeFiles/ceres_cuda_kernels.dir/cuda_kernels.cu.cc.o]
Error 1 CMakeFiles/Makefile2:238: recipe for target
‘internal/ceres/CMakeFiles/ceres_cuda_kernels.dir/all’ failed make[1]:
*** [internal/ceres/CMakeFiles/ceres_cuda_kernels.dir/all] Error 2 Makefile:145: recipe for target ‘all’ failed make: *** [all] Error 2

解决方案:
从下面这个链接下载最新的ceres,再重新编译.

http://ceres-solver.org/ceres-solver-2.0.0.tar.gz

问题:

Could not find a package configuration file provided by “gflags” (requested
version 2.2.0) with any of the following names:
gflagsConfig.cmake
gflags-config.cmake

解决方案:

git clone https://github.com/gflags/gflags
cd gflags/
mkdir build
cd build
cmake .. -DBUILD_SHARED_LIBS=ON
make -j2
sudo make install

问题:

Can’t find Google Log (glog). Please set either: glog_DIR (newer CMake
built versions of glog) or GLOG_INCLUDE_DIR & GLOG_LIBRARY or enable
MINIGLOG option to use minimal glog implementation.

解决方案:

git clone https://github.com/google/glog
cd glog/
mkdir build
cd build
cmake ..
make -j2
sudo make install

4.安装prtobuf

git clone https://github.com/google/protobuf.git
cd protobuf
git checkout 
mkdir build
cd build
cmake  \
  -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
  -DCMAKE_BUILD_TYPE=Release \
  -Dprotobuf_BUILD_TESTS=OFF \
  ../cmake
make -j4
sudo make install

5.安装cartographer

git clone https://github.com/cartographer-project/cartographer.git
cd cartographer
mkdir build
cd build
cmake ..
make -j8
sudo make install

问题:

Compatibility with CMake < 2.8.12 will be removed from a future
version of CMake.

Update the VERSION argument value or use a … suffix to
tell CMake that the project does not need compatibility with older
versions.

– Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy

– Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Error at /home/user/catkin_ws/devel/share/tf2_geometry_msgs/cmake/tf2_geometry_msgsConfig.cmake:113 (message):
Project ‘tf2_geometry_msgs’ specifies ‘/usr/include/eigen3’ as an include
dir, which is not found. It does neither exist as an absolute directory
nor in
‘/home/user/catkin_ws/src/geometry2/tf2_geometry_msgs//usr/include/eigen3’.
Check the website ‘http://www.ros.org/wiki/tf2_ros’ for information and
consider reporting the problem.
Call Stack (most recent call first):
/opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
bw_auto_dock/CMakeLists.txt:6 (find_package)

解决方案:
直接把找不到的文件软链接过去.

sudo ln -s /usr/local/include/eigen3 /usr/include/eigen3

问题:

CMake Error at CMakeLists.txt:32 (find_package): By not providing
“Findabsl.cmake” in CMAKE_MODULE_PATH this project has asked CMake
to find a package configuration file provided by “absl”, but CMake
did not find one.

Could not find a package configuration file provided by “absl” with
any of the following names:

abslConfig.cmake
absl-config.cmake

Add the installation prefix of “absl” to CMAKE_PREFIX_PATH or set
“absl_DIR” to a directory containing one of the above files. If
“absl” provides a separate development package or SDK, be sure it
has been installed.

解决方案:
install_abseil.sh文件在scripts文件夹下,按照下方法安装即可:

sudo apt-get install stow
sudo chmod +x scripts/install_abseil.sh 
cd /scripts
./install_abseil.sh

问题:

#error “C++ versions less than C++11 are not supported.”

解决方案:
更改cmake,如下:

cmake -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
  -DCMAKE_INSTALL_PREFIX=/usr/local/stow/absl \
  -DCMAKE_CXX_STANDARD=11 \

问题:

Failed to find Ceres - Missing requested Ceres components: [SuiteSparse]
(components requested: [SuiteSparse]). Detected Ceres version: 2.0.0

解决方案:

sudo apt-get install libsuitesparse-dev
重新编译ceres即可

6.cartographer_ros

cd ~/catkin_workspace/src     //请修改路径到自己的工作空间
git clone https://github.com/cartographer-project/cartographer_ros.git
cd ..
catkin_make

问题:

PluginlibFactory: The plugin for class ‘Submaps’ failed to load.
Error: Could not find library corresponding to plugin Submaps. Make
sure the plugin description XML file has the correct name of the
library and that the library actually exists.

解决方案:

sudo apt install ros-melodic-cartographer-rviz

问题:

Client [/rviz] wants topic /submap_list to have datatype/md5sum
[cartographer_ros_msgs/SubmapList/6efe809c4a0e69266aa99b3bea531f2a],
but our version has
[cartographer_ros_msgs/SubmapList/73b1e412208f0787050395996f6143db].
Dropping connection.

解决方案:

SubmapList.h文件
将6efe809c4a0e69266aa99b3bea531f2a替换为73b1e412208f0787050395996f6143db

测试

进入cartographer官网下载数据集.

测试2d:

roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=/填写你的数据集文件路径

Cartographer安装及过程中出现的问题_第1张图片

测试3d:

roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=/填写你的数据集文件路径

Cartographer安装及过程中出现的问题_第2张图片

你可能感兴趣的:(slam,ros,linux,自动驾驶)