install_carto.sh:
```bash
#!/bin/bash
# cyun 一键安装cartographer源码环境
# 2024.3.6
# 需要git可用(科学上网)
# 1. 安装依赖
sudo apt-get update
sudo apt-get install -y \
cmake \
g++ \
git \
google-mock \
libboost-all-dev \
libcairo2-dev \
libeigen3-dev \
libgflags-dev \
libgoogle-glog-dev \
liblua5.2-dev \
libprotobuf-dev \
libsuitesparse-dev \
libwebp-dev \
ninja-build \
protobuf-compiler \
sphinx-common
cd ~/Documents
if [ ! -d "ceres-solver" ]; then
git clone https://github.com/ceres-solver/ceres-solver.git
fi
echo "ceres Document Ready"
cd ceres-solver
git checkout 1.14.x
mkdir -p build
cd build
if [ ! -f "Makefile" ]; then
cmake ..
fi
make -j16
sudo make install
cd ~/Documents
if [ ! -d "protobuf" ]; then
git clone https://ghproxy.com/https://github.com/google/protobuf.git
fi
echo "protobuf Document Ready"
cd protobuf
git checkout v3.6.1
mkdir -p build
cd build
if [ ! -f "Makefile" ]; then
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF ../cmake
fi
make -j16
sudo make install
cd ~/Documents
if [ ! -d "cartographer" ]; then
git clone https://gitee.com/BlueWhaleRobot/cartographer.git
fi
cd cartographer
mkdir -p build
cd build
if [ ! -f "Makefile" ]; then
cmake ..
fi
make -j16
sudo make install
cd ~/forklift_ws/src
if [ ! -d "cartographer_ros" ]; then
git clone https://git.bwbot.org/publish/cartographer_ros
fi
cd ..
catkin_make
cd ~/forklift_ws/src
if [ ! -d "Hybrid_A_Star" ]; then
git clone https://github.com/zm0612/Hybrid_A_Star
fi
cd ..
catkin_make
cd ~/forklift_ws/src
if [ ! -d "pointcloud_to_laserscan" ]; then
git clone https://github.com/BluewhaleRobot/pointcloud_to_laserscan.git
fi
cd ..
catkin_make
echo "脚本执行完毕"
echo "2D:"
echo "wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag"
echo "测试命令:source ros 环境;roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:='/home/cyun/Downloads/cartographer_paper_deutsches_museum.bag'"
echo "3D:"
echo "wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/with_intensities/b3-2016-04-05-14-14-00.bag"
echo "roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag"
chmod +x给到权限,执行:
./install_carto.sh:
满足条件的话基本可以一键安装cartographer。
给出了测试用的数据和命令。