fix(craic_localization): optimize SLAM and AMCL parameters for 4x4m field

gmapping: shrink map bounds from 20x20m to 5x5m (xmin/max: -0.5/4.5), increase grid resolution from 5cm to 2cm (delta: 0.02), more particles (50), tighter update thresholds (linear 0.1, angular 0.2)

amcl: raise motion noise 10x (alpha1-2,5: 0.005->0.05, alpha3-4: 0.1) to stop blindly trusting rf2o, clamp laser range to 5m, tighten likelihood window to 1.5m, reduce update thresholds (d: 0.02, a: 0.03), disable random particle injection (recovery_alpha: 0.0)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-06-19 06:45:40 +08:00
parent 8ecbfd759e
commit 752f78f0ad
2 changed files with 28 additions and 26 deletions

View File

@@ -19,12 +19,12 @@ amcl:
odom_frame_id: "odom"
scan_topic: "scan"
# ===== 运动模型噪声(按里程计实际精度调)=====
alpha1: 0.005
alpha2: 0.005
alpha3: 0.005
alpha4: 0.005
alpha5: 0.005
# ===== 运动模型噪声 =====
alpha1: 0.05
alpha2: 0.05
alpha3: 0.1
alpha4: 0.1
alpha5: 0.05
# ===== 粒子滤波 =====
min_particles: 500
@@ -32,21 +32,25 @@ amcl:
pf_err: 0.05
resample_interval: 5
# ===== 激光模型(匹配 TminiPro12m=====
# ===== 激光模型(匹配 5×5m 边界=====
laser_model_type: "likelihood_field"
laser_max_range: 12.0
laser_max_range: 5.0
laser_min_range: -1.0
max_beams: 500
sigma_hit: 0.05
z_hit: 0.5
z_rand: 0.03
laser_likelihood_max_dist: 2.0
laser_likelihood_max_dist: 1.5
# ===== 更新策略 =====
update_min_d: 0.05
update_min_a: 0.05
update_min_d: 0.02
update_min_a: 0.03
transform_tolerance: 0.5
# ===== 恢复:小场地关闭随机粒子注入 =====
recovery_alpha_slow: 0.0
recovery_alpha_fast: 0.0
# ===== 初始位姿(按机器人在场地中的起始点设置;可被 launch 覆盖)=====
set_initial_pose: true
initial_pose:

View File

@@ -1,8 +1,6 @@
# gmapping(slam_gmapping) 建图参数 —— 改自 lzu_robot/src/slam_gmapping/params/slam_gmapping.yaml
# 帧base_frame=base_footprint(与 chassis_odometry 一致),odom_frame=odommap_frame=map
# 适配 385×385cm 小场地maxUrange 4m 足够覆盖delta 0.05 = 5cm 栅格
# 用 /** 通配键确保参数无论节点全限定名如何都能生效lzu 用 /slam_gmapping 键,
# 其 TF 树恰好有 base_link 才掩盖了键不匹配、参数全默认的问题;我们没有 base_link 会直接报错)
# gmapping(slam_gmapping) 建图参数 —— 为 4×4m 场地优化
# 帧base_frame=base_footprint, odom_frame=odom, map_frame=map
# 地图缩减到 5×5m场地 4×4m + 各 0.5m 余量),栅格分辨率 2cm
/**:
ros__parameters:
base_frame: base_footprint
@@ -10,11 +8,11 @@
map_frame: map
map_update_interval: 5.0
maxUrange: 4.0
maxRange: 6.0
delta: 0.05
particles: 30
linearUpdate: 0.3
angularUpdate: 0.5
maxRange: 5.0
delta: 0.02
particles: 50
linearUpdate: 0.1
angularUpdate: 0.2
temporalUpdate: 1.0
resampleThreshold: 0.5
minimum_score: 0.0
@@ -36,11 +34,11 @@
llsamplestep: 0.01
lasamplerange: 0.005
lasamplestep: 0.005
# 地图范围(米)
xmin: -10.0
xmax: 10.0
ymin: -10.0
ymax: 10.0
# 地图范围(米)—— 4×4m 场地 + 0.5m 余量
xmin: -0.5
xmax: 4.5
ymin: -0.5
ymax: 4.5
occ_thresh: 0.25
transform_publish_period: 0.05
use_sim_time: false