ROS与SLAM入门教程-cartographer在Turltlebot的应用2-hitcm安装修改版
ROS与SLAM入门教程-cartographer在Turltlebot的应用2
说明
- 这个安装方法,已经不推荐,请使用cartographer在Turltlebot的应用1-官方安装及补充
- 介绍安装google 的SLAM算法cartographer,并运行回放。
- 此方法来自hitcm,经过本人的测试和做了一些小改动。
- 此方法不需要翻墙安装
- 需要安装3个软件包,ceres solver、cartographer和cartographer_ros。为了管理方便,建立carto目录来存放ceres solver、cartographer。
$ mkdir -p ~/carto
- 安装依赖
sudo apt-get install -y google-mock libboost-all-dev libeigen3-dev libgflags-dev libgoogle-glog-dev liblua5.2-dev libprotobuf-dev libsuitesparse-dev libwebp-dev ninja-build protobuf-compiler python-sphinx ros-indigo-tf2-eigen libatlas-base-dev libsuitesparse-dev liblapack-dev
- 首先安装ceres solver,选择的版本是1.11
cd ~/carto
git clone https://github.com/hitcm/ceres-solver-1.11.0.git
cd ceres-solver-1.11.0/build #如果build目录不存在,就自己建mkdir build
cmake ..
make –j
sudo make install
- 然后安装 cartographer
cd ~/carto
git clone https://github.com/hitcm/cartographer.git
cd cartographer/build #如果build目录不存在,就自己建mkdir build
cmake .. -G Ninja #3
ninja
ninja test
sudo ninja install
上述第3步执行错误的同学可以忽略3-6步,改用下面的方法。
cmake ..
make
sudo make install
- 安装cartographer_ros
谷歌官方提供的安装方法比较繁琐,我对原来的文件进行了少许的修改,核心代码不变,只是修改了编译文件
- 下载到catkin_ws下面的src文件夹下面
git clone https://github.com/hitcm/cartographer_ros.git
- 然后到catkin_ws下面运行
$ catkin_make
- 新包加入环境
$ source ~/.bashrc
$ rospack profile
- 数据下载测试, 并上传到carto目录下。
- 2d数据,大概500M,用迅雷下载
https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
- 3d数据,8G左右,同样用迅雷下载
https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/b3-2016-04-05-14-14-00.bag
- 然后运行launch文件即可。
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/carto/cartographer_paper_deutsches_museum.bag
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/carto/b3-2016-04-05-14-14-00.bag
- 刚开始使用ROS的同学运行下面两句是无法工作的,可能出现的错误如下。
[demo_backpack_2d.launch] is neither a launch file in package [cartographer_ros] nor is [cartographer_ros] a launch file name
The traceback for the exception was written to the log file
这种错误的主要原因是ros的catkin_ws配置问题,可以运行rospack profile试试。
实在不行还有如下所示的两种解决方法。推荐第二种。
最终结果如下图
- 2d效果
- 3d效果
参考:
- http://www.cnblogs.com/hitcm/p/5939507.html
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号