之前安装过cartographer,但是意外出了问题,无法编译,删除之后就再也无法成功安装,最后的编译一直会出各种错误,试了好久终于又重新装上
感谢大佬脚本
GitHub - WLwind/cartographer_installation: Shell script for installing cartographer_rosShell script for installing cartographer_ros. Contribute to WLwind/cartographer_installation development by creating an account on GitHub.https://github.com/WLwind/cartographer_installation里面提供了两个脚本install.sh和install_without_rosdep_init.sh,前者默认可以正常rosdep update,后者默认新装的ros还没有进行过rosdep init。
我是第二次安装,就选择了第一个install.h。内容:
#!/bin/bash -e
set -o errexit
sudo apt update
sudo apt install -y python3-wstool ninja-build stow
mkdir -p ~/cartographer_ws/src
cp .rosinstall ~/cartographer_ws/src/
cd ~/cartographer_ws
wstool update -t src
git clone https://gitee.com/WLwindlinfeng/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
cd ~/cartographer_ws
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
catkin_make_isolated --install --use-ninja -j3
下载直接运行就行,但是有报错,仔细查看发现.rosinstall中没有ceres-solver库,手动添加也不行。编译还不通过。报错没有相应库函数
偶然发现有个外国老哥说要用ceres-solver2.0.0,默认下载安装的都是2.2.0
手动下载2.0.0,最终成功编译
-
手动安装过程:
https://github.com/ceres-solver/ceres-solver/releases/tag/2.0.0
下载tar.gz压缩包到src下,解压
cd ceres-solver-2.0.0/
mkdir build
cd build/
cmake ..
make
sudo make install
安装完成后再回到cartographer工作空间,运行
catkin_make_isolated --install --use-ninja -j3
即可顺利完成编译
-------------------------------------------------------------分割-------------------------------------------------------
事后再运行节点时要source的文件不是devel_isolated/setup.bash,(虽然其他的一般都是)
这个应source的文件路径
source install_isolated/setup.bash