参考网址:

(124条消息) (实测成功安装)ubuntu18.04+ros(melodic)安装 cartographer安装_我想lu内只狗的博客-CSDN博客

安装carto

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 安装工具
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build stow
# 创建初始空间
mkdir -p cart_ws/src
cd cart_ws
wstool init src
# 下载包
cd src
git clone https://ghproxy.com/https://github.com/cartographer-project/cartographer
git clone https://ghproxy.com/https://github.com/cartographer-project/cartographer_ros
git clone -b 1.14.x https://ghproxy.com/https://github.com/ceres-solver/ceres-solver
# 添加依赖
cd .. &&src/cartographer/scripts/install_abseil.sh
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
# 编译安装
catkin_make_isolated --install --use-ninja

安装ceres-solver

1
2
3
4
5
git clone https://ceres-solver.googlesource.com/ceres-solver
cd ceres-solver
mkdir build&&cd build
cmake ..
make -j8&&sudo make install

测试

测试包

1
2
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=/home/fairy/Downloads/b0-2014-07-11-11-00-49.bag
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=/home/fairy/Downloads/b3-2016-03-01-13-39-41.bag

修改~/.bashrc

1
2
3
sudo echo "source ~/cart_ws/devel_isolated/setup.bash" >> ~/.bashrc
source ~/.bashrc
echo $ROS_PACKAGE_PATH