参考文献:Compiling Cartographer ROS
目前cartographer官方支持Ubuntu的以下四个版本,我用的是Ubuntu 18.04,Melodic.
- Indigo
- Kinetic
- Lunar
- Melodic
cartographer官方推荐使用wstool和rosdep构建其ROS运行环境,为了提高构建速度,推荐使用Ninja系统:
$ sudo apt-get update
$ sudo apt-get install -y python-wstool python-rosdep ninja-build
构建新的空间:
$ cd ~
$ mkdir catkin_cartographer_ws
$ cd catkin_cartographer_ws
$ wstool init src
$ wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
$ wstool update -t src
至此,我们发现仅能安装cartographer,cartographer_ros这两个包,ceres-solver这个包不能安装。究其原因,应该是在“software&updates”里面选择的源不恰当造成的。不要紧,我们去全球最大的同性交友网站github上来下载。下面是链接:
[ceres-solver]:
https://github.com/ceres-solver/ceres-solvergithub.com拷贝至与cartographer,cartographer_ros这两个文件夹同等的地址下。
插播1:对于某些证书问题导致的下载指令不能执行的解决办法:
同时,下面这句指令死活不能执行。
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
报错如下:
content.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
ERROR in config: Unable to download URL [https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall]: <urlopen error [Errno 111] Connection refused>
这里卡住我很久,查阅各种资料依然不能解决。
后来通过将linux系统连接了手机热点轻松解决。爽的飞起。
下面我们开始安装cartographer_ros的依赖项 (proto3 and deb packages)。
src/cartographer/scripts/install_proto3.sh
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
插播2:这里面的sudo rosdep init指令遇到了和上面插播1类似的问题
依然通过将linux系统连接了手机热点轻松解决。再次爽的飞起。
构建与安装
catkin_make_isolated --install --use-ninja