Commit Graph

3 Commits

Author SHA1 Message Date
84c83786ba feat: snapshot API cho reader — planner solve trên bản copy, hết chặn map-update
Costmap2D::copyFrom: copy metadata + grid, chỉ realloc khi size đổi (operator=
delete/new mỗi lần — không hợp copy định kỳ 30 Hz). Caller giữ mutex nguồn.

Costmap2DROBOT: key config snapshot_for_readers (mặc định false = nguyên trạng);
refreshSnapshot() khoá master mutex đúng bằng thời gian memcpy;
getCostmapForRead() trả snapshot khi bật / lưới live khi tắt. Object snapshot
ổn định địa chỉ, refresh tại chỗ — không tái tạo con trỏ (bài học
DOUBLE_FREE_BUG_FIX_REPORT). Hợp đồng single-consumer: refresh + đọc cùng
thread control loop.

Kèm: load debug_level (commit trước) + fix priv_nh(priv_nh, name) tự khởi tạo
từ chính nó — đổi thành (nh, name), cùng kết quả namespace, hết UB-adjacent.

Verify: test_costmap 10/10 (3 test copyFrom mới), sim mission — lock_wait local
53 ms max -> 13 us, p99 cycle 21.4 -> 3.4 ms, local costmap chạy được 10 Hz
với 1.2% một core.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 20:19:33 +07:00
bdbb03aa51 otimal deep coppy obj 2026-07-14 11:08:23 +07:00
72b2f3c639 Hiep update 2025-12-30 10:24:18 +07:00