第六讲【cartographer】11111

第六讲【cartographer】纯定位参数优化(初级篇)


版权声明:本文转载自CSDN博主「WeSiGJ」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/wesigj/article/details/114652846


系列文章目录

第一讲【ROS-SLAM】2D激光雷达 cartographer构建地图
第二讲 【cartographer】Ubuntu16.04 kinetic 最新版cartographer安装(2020/11/4更新)
第三讲 【cartographer】 添加功能以从RVIZ为纯本地化模式设置初始姿势
第四讲 【cartographer】纯定位 纯本地化 pure_localization
第五讲【cartographer】在仿真环境中 建图 纯定位
第六讲【cartographer】纯定位参数优化(初级篇)



前言

cartographer纯定位参数极其多,要调试的难度很大,在下面,我们来叙述一下cartographer如何进行参数调试。因为如本文有错漏之处,请大家斧正,Thanks♪(・ω・)ノ。


一、cartographer是什么?

https://google-cartographer.readthedocs.io/en/latest/#system-requirements
https://google-cartographer-ros.readthedocs.io/en/latest/compilation.html

Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.

大部分问题可以在cartographer官网中找到解决办法,如果还不可以解决问题,那就上github中的cartographer官方库:

二、纯定位参数优化

1.引入lua文件

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

options = {
  map_builder = MAP_BUILDER,
  trajectory_builder = TRAJECTORY_BUILDER,
  map_frame = "map",
  tracking_frame = "imu_link",
  published_frame = "odom",
  odom_frame = "odom",
  provide_odom_frame = false,
  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.5,
  submap_publish_period_sec = 0.3,
  pose_publish_period_sec = 2e-2,
  --启用将跟踪的姿势发布为geometry_msgs / PoseStamped到主题“ tracked_pose”。
  --publish_tracked_pose_msg = true,
  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.,
  }
  --pure_localization
  POSE_GRAPH.optimize_every_n_nodes = 20
  MAP_BUILDER.num_background_threads = 4
  POSE_GRAPH.global_sampling_ratio = 0.003
  POSE_GRAPH.constraint_builder.sampling_ratio = 0.3
  POSE_GRAPH.constraint_builder.min_score = 0.85
  POSE_GRAPH.global_constraint_search_after_n_seconds = 30
  --pure_localization end
  -- POSE_GRAPH.optimization_problem.log_solver_summary = true

  MAP_BUILDER.use_trajectory_builder_2d = true
  
  TRAJECTORY_BUILDER_2D.submaps.num_range_data = 45
  TRAJECTORY_BUILDER_2D.min_range = 0.05
  TRAJECTORY_BUILDER_2D.max_range = 15.
  TRAJECTORY_BUILDER_2D.missing_data_ray_length = 1.
  TRAJECTORY_BUILDER_2D.use_imu_data = true
  --重力常数
  TRAJECTORY_BUILDER_2D.imu_gravity_time_constant = 9.7883
  
  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(45.)
  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.translation_weight和
  --rotation_weight。越高,将结果从先前移开,换句话说,就越昂贵:扫描匹配必须在要接受的另一个位置产生更高的分数。
  --TRAJECTORY_BUILDER_2D.ceres_scan_matcher.translation_weight = 2e2
  --TRAJECTORY_BUILDER_2D.ceres_scan_matcher.rotation_weight = 4e2


  POSE_GRAPH.optimization_problem.huber_scale = 1e2
  --odom
  -- POSE_GRAPH.optimization_problem.initial_pose_translation_weight = 1e5
  -- POSE_GRAPH.optimization_problem.initial_pose_rotation_weight = 1e5
  -- POSE_GRAPH.optimization_problem.odometry_translation_weight = 1e5
  -- POSE_GRAPH.optimization_problem.odometry_rotation_weight = 1e1
  

return options



2.逐个分析参数

