Each layer reads its default file under $PNKX_NAV_CORE_CONFIG_DIR/config, then overrides a key from "<costmap>/<plugin>". Costmap2DROBOT::copyParentParameters() copies the shared "<plugin>:" block there first. This was broken in three ways: - the copy lists covered only part of what the layers read, so a key set in the shared block was dropped without a word; - DepthCameraObstacleLayer had no default file and read the shared block itself; - a layer that failed to initialize left a half-built costmap that reported READY. Failing loudly: - costmap_2d_robot.cpp: a failing layer, a malformed plugins: list or a missing costmap_params.yaml throws std::runtime_error with the costmap and layer name, after releasing layered_costmap_. NavigationRuntime::buildCostmaps() turns this into an initialization error, so the host never reports READY. - Static/Obstacle/Voxel/Inflation and DepthCameraObstacleLayer throw when their default file cannot be opened. - A key whose value does not convert to the type the layer reads throws. getParam() used to write 0, false or "" into the value, and that was copied as if configured. One flow: - copyParentParameters() copies every key each layer reads, with the layer's type, including a new DepthCameraObstacleLayer branch. Copies no layer reads are dropped. - DepthCameraObstacleLayer::loadParameters() reads config/depth_camera_obstacle_layer_params.yaml (new, equal to the C++ defaults), then "<costmap>/<plugin>". ParamReader is gone, and so is the node_handle.cpp:265 warning at start-up. - VoxelLayer: z_resolution can be overridden; unknown_threshold is computed after the final z_voxels; the column keys are range-checked; the effective column is logged once at start-up. - config/obstacle_layer_params.yaml: drop the per-source keys the layer never read there. - depth_camera_obstacle_layer_test: set PNKX_NAV_CORE_CONFIG_DIR; add tests for a wrong type and a missing default file. Squash of fix/config-flow (ae7fce9,f8705e1). Checked on the KIT robot on 22/10/2026: - the depth layer summary at start-up is unchanged; - a shared-block key now reaches VoxelLayer; - FOV_W 3.5, z_voxels 17, a wrong-typed key and a missing default file each give INITIALIZATION_FAILED.
47 lines
3.3 KiB
YAML
47 lines
3.3 KiB
YAML
# Giá trị mặc định của DepthCameraObstacleLayer, bằng mặc định trong code.
|
|
# Plugin đọc file này TRƯỚC, rồi khoá cùng tên trong khối <costmap>/<plugin> của config costmap đè lên
|
|
# (Costmap2DROBOT chép khối chung <plugin>: vào đó trước khi tạo layer).
|
|
# Đây là bản đóng gói kèm gói robot_costmap_2d; robot chạy bản trong
|
|
# pnkx_nav_core/config/runtime/config/depth_camera_obstacle_layer_params.yaml.
|
|
depth_camera_obstacle_layer:
|
|
enabled: true # [bool] false = layer không đánh dấu, không xoá gì.
|
|
# [m] Độ phân giải chiều cao của điểm lưu. > 0. Tăng (vd 0.05): ít điểm, nhẹ CPU hơn nhiều;
|
|
# giảm: nhiều điểm hơn, kd-tree mỗi chu kỳ nặng hơn.
|
|
voxel_resolution: 0.01
|
|
# [m] Bán kính tìm điểm cloud quanh điểm đã lưu. > 0. Tăng: khó xoá (vết ma bám lâu hơn);
|
|
# giảm: vật mỏng/thưa dễ bị xoá nhầm.
|
|
check_radius: 0.1
|
|
# [điểm] Ít hơn số điểm cloud này trong check_radius thì điểm đã lưu bị xoá. >= 1. Tăng: xoá mạnh hơn.
|
|
number_clearing_threshold: 2
|
|
# [m] Khoảng cách gom cụm Euclidean khi đánh dấu. > 0.
|
|
ec_seg_distance: 0.2
|
|
# [điểm] Cỡ cụm nhỏ nhất khi gom cụm. >= 1.
|
|
ec_cluster_min_size: 5
|
|
# [điểm] Cụm có <= số điểm này không được đánh dấu (lọc nhiễu). >= 0. Tăng: bỏ vật nhỏ.
|
|
size_of_cluster_rejection: 5
|
|
# [m] Điểm trong FOV cách tâm robot dưới mức này luôn bị xoá. >= 0.
|
|
forced_clearing_distance: 0.1
|
|
# [bool] true: cloud dưới number_points_considered_as_blocked điểm thì bỏ qua xoá (coi camera bị che).
|
|
# false: cloud ít điểm như vậy thì xoá hết điểm trong FOV ("không thấy gì").
|
|
enable_near_blocked_protection: true
|
|
number_points_considered_as_blocked: 5 # [điểm] >= 0.
|
|
# [bool] VoxelGrid 5 cm trên cloud gộp trước khi xoá/đánh dấu (nhẹ CPU).
|
|
use_voxelized_observation: true
|
|
# [bool] Chỉ hỗ trợ true (lưu điểm theo toạ độ global). false thì nav từ chối khởi động.
|
|
use_global_frame_to_mark: true
|
|
# [s] Cloud chờ TF đúng stamp tối đa bao lâu rồi bỏ. >= 0. Không bao giờ dùng TF mới nhất.
|
|
transform_tolerance: 0.2
|
|
# [bool] true: xoá ô và điểm đã lưu nằm dưới footprint robot mỗi chu kỳ. false: chỉ dùng khi chẩn đoán.
|
|
footprint_clearing_enabled: true
|
|
# [-] Cách gộp lên costmap chung: 1 = lấy max (không hạ cost của layer khác), 0 = ghi đè trong vùng
|
|
# cập nhật. Giá trị khác: layer không tác động gì lên costmap.
|
|
combination_method: 1
|
|
# Danh sách nguồn, cách nhau bằng dấu cách. Rỗng = layer không đánh dấu gì. Khoá của từng nguồn
|
|
# (topic, FOV_W, FOV_V, min/max_detect_distance, min/max_obstacle_height...) KHÔNG đặt ở đây mà
|
|
# trong khối <plugin>/<tên nguồn>/ của config costmap.
|
|
observation_sources: ""
|
|
# track_unknown_space cố ý KHÔNG có ở đây: không đặt thì layer theo track_unknown_space của costmap.
|
|
debug:
|
|
stats: true # [bool] log đếm định kỳ (điểm cloud, điểm lưu, đánh dấu/xoá, thời gian).
|
|
stats_period: 5.0 # [s] chu kỳ in log đếm. > 0.
|