上一節介紹了路標Landmark資料的訂閱和發布,各類資料的發布和訂閱基本闡述完畢,
本節會介紹cartographer的主要配置引數,研究這些引數的使用和對演算法的影響,
目錄
1,map_builder.lua
2,pose_graph.lua
3,trajectory_builder.lua
4,trajectory_builder_2d.lua
首先還是得回到Ros運行demo(第二節)的launch腳本上, launch腳本中可以看到demo所用的組態檔是【backpack_2d.lua】,
而backpack_2d.lua在一開始通過include陳述句加載了map_builder和trajectory_builder的配置:
include "map_builder.lua"
include "trajectory_builder.lua"
所以從這兩個組態檔先入手
1,map_builder.lua
從名字可以看出【map_builder.lua】是對于類MapBuilder的引數配置,具體引數如下:
include "pose_graph.lua"
MAP_BUILDER = {
use_trajectory_builder_2d = false, --使用2d軌跡
use_trajectory_builder_3d = false, --使用3d軌跡
num_background_threads = 4, --核心執行緒數
pose_graph = POSE_GRAPH, --位置圖賦值
collate_by_trajectory = false, --是否根據軌跡構建修正器
}
2,pose_graph.lua
【map_builder.lua 】中引入了【pose_graph.lua】,【pose_graph.lua】是全域位姿優化,具體引數如下:
POSE_GRAPH = {
optimize_every_n_nodes = 90, --每次整體優化間隔nodes數
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.),--fast_CSM匹配搜索角度
branch_and_bound_depth = 7, --fast_CSM分支定界深度
},
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)
optimization_problem = {
huber_scale = 1e1, --Huber因子(與離群值(錯誤的資料)對整體的影響正相關),
acceleration_weight = 1e3, --IMU加速度的權重
rotation_weight = 3e5, --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, --是否記錄Ceres全域優化的結果
use_online_imu_extrinsics_in_3d = true, --是否在線標定imu的外參
fix_z_in_3d = false,
ceres_solver_options = {
use_nonmonotonic_steps = false, --是否使用梯度下降策略
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., --全域匹配間隔時長
-- overlapping_submaps_trimmer_2d = {
-- fresh_submaps_count = 1,
-- min_covered_area = 2,
-- min_added_submaps_count = 5,
-- },
}
3,trajectory_builder.lua
從名字可以看出【trajectory_builder.lua】是對于類TrajectoryBuilder的引數配置,具體引數如下:
include "trajectory_builder_2d.lua"
include "trajectory_builder_3d.lua"
TRAJECTORY_BUILDER = {
trajectory_builder_2d = TRAJECTORY_BUILDER_2D, --2d軌跡賦值
trajectory_builder_3d = TRAJECTORY_BUILDER_3D, --3d軌跡賦值
-- pure_localization_trimmer = {
-- max_submaps_to_keep = 3,
-- },
collate_fixed_frame = true, --是否通過固定幀修正
collate_landmarks = false, --是否通過反光板修正
}
4,trajectory_builder_2d.lua
【trajectory_builder_2d.lua 】中引入了【trajectory_builder_2d.lua】和【trajectory_builder_3d.lua】,兩個配置內容是大致類似的,但各自有些特有引數,這里主要說明2D軌跡的引數【trajectory_builder_2d.lua】,具體引數如下:
TRAJECTORY_BUILDER_2D = {
use_imu_data = https://www.cnblogs.com/CloudFlame/p/true, --是否使用imu資料
min_range = 0., --激光的最近距離
max_range = 30., --激光的最遠距離
min_z = -0.8, --激光的最小高度
max_z = 2., --激光的最大高度
missing_data_ray_length = 5., --激光的默認數值
num_accumulated_range_data = 1, --單個Node節點累積激光幀數
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, --是否使用CSM激光匹配
real_time_correlative_scan_matcher = { --快速CSN激光匹配
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 = { --ceres優化激光匹配
occupied_space_weight = 1., --占據空間權重
translation_weight = 10., --平移權重
rotation_weight = 40., --旋轉權重
ceres_solver_options = {
use_nonmonotonic_steps = false, --是否使用梯度下降策略
max_num_iterations = 20, --最大迭代次數
num_threads = 1, --使用執行緒數
},
},
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., --imu的重力常數
pose_extrapolator = {
use_imu_based = false, --是否使用3d初始化位姿預估器
constant_velocity = {
imu_gravity_time_constant = 10., --imu的重力常數
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加速度權重
imu_rotation_weight = 1., --IMU旋轉權重
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,
update_weight_angle_scan_normal_to_ray_kernel_bandwidth = 0.5,
update_weight_distance_cell_to_hit_kernel_bandwidth = 0.5,
},
},
},
}
以上就是cartographer中的主要配置引數,這里只是簡單的介紹說明,要更加深入的了解還需要到實際案例中使用或者查看其在代碼中的功能作用,
【完】
下一節就結合demo案例一起說明,在Ros中使用這些引數時實際的配置及效果,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/498753.html
標籤:其他
上一篇:淺析拉格朗日乘數法及其對偶問題
