ROS下使用rplidar运行google cartographer

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ywj447/article/details/52922487

什么是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

<launch>

  <param name="/use_sim_time" value="true" />
  <node name="cartographer_node" pkg="cartographer_ros"
      type="cartographer_node" args="
          -configuration_directory $(find cartographer_ros)/configuration_files
          -configuration_basename revo_lds.lua"
      output="screen">
    <remap from="scan" to="scan" />
  </node>
  <node name="rviz" pkg="rviz" type="rviz" required="true"
      args="-d $(find cartographer_ros)/configuration_files/demo_2d.rviz" />
</launch></span>

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

<span style="font-family:SimSun;">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</span>

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

catkin_make_isolated -install -use-ninja


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

roslaunch rplidar_ros rplidar.launch 

新终端输入:roslaunch cartographer_ros demo_revo_lds.launch


运行结果如下:



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


最后感谢腾哥的指导!


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



阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页