Files
move_base2/config/runtime/costmap_global_params.yaml
duongtd 1e8abf2ce4 perf: global planner doc snapshot costmap thay vi giu mutex het luot makePlan
PlannerRunner truoc gio giu Costmap2D mutex suot makePlan() (giao thuc gen-1) - SBPL search
6-14s la costmap update thread bi block het tung do. Them capability boost::dll
"<alias>ExternalGrid" (cung mau sbpl_recovery dang dung) de planner nhan ban chup thay vi
lock song. threadBody(): planner co setter + costmap bat snapshot_for_readers thi
refreshSnapshot() + dua ban chup vao, khong lock; khong thi rot ve giu mutex nhu cu (rollback
khong build lai). SBPLLatticePlanner them setExternalGrid()/activeGrid(); sua luon check
size external_grid_ so voi grid (grid = activeGrid() nen so voi chinh no, khong bao gio bat
duoc lech) - so dung costmap_robot_->getCostmap() (luoi song).

Test: ReportsExternalGridCapabilityPerPlanner, ExternalGridIsNotCalledWhileTheCostmapLockIsDisabled.
config/runtime: bat snapshot_for_readers: true (cay sim). docs/THREADING.md: bang so sanh khoa
dai vs ban chup.
2026-09-18 13:32:52 +07:00

40 lines
2.8 KiB
YAML
Executable File

global_costmap:
library_path: libplugins
robot_base_frame: base_link
global_frame: map
update_frequency: 1.0
publish_frequency: 1.0
# [bool] Bật log thống kê thời gian update costmap (avg/p95/p99 mỗi cycle + per-layer).
# Chỉ dùng khi đo đạc/tối ưu; log in mỗi performance_metrics_period giây, tắt đi khi chạy thật.
# Lưu ý: key này phải nằm TRONG namespace local_costmap/global_costmap — đặt ở root file common là key chết.
performance_metrics_enabled: false
# [s] Chu kỳ in báo cáo thống kê. Tăng lên thì log thưa hơn, số trung bình mượt hơn.
performance_metrics_period: 5.0
# [0..2] Mức chi tiết debug trong báo cáo thống kê, chỉ có tác dụng khi performance_metrics_enabled: true.
# 0 = giữ nguyên output cũ; 1 = thêm dòng lock_wait/lock_hold (tranh chấp mutex với planner),
# kích thước window update [cells] và số cycle rỗng; 2 = thêm per-layer: layer nào nở bounds bao nhiêu [m^2].
debug_level: 0
# [bool] Global planner tính toán trên BẢN COPY (snapshot) của costmap thay vì lưới live.
# true: đầu mỗi lượt makePlan, PlannerRunner copy lưới global dưới lock (~0.3 ms cho 1397x777,
# ~5 ms cho 3060x3060) rồi đưa bản copy cho planner qua capability "<alias>ExternalGrid" —
# thread update global costmap không còn bị chặn suốt lượt search. Đo 2026-09-17: SBPL cạn
# search 6-14 s/lượt, thread costmap đứng đúng chừng ấy, log "Map update global_costmap loop
# missed its desired rate". Planner vẫn thấy lưới "đông cứng" suốt lượt tính; kết quả plan
# KHÔNG đổi so với khoá dài (cùng cost/số state với cùng goal).
# Chỉ có tác dụng với plugin export capability đó — hiện là SBPLLatticePlanner. CustomPlanner /
# DockPlanner / TwoPointsPlanner không có, tự rơi về khoá dài (chúng chạy vài ms, vô hại).
# Dòng boot "[move_base2] global planner '...' reads the costmap via SNAPSHOT|LONG LOCK" cho biết
# đang ở nhánh nào.
# false: hành vi cũ — giữ mutex suốt makePlan. Công tắc rollback, không cần build lại.
# ► Chỉnh: cây sim bật để đo; cây robot thật giữ false tới khi có số trên robot.
snapshot_for_readers: true
raytrace_range: 3.0
resolution: 0.05
z_resolution: 0.2
rolling_window: false
z_voxels: 10
inflation:
cost_scaling_factor: 10.0 # Exponential rate at which the obstacle cost drops off (default: 10). Must be chosen so that the cost value is > 0 at robot's circumscribed radius.
inflation_radius: 0.6 # Max. distance from an obstacle at which costs are incurred for planning paths. Must be > robot's circumscribed radius.