首先说明,这篇文章于2019年12月写下,cartographer如今还在不断更新,也许这篇文档内容会失效,可是大致是同样的安装流程。html
使用平台python
ROS发行版git
1. 先安装一些必要的安装工具:python-wstool、python-rosdep和ninja;github
sudo apt-get update sudo apt-get install -y python-wstool python-rosdep ninja-build
2. 建立一个cartographer_ros的工做空间,命名为"catkin_ws",并初始化。api
mkdir catkin_ws cd catkin_ws wstool init src # 这里先增长一个.rosinstall文件,修改内容以下一段 wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall wstool update -t src
- git: {local-name: cartographer, uri: 'https://github.com/googlecartographer/cartographer.git', version: '1.0.0'} - git: {local-name: cartographer_ros, uri: 'https://github.com/googlecartographer/cartographer_ros.git', version: '1.0.0'} - git: {local-name: ceres-solver, uri: 'https://github.com/ceres-solver/ceres-solver.git', version: '1.13.0'}
3. 安装cartographer_ros的依赖项(proto3和deb软件包)。若是自安装ROS以来已经执行过初始化rosdep的命令,则命令'sudo rosdep init'将显示错误,该错误能够忽略。bash
# 脚本内容是配置了一些环境变量,而后用git下载proto3(确定比较慢,能够手动下载),若是手动下载了proto3,里面须要改内容,内容在下一段。 src/cartographer/scripts/install_proto3.sh # 这句初始化rosdep,通常正常安装ros都执行过,能够不用管。 sudo rosdep init # 下面这两句,是经常使用来一键安装该工做空间下全部依赖包的,务必熟练使用 rosdep update rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
# 只是注释掉了git下载和切换的内容。 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
4. 构建并安装。服务器
# 用ninja工具进行catkin的编译 catkin_make_isolated --install --use-ninja
注意:工具
sudo gedit /etc/hosts
增长如下内容(给dns指定了github的服务器地址):测试
# 建议在http://ip.tool.chinaz.com/github.com查询如下三个网址对应的ip,这里是2019-12月的数据,可能会改变 github.com 13.250.177.223 assets-cdn.github.com 185.199.108.153 github.global.ssl.fastly.net 75.126.215.88
重启networking
sudo /etc/init.d/networking restart
ui
1. 测试数据集
# 这句命令把数据集下载到了Downloads文件夹,若是没有wget工具,能够本身安装 wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag # 记得先配置工做空间到环境变量 echo "source ~/catkin_ws/install_isolated/setup.bash" >> ~/.bashrc # 这句用roslaunch启动了放在对应目录的数据集 roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
随便找了张图:
2. 其余bag数据集
参考文献: