1.cartorgrapher介绍
无需过多介绍,大名鼎鼎google开源的slam算法
2.硬件需求
先贴段官方的
64-bit, modern CPU (e.g. 3rd generation i7)
16 GB RAM
Ubuntu 14.04 (Trusty) and 16.04 (Xenial)
gcc version 4.8.4 and 5.4.0
当然越高端越好无论CPU和内存,经测试树莓派是没法玩了,测试了2款RK3399(Ubuntu16
)设备可以跑起来
3.环境准备与编译
3.1安装依赖包
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-kinetic-tf2-eigen libatlas-base-dev libsuitesparse-dev liblapack-dev ros-kinetic-eigen-conversions
3.2编译
- 编译ceres-solver
cd pibot_ros
tar jxvf cartographer.tar.bz2
cd ~pibot_ros/cartographer/ceres-solver/build
cmake ..
make –j4 # 这里如果出错(见下图),可以多次执行
sudo make install
make –j4报错
- 继续cartographer
cd ~pibot_ros/cartographer/cartographer/build
cmake .. -G Ninja
ninja
ninja test
sudo ninja install
- 编译cartorgrapher ros 包
cd ~pibot_ros/cartographer/cartographer_ros
catkin_make
4.测试cartographer
cartograper不依赖里程计,所以不需要发出odom tf
,这里我们启动bringup_without_odom.launch
roslaunch pibot_bringup bringup_without_odom.launch
另外一个终端
source ~pibot_ros/cartographer/cartographer_ros/devel/setup.bash
roslaunch pibot_navigation cartographer.launch
另外一个终端,通过控制小车就可以cartographer建图了
roslaunch pibot keyboard.launch
我们先看下tf tree
,虚拟机中rosrun rqt_tf_tree rqt_tf_tree
可以看到一幅支持的tf tree
了
5.查看建图
可是说好的建图的,图呢,没图说个jb.jpg,同样我们在rviz
显示建图结果
roslaunch pibot_navigation view_cartographer.launch
6.疑问
对于4.测试cartographer中
有的同学要问为什么不把这个2个写到一个launch
,这个问题问的好,博主试着写到一起,启动不正常 ,还不知道具体原因,有兴趣的可以一起探讨
附上之前的launch文件
<launch>
<include file="$(find pibot_bringup)/launch/robot_without_odom.launch"/>
<include file="$(find cartographer_ros)/launch/lidar_2d.launch"/>
</launch>
网友评论