激光slam cartographer源码安装及配置文件(二)

激光slam cartographer源码安装及配置文件(二)

  系统版本:ubuntu20.04

  ros版本:noetic

1.安装cartographer

  cartographer一定要安装成功,才能进行后续导航的操作等。

  (1)源码主要采用李想老师详细注释的cartographer,源码地址:https://github.com/xiangli0608/cartographer_detailed_comments_ws(侵权删)

  (2)cartographer所依赖的包很多,安装过程中容易出错,耐心解决,介绍几篇安装教程:

  https://blog.csdn.net/m0_45805756/article/details/126309855(侵权删)

  https://www.guyuehome.com/34165(侵权删)

  以及google官方发出的安装教程:

  https://google-cartographer.readthedocs.io/en/latest/#system-requirements(侵权删)

  https://google-cartographer-ros.readthedocs.io/en/latest/compilation.html(侵权删)

2.cartographer纯定位参数配置

  backpack_2d.lua参数配置如下:


include "map_builder.lua"
include "trajectory_builder.lua"

options = {
  map_builder = MAP_BUILDER,
  trajectory_builder = TRAJECTORY_BUILDER,
  map_frame = "map",
  tracking_frame = "base_footprint", -- base_footprint是gazebo仿真模型上自带的
  published_frame = "base_footprint",
  odom_frame = "odom",
  provide_odom_frame = true,  -- cartographer自带的里程计
  publish_frame_projected_to_2d = false,
  publish_tracked_pose = true,  -- 发布小车位置
  
  use_pose_extrapolator = false,
  use_odometry = false,  -- 自己使用的里程计
  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.num_accumulated_range_data = 1

MAP_BUILDER.use_trajectory_builder_2d = true
MAP_BUILDER.num_background_threads = 4
TRAJECTORY_BUILDER_2D.num_accumulated_range_data = 1
TRAJECTORY_BUILDER_2D.submaps.num_range_data = 40
TRAJECTORY_BUILDER_2D.min_range = 0
TRAJECTORY_BUILDER_2D.max_range = 12
TRAJECTORY_BUILDER_2D.min_z = 0

TRAJECTORY_BUILDER_2D.voxel_filter_size = 0.015  -- modify
TRAJECTORY_BUILDER_2D.loop_closure_adaptive_voxel_filter.max_length = 0.015
TRAJECTORY_BUILDER_2D.loop_closure_adaptive_voxel_filter.max_range = 12

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.angular_search_window = math.rad(10.)
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
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.occupied_space_weight = 10
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.translation_weight = 1
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.rotation_weight = 0.1

TRAJECTORY_BUILDER_2D.adaptive_voxel_filter.max_length = 0.015
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.ceres_solver_options.max_num_iterations = 50
TRAJECTORY_BUILDER_2D.adaptive_voxel_filter.max_range = 12.  -- yuan 30
TRAJECTORY_BUILDER_2D.motion_filter.max_time_seconds = 1.

POSE_GRAPH.optimize_every_n_nodes = 0
POSE_GRAPH.optimization_problem.huber_scale = 1e2
POSE_GRAPH.constraint_builder.sampling_ratio = 0.1  --修改 0.2
POSE_GRAPH.constraint_builder.max_constraint_distance = 6  --修改 
POSE_GRAPH.constraint_builder.min_score = 0.65  -- 修改 原0.65
POSE_GRAPH.constraint_builder.global_localization_min_score = 0.55
POSE_GRAPH.global_sampling_ratio = 0.001  --0.005

POSE_GRAPH.constraint_builder.ceres_scan_matcher.ceres_solver_options.max_num_iterations = 50 -- 修改 原注释

return options

  demo_backpack_2d_localization.launch参数配置


<launch>
  <param name="/use_sim_time" value="true" />

  <param name="/localization" type="bool" value = "1"/>
  <param name="/set_inital_pose_x" type="double" value = "0"/>
  <param name="/set_inital_pose_y" type="double" value = "0"/>
  <param name="/set_inital_pose_z" type="double" value = "0.0"/>
  <param name="/set_inital_pose_ox" type="double" value = "0.0"/>
  <param name="/set_inital_pose_oy" type="double" value = "0.0"/>
  <param name="/set_inital_pose_oz" type="double" value = "0"/>
  <param name="/set_inital_pose_ow" type="double" value = "1"/>

  <node name="cartographer_node" pkg="cartographer_ros"
      type="cartographer_node" args="
          -configuration_directory $(find cartographer_ros)/configuration_files
          -configuration_basename backpack_2d_localization.lua
          -load_state_filename /home/space/map/carto_ws_fangzhen/map/2d-1.pbstream"
      output="screen">
    <remap from="scan" to="/scan" />
    <!-- <remap from="odom" to="/odom" /> -->
  </node>

  <!-- <node pkg="tf" type="static_transform_publisher" name="laser_broadcaster" args="0.58 0 0 0 0 0 base_link scan 8" /> -->
  <!-- 一定要是base_footprint和base_scan,这是gazebo仿真模型里的frame_id -->
  <node pkg="tf" type="static_transform_publisher" name="laser_broadcaster" args="0.05 0 0 0 0 0 base_footprint base_scan 50" />
  



  <node name="cartographer_occupancy_grid_node" pkg="cartographer_ros"
      type="cartographer_occupancy_grid_node" args="-resolution 0.05
                                                    -pure_localization 1" /> -->


  <!-- <node name="rviz" pkg="rviz" type="rviz" required="true"
      args="-d $(find cartographer_ros)/configuration_files/demo_2d.rviz" /> -->

</launch>

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值