trajectory_builder_2d.lua
-- Copyright 2016 The Cartographer Authors
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
TRAJECTORY_BUILDER_2D = {
use_imu_data = true, --是否使用imu
min_range = 0., --激光滤波时最小范围
max_range = 30., --激光滤波最大范围
min_z = -0.8, --激光滤波高度下限
max_z = 2., --激光滤波高度上限
missing_data_ray_length = 5., --激光扫描点在设定最大范围外设置一定长度的作miss点
num_accumulated_range_data = 1, --每次累积多少帧数据进行local map
voxel_filter_size = 0.025, --代码中未使用
adaptive_voxel_filter = {
max_length = 0.5, --用于分辨率过滤点云点数,点数不够时以该长度一半作为分辨率细化点云
min_num_points = 200,
max_range = 50., --激光扫描最大范围
},
loop_closure_adaptive_voxel_filter = { --代码中未体现
max_length = 0.9,
min_num_points = 100,
max_range = 50.,
},
use_online_correlative_scan_matching = false, --是否使用实时匹配策略 2d切片处理,3d暴力
real_time_correlative_scan_matcher = {
linear_search_window = 0.1, --线性搜索,根据分辨率用于计算线性边界,
angular_search_window = math.rad(20.), --根据分辨率用于计算角度搜索个数以及扫描点数
translation_delta_cost_weight = 1e-1, --未用
rotation_delta_cost_weight = 1e-1, --未用
},
ceres_scan_matcher = {
occupied_space_weight = 1.,
translation_weight = 10.,
rotation_weight = 40.,
ceres_solver_options = {
use_nonmonotonic_steps = false,
max_num_iterations = 20,
num_threads = 1,
},
},
--运动滤波,通过检测2帧激光数据是否相似,可以用于判断车辆是否移动,以下条件要满足
motion_filter = {
max_time_seconds = 5., --2帧激光最小间隔
max_distance_meters = 0.2, --2帧激光最小距离
max_angle_radians = math.rad(1.), --2帧激光最小角度
},
-- TODO(schwoere,wohe): Remove this constant. This is only kept for ROS.
imu_gravity_time_constant = 10.,
pose_extrapolator = {
use_imu_based = false,
constant_velocity = {
imu_gravity_time_constant = 10.,
pose_queue_duration = 0.001,
},
imu_based = {
pose_queue_duration = 5.,
gravity_constant = 9.806,
pose_translation_weight = 1.,
pose_rotation_weight = 1.,
imu_acceleration_weight = 1.,
imu_rotation_weight = 1.,
odometry_translation_weight = 1.,
odometry_rotation_weight = 1.,
solver_options = {
use_nonmonotonic_steps = false;
max_num_iterations = 10;
num_threads = 1;
},
},
},
submaps = {
num_range_data = 90, --子图中Node的数量
grid_options_2d = {
grid_type = "PROBABILITY_GRID", --概率栅格地图
resolution = 0.05,
},
range_data_inserter = {
range_data_inserter_type = "PROBABILITY_GRID_INSERTER_2D",
probability_grid_range_data_inserter = {
insert_free_space = true, --是否改变改变占用网格中的概率。
hit_probability = 0.55, --hit(占用) 时的概率
miss_probability = 0.49, --miss(空闲) 时的概率
},
tsdf_range_data_inserter = {
truncation_distance = 0.3,
maximum_weight = 10.,
update_free_space = false,
normal_estimation_options = {
num_normal_samples = 4,
sample_radius = 0.5,
},
project_sdf_distance_to_scan_normal = true,
update_weight_range_exponent = 0, --与tsdf有关
update_weight_angle_scan_normal_to_ray_kernel_bandwidth = 0.5,
update_weight_distance_cell_to_hit_kernel_bandwidth = 0.5,
},
},
},
}
pose_graph_2d.lua
-- Copyright 2016 The Cartographer Authors
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
POSE_GRAPH = {
optimize_every_n_nodes = 90, --处理多少个node才会进行后端优化
constraint_builder = {
sampling_ratio = 0.3, --全局约束采样比率(nodes),用于后端构建约束,采样率低于该值不进行约束创建。
max_constraint_distance = 15., --全局约束最大间距(当前node与当前submap之间的距离)用于后端约束初始位置判断,初始位置大于该值不做约束
min_score = 0.55, --全局约束当前最小得分(当前node与当前submap的匹配得分)
global_localization_min_score = 0.6,--全局约束全局最小得分(当前node与全局submap的匹配得分)
loop_closure_translation_weight = 1.1e4,--闭环检测平移权重
loop_closure_rotation_weight = 1e5,--闭环检测旋转权重
log_matches = true,--是否打开直方图约束
fast_correlative_scan_matcher = {
linear_search_window = 7.,--fast_CSM匹配搜索距离
angular_search_window = math.rad(30.),
branch_and_bound_depth = 7,
},
ceres_scan_matcher = {
occupied_space_weight = 20., --ceres_scan匹配占据空间权重
translation_weight = 10., --ceres_scan匹配平移权重
rotation_weight = 1., --ceres_scan匹配旋转权重
ceres_solver_options = {
use_nonmonotonic_steps = true,--是否使用梯度下降策略
max_num_iterations = 10,
num_threads = 1,
},
},
fast_correlative_scan_matcher_3d = {
branch_and_bound_depth = 8,
full_resolution_depth = 3,
min_rotational_score = 0.77,
min_low_resolution_score = 0.55,
linear_xy_search_window = 5.,
linear_z_search_window = 1.,
angular_search_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 = false,
ceres_solver_options = {
use_nonmonotonic_steps = false,
max_num_iterations = 10,
num_threads = 1,
},
},
},
matcher_translation_weight = 5e2,--匹配平移约束(当前submap与在当前submap内的某个node)
matcher_rotation_weight = 1.6e3,--匹配旋转约束(当前submap与在当前submap内的某个node)
--以上两个配合huber_scale使用,用于后端约束减小对异常值的影响
optimization_problem = {
huber_scale = 1e1, --Huber因子(与离群值(错误的数据)对整体的影响正相关)。
acceleration_weight = 1.1e2, --IMU加速度的权重
rotation_weight = 1.6e4, --IMU旋转项的权重
local_slam_pose_translation_weight = 1e5, --平移约束权重(前后两个node之间的局部观测与全局优化)
local_slam_pose_rotation_weight = 1e5, --旋转约束权重(前后两个node之间的局部观测与全局优化)
odometry_translation_weight = 1e5, --平移约束权重(前后两个node之间的局部观测与里程计观测)
odometry_rotation_weight = 1e5, --旋转约束权重(前后两个node之间的局部观测与里程计观测)
fixed_frame_pose_translation_weight = 1e1,
fixed_frame_pose_rotation_weight = 1e2,
fixed_frame_pose_use_tolerant_loss = false,
fixed_frame_pose_tolerant_loss_param_a = 1,
fixed_frame_pose_tolerant_loss_param_b = 1,
log_solver_summary = false,
use_online_imu_extrinsics_in_3d = true,
fix_z_in_3d = false,
ceres_solver_options = {
use_nonmonotonic_steps = false, --是否记录Ceres全局优化的结果
max_num_iterations = 50,
num_threads = 7,
},
},
max_num_final_iterations = 200, --建图结束后最终优化迭代次数 实际没用到
global_sampling_ratio = 0.003, --全局地图匹配约束采样比率(nodes)
log_residual_histograms = true, --是否输出残差直方图
global_constraint_search_after_n_seconds = 10., --多长时间进行一次全局后端约束,与global_sampling_ratio配合使用达成目标
-- overlapping_submaps_trimmer_2d = {
-- fresh_submaps_count = 1,
-- min_covered_area = 2,
-- min_added_submaps_count = 5,
-- },
}