ROS下使用rplidar运行google cartographer

什么是cartographer?

大家可以前往知乎:https://www.zhihu.com/question/51348391/answer/125450382,很多大神给了比较细节的解释。

附上google的论文:https://static.googleusercontent.com/media/research.google.com/zh-CN//pubs/archive/45466.pdf


安装cartographer

google给了ROS-indigo版本的官方教程:https://google-cartographer-ros.readthedocs.io/en/latest/

在catkin_make_isolated --install --use-ninja这一步,需要连接国外网下载ceres-solver,如果没有,会提示下载ceres-solver失败,这里我是使用hitcm大神的方法http://www.cnblogs.com/hitcm/p/5939507.html

安装完毕以后就可以跑官方的demo了


rplidar的安装

首先需要去http://www.slamtec.com/cn/Lidar下载SDK和ROS软件包,安装方法见:https://github.com/robopeak/rplidar_ros/wiki


使用rplidar运行cartographer

修改cartographer_ros--cartographer_ros--launch--demo_revo_lds.launch



  
  
    
  
  

修改cartographer_ros--cartographer_ros--configuration_files--revo_lds.lua

include "map_builder.lua"

options = {

  map_builder = MAP_BUILDER,

  sensor_bridge = {

    horizontal_laser_min_range = 0.3,

    horizontal_laser_max_range = 8,

    horizontal_laser_missing_echo_ray_length = 1.2,

    constant_odometry_translational_variance = 0.,

    constant_odometry_rotational_variance = 0.,

  },

  map_frame = "map",

  tracking_frame = "laser",

  published_frame = "laser",

  odom_frame = "odom",

  provide_odom_frame = true,

  use_odometry_data = false,

  use_constant_odometry_variance = true,

  constant_odometry_translational_variance = 1e-2,

  constant_odometry_rotational_variance = 1e-1,

  use_horizontal_laser = true,

  use_horizontal_multi_echo_laser = false,
  
  horizontal_laser_min_range = 0.1,
  
  horizontal_laser_max_range = 30.,
  
  horizontal_laser_missing_echo_ray_length = 5.,

  num_lasers_3d = 0,

  lookup_transform_timeout_sec = 0.2,

  submap_publish_period_sec = 0.3,

  pose_publish_period_sec = 5e-3,

}

MAP_BUILDER.use_trajectory_builder_2d = true

TRAJECTORY_BUILDER_2D.use_imu_data = false

TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true

SPARSE_POSE_GRAPH.optimization_problem.huber_scale = 1e2

return options

修改完以上2个文件重新编译一下,命令行输入

catkin_make_isolated -install -use-ninja


最后命令行中运行rplidar的Node和launch文件

roslaunch rplidar_ros rplidar.launch 

新终端输入:roslaunch cartographer_ros demo_revo_lds.launch


运行结果如下:

ROS下使用rplidar运行google cartographer_第1张图片


因为是把激光雷达连在电脑上的,不方便移动,所以仅仅构建了格子间一小块区域的地图。


最后感谢腾哥的指导!


如果您对本文内容有任何问题,欢迎大家一起讨论。



你可能感兴趣的:(ROS下使用rplidar运行google cartographer)