Ubuntu18.04 install cartographer

foreword

In fact, there are many tutorials on the Internet. The first two installations did not record how I installed them. As a result, this is the third installation for me, and there are still errors everywhere, so I still record how I installed them. If it is convenient for you to use it in the future, you only need your own blog, and you don't need to open web pages everywhere.

Premise environment: I can get on the tubing (all know

Install cartographer

18.04 supports direct installation

#根目录下
sudo apt-get update
sudo apt-get install ros-melodic-cartographer*  
#安装依赖
sudo apt-get install -y \
          g++ \
          git \
          google-mock \
          libboost-all-dev \
          libcairo2-dev \
          libeigen3-dev \
          libgflags-dev \
          libgoogle-glog-dev \
          liblua5.2-dev \
          libsuitesparse-dev \
          ninja-build \
          python-sphinx

#安装wstool和rosdep
sudo apt-get install -y python-wstool python-rosdep ninja-build

Create a workspace

mkdir carto_ws
cd carto_ws
wstool init src

Download the code for cartographer, cartographer_ros, ceres-solver

cd ~/carto_ws/src
git clone https://github.com/googlecartographer/cartographer_ros.git
git clone https://github.com/googlecartographer/cartographer.git
git clone https://github.com/ceres-solver/ceres-solver.git

Install proto3 and other dependencies

cd ~/carto_ws
sudo apt-get install autoconf autogen
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git submodule update --init --recursive
./autogen.sh
./configure
make
make check
sudo make install
sudo ldconfig 
cd ~/carto_ws
sudo rosdep init #报错直接跳过
rosdep update 
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y

Compile and install

catkin_make_isolated --install --use-ninja #见报错1
source install_isolated/setup.bash

Download DEMO test
2d slam

wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag

successfully
insert image description here

Error 1:

<== Failed to process package 'cartographer': 
  Command '['cmake', '/home/willingham/carto_ws/src/cartographer', '-DCMAKE_INSTALL_PREFIX=/home/willingham/carto_ws/install_isolated', '-G', 'Ninja']' returned non-zero exit status 1

Reproduce this error by running:
==> cd /home/willingham/carto_ws/build_isolated/cartographer && cmake /home/willingham/carto_ws/src/cartographer -DCMAKE_INSTALL_PREFIX=/home/willingham/carto_ws/install_isolated -G Ninja

Command failed, exiting.

insert image description here
It is said on the Internet that there may be a proto version problem. You can protoc --versionquery the version. You should need proto3. Mine is 3.15.8. But mine is not this problem.

My solution is:
Install cartographer for the following error? –Failed to process package 'cartographer': An error was reported
during this process. It was found that there was a problem with absl, and I checked here to install cartographer, but could not find "absl" solutioncmake .. -G Ninja
insert image description here

The final solution concluded:

sudo apt-get install stow
sudo chmod +x ~/carto_ws/src/cartographer/scripts/install_abseil.sh
cd ~/carto_ws/src/cartographer/scripts
./install_abseil.sh

Then re- catkin_make_isolated --install --use-ninja
successfully get:
insert image description here

Guess you like

Origin blog.csdn.net/qq_41746268/article/details/116310148