cartographer参数理解
cartographer 涉及到的参数需要增加删除或者修改尽量在velodyne_3d.lua⽂件中添加或者修改,注意添加参数时要在包含该参数的头⽂
件,并写全参数结构,⽐如某个参数是⼀个⼤参数包含的⼩参数,需要写成:⼤参数.⼩参数=xx 。该⽂件原名为backpack_3d.lua,在
~/{⼯作空间}/src/google_cartographer/cartographer_ros-master/cartographer_ros/configuration_files/⽂件夹下⾯
velodyne_3d.lua
include "map_builder.lua"
include "trajectory_builder.lua"
options = {
map_builder = MAP_BUILDER,
trajectory_builder = TRAJECTORY_BUILDER,
map_frame = "map", #地图坐标系
tracking_frame = "gyro_link", #如果有imu ,就是imu坐标系
published_frame = "ba_link", #机器⼈地盘坐标系
odom_frame = "carto_odom", #cartographer计算出的优化后⾥程计坐标系,并⾮机器⼈本⾝⾥程计,建议区分开
provide_odom_frame = true, #是否发布odom_frame,如果机器⼈本⾝存在odom坐标系,⽽你⼜
想让carto 使⽤ odom数据,就需要将published_frame 设置为
odom,provide_odom_frame = fal ⽽u_odometry = true
publish_frame_projected_to_2d = fal, #
u_po_extrapolator = true,
u_odometry = fal, #是否使⽤odom数据
u_nav_sat = fal, #是否使⽤gps数据
u_landmarks = fal, #是否使⽤lankmarks数据
num_lar_scans = 0, #如果使⽤的是单线的激光雷达,此处为激光雷达的数量
num_multi_echo_lar_scans = 0,
num_subdivisions_per_lar_scan = 1, #将激光雷达的数据拆分成⼏次发出来,对于普通的激光雷达,此处为1
num_point_clouds = 1, #多线激光雷达的数量
lookup_transform_timeout_c = 0.2,
submap_publish_period_c = 0.3,
po_publish_period_c = 5e-3,
trajectory_publish_period_c = 30e-3,
rangefinder_sampling_ratio = 1.,
odometry_sampling_ratio = 1., #如果odom的数据⾮常不准可以设置成0.3以减弱odom对整体的优化
fixed_frame_po_sampling_ratio = 1.,
imu_sampling_ratio = 1.,
landmarks_sampling_ratio = 1.,
}
TRAJECTORY_BUILDER_3D.num_accumulated_range_data = 1 #1帧数据被拆分成⼏次发送出来
TRAJECTORY_BUILDER_3D.u_online_correlative_scan_matching = true
这⼀项配置很重要,对于我⾃⼰使⽤的雷达或者在 gazebo 中仿真时,如果不配置这项得到的建图效果将⾮常差。这个参数配置的是否使⽤实时的闭环检测⽅法来进
MAP_BUILDER.u_trajectory_builder_3d = true #决定选择的是3D的激光雷达还是2D的激
光雷达
MAP_BUILDER.num_background_threads = 7
POSE_GRAPH.optimization_problem.huber_scale = 1e1
POSE_GRAPH.optimize_every_n_nodes = 20
straint_builder.sampling_ratio = 0.3
POSE_GRAPH.s_solver_options.max_num_iterations = 10
straint_builder.min_score = 0.62
straint_builder.global_localization_min_score = 0.66
TRAJECTORY_BUILDER_3D.submaps.num_range_data = 40
return options
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
trajectory_builder_3d.lua
MAX_3D_RANGE = 60.
TRAJECTORY_BUILDER_3D = {
min_range = 1.,
max_range = MAX_3D_RANGE,
num_accumulated_range_data = 1,
voxel_filter_size = 0.15,
# 在3d slam 时会有2个⾃适应滤波,⼀个⽣成⾼分辨率点云,⼀个⽣成低分辨率点云
历史考试反思high_resolution_adaptive_voxel_filter = {
max_length = 2.,
min_num_points = 150,
max_range = 15.,
},
low_resolution_adaptive_voxel_filter = {
max_length = 4.,
min_num_points = 200,
max_range = MAX_3D_RANGE,
},
u_online_correlative_scan_matching = fal,
real_time_correlative_scan_matcher = {
linear_arch_window = 0.15,
angular_arch_window = math.rad(1.),
translation_delta_cost_weight = 1e-1,
rotation_delta_cost_weight = 1e-1,
},
# 在3D中,occupied_space_weight_0和occupied_space_weight_1参数分别与⾼分辨率和低分辨率滤波点云相关
ceres_scan_matcher = {
occupied_space_weight_0 = 1.,音乐剧音乐之声
occupied_space_weight_1 = 6.,
translation_weight = 5.,
rotation_weight = 4e2,
only_optimize_yaw = fal,
ceres_solver_options = {
u_nonmonotonic_steps = fal,
max_num_iterations = 12,
num_threads = 1,
},
},
motion_filter = {
max_time_conds = 0.5,
max_distance_meters = 0.1,
max_angle_radians = 0.004,
},
imu_gravity_time_constant = 10.,
rotational_histogram_size = 120, # rotational scan matcher 的 histogram buckets
# 在3D中,出于扫描匹配性能的原因,使⽤两个混合概率⽹格。(术语“hybrid”仅指内部树状数据表⽰并被抽象给⽤户)
submaps = {
high_resolution = 0.10, # ⽤于近距离测量的⾼分辨率hybrid⽹格 for local SLAM and loop closure,⽤来与⼩尺⼨voxel进⾏精匹配
high_resolution = 0.10, # ⽤于近距离测量的⾼分辨率hybrid⽹格 for local SLAM and loop closure,⽤来与⼩尺⼨voxel进⾏精匹配
high_resolution_max_range = 20., # 在插⼊ high_resolution map 之前过滤点云的最⼤范围
low_resolution = 0.45, # ⽤于远距离测量的低分辨率hybrid⽹格 for local SLAM only,⽤来与⼤尺⼨voxel进⾏粗匹配
num_range_data = 160,
range_data_inrter = {
hit_probability = 0.55,
miss_probability = 0.49,
num_free_space_voxels = 2, # 最多可更新多少个free space voxels以进⾏扫描匹配,0禁⽤free space
},
},
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
map_builder.lua
include "po_graph.lua"
MAP_BUILDER = {
u_trajectory_builder_2d = fal,
u_trajectory_builder_3d = fal,
num_background_threads = 4,
po_graph = POSE_GRAPH,
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
po_graph.lua
POSE_GRAPH = {
optimize_every_n_nodes = 90, # 每⼏个节点(节点是什么?scan?)执⾏⼀次优化,设为0即关闭后端优化
constraint_builder = {
sampling_ratio = 0.3, # 如果添加的约束与潜在约束的⽐例低于此⽐例,则将添加约束。
max_constraint_distance = 15., # 在⼦图附近考虑姿势的阈值
PCMCIA卡
min_score = 0.55, # 扫描匹配分数的阈值,低于该阈值时不考虑匹配。低分表⽰扫描和地图看起来不相似
global_localization_min_score = 0.6, # 阈值,低于该阈值的全局定位不受信任
loop_closure_translation_weight = 1.1e4, # 优化问题中的闭环约束的平移的权重
loop_closure_rotation_weight = 1e5, # 优化问题中的闭环约束的旋转的权重
log_matches = true, # 闭环约束的直⽅图统计报告
fast_correlative_scan_matcher = { # 闭环检测的第⼀步
linear_arch_window = 7., # 依靠“分⽀定界”机制在不同的⽹格分辨率下⼯作,并有效地消除不正确的匹配
angular_arch_window = math.rad(30.), # ⼀旦找到⾜够好的分数(⾼于最低匹配分数),它(scan)就会被送⼊Ceres扫描匹配器以优化姿势。
branch_and_bound_depth = 7,
},
ceres_scan_matcher = { # 闭环检测的第⼆步优化位姿图
occupied_space_weight = 20.,
translation_weight = 10.,
rotation_weight = 1.,
ceres_solver_options = {
u_nonmonotonic_steps = true,
max_num_iterations = 10,
num_threads = 1,
},
},
fast_correlative_scan_matcher_3d = {
branch_and_bound_depth = 8,
branch_and_bound_depth = 8,
full_resolution_depth = 3,
min_rotational_score = 0.77,
min_low_resolution_score = 0.55,
linear_xy_arch_window = 5.,
linear_z_arch_window = 1.,
angular_arch_window = math.rad(15.),
},
ceres_scan_matcher_3d = {
occupied_space_weight_0 = 5.,
occupied_space_weight_1 = 30.,
translation_weight = 10.,
rotation_weight = 1.,
only_optimize_yaw = fal,
ceres_solver_options = {
u_nonmonotonic_steps = fal,
max_num_iterations = 10,
num_threads = 1,
},
},
},
matcher_translation_weight = 5e2,
matcher_rotation_weight = 1.6e3,
optimization_problem = { # 残差⽅程的参数配置
huber_scale = 1e1, # Huber损失函数的尺度因⼦,该值越⼤,(potential) outliers(潜在)异常值的影响越⼤。 acceleration_weight = 1e3, # IMU加速度的权重
rotation_weight = 3e5, # IMU旋转项的权重
local_slam_po_translation_weight = 1e5, # 基于local SLAM的姿势在连续节点之间进⾏平移的权重
local_slam_po_rotation_weight = 1e5, # 基于⾥程计的姿势在连续节点之间进⾏平移的权重
odometry_translation_weight = 1e5,
odometry_rotation_weight = 1e5,
fixed_frame_po_translation_weight = 1e1, # FixedFramePo?应该是gps的
fixed_frame_po_rotation_weight = 1e2,
log_solver_summary = fal, # 可以记录Ceres全局优化的结果并⽤于改进您的外部校准
宪法的意义u_online_imu_extrinsics_in_3d = true, # 作为IMU残差的⼀部分
fix_z_in_3d = fal,
ceres_solver_options = {
抉择是什么意思u_nonmonotonic_steps = fal,
max_num_iterations = 50,
num_threads = 7,
儿童简笔画大全
},
},
max_num_final_iterations = 200, # 在建图结束之后会运⾏⼀个新的全局优化,不要求实时性,迭代次数多
global_sampling_ratio = 0.003,
log_residual_histograms = true,
global_constraint_arch_after_n_conds = 10.,
-- overlapping_submaps_trimmer_2d = {
-- fresh_submaps_count = 1,
-- min_covered_area = 2,
-- min_added_submaps_count = 5,
-- },
VOXEL_SIZE = 0.3
include "transform.lua"
options = {
咖啡的分类
tracking_frame = "ba_link",
pipeline = {
{
action = "min_max_range_filter",
min_range = 1.,
max_range = 60.,
},
{
action = "dump_num_points",
},
-
- Gray X-Rays. The only u geometry to color pixels.
{
action = "write_xray_image",
voxel_size = VOXEL_SIZE,
filename = "xray_xy_all",
transform = XY_TRANSFORM,
},
-- {
-- action = "color_points",
-- frame_id = "lar_link",
-- color = { 255., 0., 0. },
-
- },入职申请书
{
action = "write_pcd",
filename = "carto_3d02.pcd",
},
-- {
-- action = "write_ply",
-- filename = "points.ply",
-- },
}
}
return options
velodyne_3d.urdf 改写⾃ backpack_3d.urdf,记录各个坐标系之间的转换关系