cartographer安装网上有一堆教程,但是发现,都不是太好使。
环境:
ubutnu kinetic 16.04
- 官网安装教程: https://google-cartographer-ros.readthedocs.io/en/latest/compilation.html
首先:
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build stow
然后:
mkdir catkin_ws
cd catkin_ws
wstool init src
wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src
发现 .rosinstall中:
# THIS IS AN AUTOGENERATED FILE, LAST GENERATED USING wstool ON 2021-07-05
- git:
local-name: cartographer
uri: https://github.com/cartographer-project/cartographer.git
version: master
- git:
local-name: cartographer_ros
uri: https://github.com/cartographer-project/cartographer_ros.git
version: master
其次:
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
kinetic已经停止更新,所以rosdep可能会失败,参照我另外一篇文章。
rosdep website may be down
最后(先卸载sudo apt-get remove ros-${ROS_DISTRO}-abseil-cpp
):
src/cartographer/scripts/install_abseil.sh
安装文件内容如下:
```cpp
set -o errexit
set -o verbose
git clone https://github.com/abseil/abseil-cpp.git
cd abseil-cpp
git checkout d902eb869bcfacc1bad14933ed9af4bed006d481
mkdir build
cd build
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_INSTALL_PREFIX=/usr/local/stow/absl \
..
ninja
sudo ninja install
cd /usr/local/stow
sudo stow absl
安装Ceres(install_ceres.sh)
set -o errexit
set -o verbose
VERSION="1.13.0"
# Build and install Ceres.
git clone https://ceres-solver.googlesource.com/ceres-solver
cd ceres-solver
git checkout tags/${VERSION}
mkdir build
cd build
cmake .. -G Ninja -DCXX11=ON
ninja
CTEST_OUTPUT_ON_FAILURE=1 ninja test
sudo ninja install
安装proto3***(这一步非常重要,版本也很重要,但是我并没有用下面这个脚本)***
#!/bin/sh
set -o errexit
set -o verbose
VERSION="v3.4.1"
# Build and install proto3.
git clone https://github.com/google/protobuf.git
cd protobuf
git checkout tags/${VERSION}
mkdir build
cd build
cmake -G Ninja \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_BUILD_TYPE=Release \
-Dprotobuf_BUILD_TESTS=OFF \
../cmake
ninja
sudo ninja install
真正的安装方法proto3:
- 卸载proto2,以及以前安装的proto3(前提是你安装过)
参考安装采坑
1.看哪里有安装protoc:
whereis protoc
现在用的protoc是在哪里安装的:
which protoc
查看目前正在使用的protoc版本:
protoc --version
2、删除安装目录的安装包,例如下面的命令:
rm /usr/local/bin/protoc
3、注意 usr/include/protocs
sudo apt-get remove libprotobuf-dev
- 下载
https://github.com/protocolbuffers/protobuf
- 切换分支
git checkout tags/v3.6.0
- 进入src查看README.md
先安装依赖库
sudo apt-get install autoconf automake libtool curl make g++ unzip
再安装proto本身
./autogen.sh
./configure --prefix=/usr
make
make check #check 失败也没有关系,可能某些特性没有用
sudo make install
sudo ldconfig
如果不是安装到/usr里面,注意设置超链接
sudo ln -s /usr/local/bin/protoc /usr/bin/protoc
安装完成之后查看版本
protoc --version
显示版本
依赖安装完成之后,编译(不安装)
catkin_make_isolated