ROS机器人底盘(29)-cartographer的测试

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-1.11.0/build
cmake ..
make –j4  # 这里如果出错(见下图),可以多次执行
sudo make install
ROS机器人底盘(29)-cartographer的测试_第1张图片
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,这里我们启动robot_without_odom.launch

roslaunch pibot_bringup robot_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

ROS机器人底盘(29)-cartographer的测试_第2张图片

5.查看建图

可是说好的建图的,图呢,没图说个jb.jpg,同样我们在rviz显示建图结果

roslaunch pibot_navigation view_cartographer.launch
ROS机器人底盘(29)-cartographer的测试_第3张图片

6.疑问

对于4.测试cartographer
有的同学要问为什么不把这个2个写到一个launch,这个问题问的好,博主试着写到一起,启动不正常 ,还不知道具体原因,有兴趣的可以一起探讨

附上之前的launch文件


  
  

你可能感兴趣的:(ROS机器人底盘(29)-cartographer的测试)