Gói không include một header pcl/ nào — đây là di sản từ thời còn dùng pcl_ros.
Trên robot aarch64 có VTK 9.1 build kèm MPI, chuỗi PCL -> VTK -> VTK::mpi ->
MPI::MPI_C làm CMake gãy ở generate step: root project khai LANGUAGES CXX nên
find_package(MPI COMPONENTS C) không bao giờ thành công và target MPI::MPI_C
không được tạo. Component io là chỗ kéo VTK vào. Máy dev không dính vì không
cài VTK cmake package, find_VTK() tìm không thấy rồi bỏ qua trong im lặng.
Bỏ find_package, DEPENDS PCL, PCL_INCLUDE_DIRS, PCL_LIBRARIES,
link_directories(PCL_LIBRARY_DIRS) và PCL_DEFINITIONS.
Đo CPU thật của costmap ở mức OS không cần bật metrics nội bộ: thread hiện ra
là cm_local_costma / cm_global_costm thay vì lẫn vào amr_control_node.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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>
debug_level (0/1/2) trên báo cáo performance định kỳ: 0 giữ nguyên output cũ;
1 thêm lock_wait (tranh chấp mutex với planner) tách khỏi lock_hold (việc của
chính costmap), kích thước window update và số cycle rỗng — cycle rỗng giờ vẫn
được đếm + report nên costmap idle (global) không còn biến mất khỏi log;
2 thêm per-layer bounds_grow [m^2] chỉ mặt layer nào nở vùng update.
Số đo sim: lock_wait chiếm 75-90% cycle local costmap khi PRIEST solve
(median 7.5 ms, max 53 ms) trong khi lock_hold chỉ ~1.8 ms — căn cứ trực tiếp
cho snapshot API ở commit sau.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GTest is only used by the test executables, which the robot deployment build
does not produce. Requiring it at the top of the file made cmake fail to
configure on a machine without GTest installed even with the tests off.
The standalone CMake build is the robot deployment path and must not pull in
GTest or produce test executables. A catkin workspace is a development machine
and keeps the tests. -DBUILD_COSTMAP_TESTS=ON still forces them on standalone.