• cartographer接入2D雷达laser+odom+imu实时建图


    前言

    书接上回,我们用laser+imu进行了实时建图,接下来我们来加一下odom。
    接下来的首先是laser+odom进行建图
    最后再进行laser+imu+odom进行建图

    1 接入odom

    1.1 odom的驱动

    我手上暂时没有轮式里程计,目前先用rf2o生成里程计数据接入,关于rf2o的安装方式已经比较多了,我这边就不一一讲了。

    然后需要注意的就是rf2o的launch文件中,需要进行修改,修改后的如下

    <launch>
    
      <node pkg="rf2o_laser_odometry" type="rf2o_laser_odometry_node" name="rf2o_laser_odometry" output="screen">
        <param name="laser_scan_topic" value="/horizontal_laser_2d"/>        # topic where the lidar scans are being published
        <param name="odom_topic" value="/odom" />              # topic where tu publish the odometry estimations
        <param name="publish_tf" value="false" />                   # wheter or not to publish the tf::transform (base->odom)
        <param name="base_frame_id" value="base_link"/>            # frame_id (tf) of the mobile robot base. A tf transform from the laser_frame to the base_frame is mandatory
        <param name="odom_frame_id" value="/odom" />                # frame_id (tf) to publish the odometry estimations    
        <param name="init_pose_from_topic" value="" /> # (Odom topic) Leave empty to start at point (0,0)
        <param name="freq" value="6.0"/>                            # Execution frequency.
        <param name="verbose" value="true" />                       # verbose
      node>
      
    launch>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    修改主要就是话题给接上,其他的参考别人的博客即可

    1.2 修改revo_lds.lua

    跟着上一个博客的,已经做过修改了,这次我们只需要修改两个地方,将imu设置为false,odom设置为true,文件如下

    include "map_builder.lua"
    include "trajectory_builder.lua"
    
    options = {
      map_builder = MAP_BUILDER,
      trajectory_builder = TRAJECTORY_BUILDER,
      map_frame = "map",
      tracking_frame = "base_link", -- horizontal_laser_link
      published_frame = "base_link", -- horizontal_laser_link
      odom_frame = "odom",
      provide_odom_frame = true,
      publish_frame_projected_to_2d = false,
      use_odometry = true,
      use_nav_sat = false,
      use_landmarks = false,
      num_laser_scans = 1,
      num_multi_echo_laser_scans = 0,
      num_subdivisions_per_laser_scan = 1,
      num_point_clouds = 0,
      lookup_transform_timeout_sec = 0.2,
      submap_publish_period_sec = 0.3,
      pose_publish_period_sec = 5e-3,
      trajectory_publish_period_sec = 30e-3,
      rangefinder_sampling_ratio = 1.,
      odometry_sampling_ratio = 1.,
      fixed_frame_pose_sampling_ratio = 1.,
      imu_sampling_ratio = 1.,
      landmarks_sampling_ratio = 1.,
    }
    
    MAP_BUILDER.use_trajectory_builder_2d = true
    
    TRAJECTORY_BUILDER_2D.submaps.num_range_data = 35
    TRAJECTORY_BUILDER_2D.min_range = 0.3
    TRAJECTORY_BUILDER_2D.max_range = 20.
    TRAJECTORY_BUILDER_2D.missing_data_ray_length = 1.
    TRAJECTORY_BUILDER_2D.use_imu_data = false
    TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true
    TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.linear_search_window = 0.1
    TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.translation_delta_cost_weight = 10.
    TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.rotation_delta_cost_weight = 1e-1
    
    POSE_GRAPH.optimization_problem.huber_scale = 1e2
    POSE_GRAPH.optimize_every_n_nodes = 35
    POSE_GRAPH.constraint_builder.min_score = 0.65
    
    return options
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47

    这个时候按顺序启动laser.launch、of2o.launch、demo_revo_lds.launch即可,然后发现就可以建图了,rqt_graph和tf都是正确的

    2 接入imu和odom

    只要是从上一个博客跟着到现在,就会发现很简单了,只需要设置revo_lds.lua中的一个参数即可,TRAJECTORY_BUILDER_2D.use_imu_data设置为启动,文件如下

    include "map_builder.lua"
    include "trajectory_builder.lua"
    
    options = {
      map_builder = MAP_BUILDER,
      trajectory_builder = TRAJECTORY_BUILDER,
      map_frame = "map",
      tracking_frame = "base_link", -- horizontal_laser_link
      published_frame = "base_link", -- horizontal_laser_link
      odom_frame = "odom",
      provide_odom_frame = true,
      publish_frame_projected_to_2d = false,
      use_odometry = true,
      use_nav_sat = false,
      use_landmarks = false,
      num_laser_scans = 1,
      num_multi_echo_laser_scans = 0,
      num_subdivisions_per_laser_scan = 1,
      num_point_clouds = 0,
      lookup_transform_timeout_sec = 0.2,
      submap_publish_period_sec = 0.3,
      pose_publish_period_sec = 5e-3,
      trajectory_publish_period_sec = 30e-3,
      rangefinder_sampling_ratio = 1.,
      odometry_sampling_ratio = 1.,
      fixed_frame_pose_sampling_ratio = 1.,
      imu_sampling_ratio = 1.,
      landmarks_sampling_ratio = 1.,
    }
    
    MAP_BUILDER.use_trajectory_builder_2d = true
    
    TRAJECTORY_BUILDER_2D.submaps.num_range_data = 35
    TRAJECTORY_BUILDER_2D.min_range = 0.3
    TRAJECTORY_BUILDER_2D.max_range = 20.
    TRAJECTORY_BUILDER_2D.missing_data_ray_length = 1.
    TRAJECTORY_BUILDER_2D.use_imu_data = true
    TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true
    TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.linear_search_window = 0.1
    TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.translation_delta_cost_weight = 10.
    TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.rotation_delta_cost_weight = 1e-1
    
    POSE_GRAPH.optimization_problem.huber_scale = 1e2
    POSE_GRAPH.optimize_every_n_nodes = 35
    POSE_GRAPH.constraint_builder.min_score = 0.65
    
    return options
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47

    然后启动雷达、imu、rf2o和carto即可

  • 相关阅读:
    [附源码]计算机毕业设计JAVA医疗预约系统
    leetcode 35. 搜索插入位置(二分法+找性质也很关键)
    学信息系统项目管理师第4版系列20_风险管理
    32位增强型低功耗Cortex-M3单片机CH32F203C8T6
    【英语:基础高阶_经典外刊阅读】L1.阅读理解—读题定位法
    SpringBoot集成SpringSecurity从0到1搭建权限管理详细过程(认证+授权)
    Spring Boot中配置多个数据源
    1.order by 注入 2.limit 注入 3.宽字节注入
    Debian12通过Docker安装mariadb数据库(mysql可参考)
    C#知识|基于实体类对象,返回实体集合封装介绍。
  • 原文地址:https://blog.csdn.net/qq_39502099/article/details/126027199