我的Ubuntu 是16.04版本的,ROS版本为Kinetic (安装文档同时也支持indigo版本)
-
#首先安装编译工具,并且更新源 sudo apt-get update sudo apt-get install -y python-wstool python-rosdep ninja-build #创建工作空间 mkdir catkin_ws cd catkin_ws wstool init src # Merge the cartographer_ros.rosinstall file and fetch code for dependencie #在这里通过在catkin环境下生成一个.rosinstall文件,一般文件隐藏,看不到,可以 CTRL+H看到 #同时在这里需要使用goole的包,最好可以FC去下载,不能翻墙也可以看到一些国内在github上的包 wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall wstool update -t src # Install proto3. src/cartographer/scripts/install_proto3.sh # 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
以上为官方提供的安装方法,但是本人在实际的编译中一直遇到关于protof的问题,自己也换了好多的方法,参考官方的文档也无法解决,自己最后通过重新手动安装protof 3.6.1最后重新进行编译才得以通过.(在这个时候,protof 3.6.1是最新的版本,我使用3.4.0官方提供的版本编译无法通过)
-
protof 3.6.1安装如下
下载链接 https://github.com/google/protobuf/releases
官方安装手册:https://github.com/protocolbuffers/protobuf/blob/master/src/README.md
安装:(下载安装all版本)
tar zxvf protobuf-all-3.6.0.tar.gz
cd protobuf-3.6.0/
./configure –prefix=/usr/local/ (安装路径,一般情况下,默认会安装到/usr/include 文件下,我们需要指定安装到,/usr/local/include文件下,安装完成会有一个goole文件在/usr/local/include 下)
make
make check
make install
protoc –version #查看版本
- 在完成新版本的protof时,就可以删掉原来编译生成的文件,重新进行编译,即可通过.
- 可以通过使用官方提供的bag文件进行测试,测试步骤如下:
# Download the 2D backpack example bag.
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
# Launch the 2D backpack demo.
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
# Download the 3D backpack example bag.
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/with_intensities/b3-2016-04-05-14-14-00.bag
# Launch the 3D backpack demo.
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag
- 通过测试,可以使用bag文件绘制出来比较完整的地图
- 测试结果如下
文章可能存在一些问题,有问题可以留言讨论,大家一同学习,邮箱:wenchenwan@outlook.com