ros 安装cartographer

安装步骤如下:(完全follow 官网):

# Install wstool and rosdep.
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build

# Create a new workspace in 'catkin_ws'.
mkdir catkin_ws
cd catkin_ws
wstool init src

# Merge the cartographer_ros.rosinstall file and fetch code for dependencies.
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src

# Install deb dependencies.
# The command 'sudo rosdep init' will print an error if you have already
# executed it since installing ROS. This error can be ignored.
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y

# Build and install.
catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash

在上面的catkin_make_isolated --install --use-ninja 这一步时遇到一个build error

CMake Error at /home/xxx/catkin_ws/install_isolated/lib/cmake/Ceres/CeresConfig.cmake:88 (message):
Failed to find Ceres - Missing requested Ceres components:
[SparseLinearAlgebraLibrary] (components requested:

解决办法:

在/home/xxx/catkin_ws_cartographer/build_isolated/ceres-solver/install/CMakeCache.txt 里找到EIGENSPARSE:BOOL=OFF , 把OFF 改成ON

重新:

catkin_make_isolated --install --use-ninja就OK.



运行cartographer算法来建图:

下载bag数据:下载2d的bag 数据(要v*n)
mkdir ~/map_data 
cd ~/map_data 
wget  https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
run cartographer建图: 
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/map_data/cartographer_paper_deutsches_museum.bag

过程比较漫长,rqt_graph 查看节点之间的关系,如下图所示:
ros 安装cartographer
ros 安装cartographer


建的地图长相:todo 补上