Ros notes -- cartographer installation

Posted by f1nutter on Fri, 31 Dec 2021 07:44:59 +0100

1. The address link of the official installation tutorial of cartographer
https://google-cartographer-ros.readthedocs.io/en/latest/compilation.html
2. Installation problem record
Many problems occurred during the installation according to the official steps, which are recorded here one by one:
2.1 error in running command

wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall

resolvent:
1) Enter web address: IP query website Query raw githubusercontent. Com IP address

The figure above shows that multiple ip addresses of the website have been found, so we can just select one, and then modify the hosts file as follows:

sudo gedit /etc/hosts
 Enter into hosts After the file, you can see some ip Address, we need to put the just found ip Add the address to the file
185.199.108.133  raw.githubusercontent.com

2.2 error in running command

wstool update -t src

Running this command may cause errors, such as cartographer cloning failure or cartographer_ros clone failed
The solution to this problem is to rerun the command.
2.3 operation command error

src/cartographer/scripts/install_abseil.sh

An error is reported when running this command. The clone cannot succeed
It can be solved by the following methods:

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

2.4 running command error

catkin_make_isolated --install --use-ninja

The reason for this problem should be the wrong version of the protocol, because Ubuntu 16 04 the version of protocol installed by default is 2.6 1. If the version is too low, an error will be reported when cartographer is installed. Therefore, it is necessary to uninstall protocol and further install a new version of protocol
1) Uninstall ubuntu's own protoc ol
To view the current protoc ol information:

which protoc
protoc --version

Uninstall protoc ol. The path of the second command is subject to the output of the first command above

sudo apt-get remove libprotobuf-dev
rm /usr/local/bin/protoc

2) Install dependent Libraries

sudo apt-get install autoconf automake libtool curl make g++ unzip

3) Clone source code

git clone -b v3.6.0 https://github.com/protocolbuffers/protobuf.git
// The above command indicates that the clone version is 3.6 protobuf source code of 0
cd protobuf
git submodule update --init --recursive
// This command means cloning the sub modules of protobuf, mainly gtest
// Enter the cloned protobuf directory. Of course, if you were in this directory before, you don't have to cd again
cd protobuf
./autogen.sh
./configure
make
// If there is no clone sub module, make check will fail, but you can continue to make install, but errors may occur when using some functions
make check
sudo make install
sudo ldconfig
// If the protobuf version information is output, the installation is successful
protoc --version
which protoc

The result of viewing the location should be:

/usr/local/bin/protoc

Copy / usr / local / bin / protocol to another path

sudo cp /usr/local/bin/protoc /usr/bin

Another error may be that you need to check whether the cmakelist in each downloaded installation package Txt does not support C + + language to compile, we must be optimistic. If it is really caused by this problem, you need to be in the cartographer folder, cartographer_ Cartographer under ROS folder_ ros cartographer_ There are three cmakelists under the rviz two folders Txt to add the following statement:

add_definitions(-std=c++11)

It's best to add it a little closer to the front.

Topics: Linux