map_frame 用于发布子图的ROS框架ID,即姿势的父框架,通常是“地图”。 tracking_frame
SLAM算法跟踪的帧的ROS帧ID。如果使用IMU,尽管它可能会旋转,但它应该在其位置。常见的选择是“ imu_link”。
published_frame 用作发布姿势的子框架的ROS框架ID。例如,如果“ odom”框架由系统的不同部分提供,则为“
odom”。在这种情况下,将发布map_frame中的“ odom ”姿势。否则,将其设置为“ base_link”可能是适当的。
odom_frame
仅当Provide_odom_frame为true时使用。用于发布(非闭环)本地SLAM结果的published_frame
和map_frame之间的帧。通常是“奥多姆”。 Provide_odom_frame
如果启用,则局部非闭环连续姿势将在map_frame中作为odom_frame发布。
publish_frame_projected_to_2d
如果启用,则发布的姿势将被限制为纯2D姿势(无侧倾,俯仰或z偏移)。这样可以防止在2D模式下由于姿势外推步骤而可能发生的不必要的平面外姿势(例如,如果姿势将被发布为类似“基本足迹”的框架)
use_odometry 如果启用,则订阅主题“ odom ”上的nav_msgs /
Odometry。在这种情况下,必须提供测渗法,并且该信息将包含在SLAM中。 use_nav_sat
如果启用,则在主题“修复”上订阅sensor_msgs /
NavSatFix。在这种情况下,必须提供导航数据,并且该信息将包含在全局SLAM中。 use_landmarks
如果启用,则在主题“地标”上订阅cartographer_ros_msgs /
LandmarkList。必须提供地标,作为cartographer_ros_msgs /
LandmarkList中的cartographer_ros_msgs /
LandmarkEntry。如果提供了cartographer_ros_msgs /
LandmarkEntry数据,则该信息将以根据cartographer_ros_msgs /
LandmarkEntry的ID的形式包含在SLAM中。该cartographer_ros_msgs /
LandmarkList应以与其他传感器相当的采样率提供采样率。该列表可以为空,但必须提供该列表,因为制图师严格按时排序传感器数据以使地标具有确定性。但是,可以将轨迹构建器选项“
collat​​e_landmarks”设置为false,并允许使用不确定性但也不会阻塞的方法。 num_laser_scans
要订阅的激光扫描主题的数量。在一台激光扫描仪的“scan”主题上订阅 sensor_msgs /
LaserScan,对于多台激光扫描仪的主题在“ scan_1”,“ scan_2”等主题上进行订阅。
num_multi_echo_laser_scans 要订阅的多回波激光扫描主题的数量。在一个激光扫描仪的“
echoes”主题上订阅sensor_msgs / MultiEchoLaserScan,或者在多个激光扫描仪的主题“
echoes_1”,“ echoes_2”等主题上订阅 sensor_msgs / MultiEchoLaserScan。
num_subdivisions_per_laser_scan
将每个接收到的(多回波)激光扫描分成的点云数。细分扫描可以取消扭曲在扫描仪移动时获取的扫描。有一个相应的“轨迹生成器”选项,可将细分的扫描累积到点云中,以用于扫描匹配。
num_point_clouds 要订阅的点云主题数。在一个测距仪的“ points2”主题上订阅 sensor_msgs /
PointCloud2,在多个测距仪的主题中订阅“ points2_1”,“ points2_2”等主题。
lookup_transform_timeout_sec 用于使用tf2查找转换的超时时间(以秒为单位)。
submap_publish_period_sec 发布子图的间隔时间(以秒为单位),例如0.3秒。
pose_publish_period_sec 发布姿势的时间间隔(以秒为单位),例如200Hz的频率为5e-3。
publish_to_tf 启用或禁用TF转换的提供。 publish_tracked_pose_msg 启用将跟踪的姿态发布为主题“
tracked_pose”的geometry_msgs / PoseStamped。
trajectory_publish_period_sec 发布轨迹标记的时间间隔(以秒为单位),例如30e-3,持续30毫秒。
rangefinder_sampling_ratio 测距仪消息的固定比率采样。 odometry_sampling_ratio
里程表消息的固定比率采样。 fixed_frame_sampling_ratio 固定帧消息的固定比率采样。
imu_sampling_ratio IMU消息的固定比率采样。 landmarks_sampling_ratio 地标消息的固定比率采样。

上面引用是翻译后复制得来,有可能一些topic也会被翻译成中文,请知悉。最好的方法是直接访问下面的参考链接,避免发生歧义。


参考链接:
https://google-cartographer.readthedocs.io/en/latest/configuration.html
https://google-cartographer-ros.readthedocs.io/en/latest/configuration.html
https://github.com/cartographer-project/cartographer_ros


总结

以上就是今天要讲的内容,本文介绍了cartographer参数的优化,而cartographer提供了能使我们快速便捷地处理地图数据的函数和方法。


版权声明:本文为CSDN博主「WeSiGJ」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/wesigj/article/details/114652846

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值