From 6340838dacb229cd9235675dc248cbc81d2b0b54 Mon Sep 17 00:00:00 2001 From: duongtd Date: Thu, 15 Oct 2026 13:40:26 +0700 Subject: [PATCH] fix(depth): forward the evidence-point keys to the layer namespace Costmap2DROBOT copies a fixed list of observed_volume keys from obstacles/ into /obstacles/. The three phase-1 keys were missing, so the live layer always ran with their C++ defaults (evidence off, marking border 0) whatever the runtime YAML said. Unit tests set the layer params directly and did not catch it. The factory test now checks that the runtime YAML values reach the layer. --- src/costmap_2d_robot.cpp | 3 ++- test/depth_observation_buffer_test.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/costmap_2d_robot.cpp b/src/costmap_2d_robot.cpp index c0db6d4..16f40ba 100644 --- a/src/costmap_2d_robot.cpp +++ b/src/costmap_2d_robot.cpp @@ -465,7 +465,8 @@ void Costmap2DROBOT::copyParentParameters(const std::string& costmap_name, for (const char* key : {"depth_clearing_mode", "paired_marking_source", "depth_pair_queue_size", "depth_pair_max_wait_s", "depth_observation_max_age_s", "depth_valid_min_z_m", "depth_valid_max_z_m", "depth_free_margin_m", "depth_projection_margin_px", - "depth_voxel_z_resolution_m"}) + "depth_voxel_z_resolution_m", "depth_evidence_points_enabled", + "depth_evidence_points_per_voxel", "depth_marking_border_px"}) if (plugin_nh_element.hasParam(key)) costmap_plugin_nh_element.setParam(key, YAML::Clone(plugin_nh_element.getParamValue(key))); robot::log_info("topic: %s data_type: %s clearing: %d marking: %d inf_is_valid: %d min_obstacle_height: %f max_obstacle_height: %f", topic.c_str(), data_type.c_str(), clearing, marking, inf_is_valid, min_obstacle_height, max_obstacle_height); diff --git a/test/depth_observation_buffer_test.cpp b/test/depth_observation_buffer_test.cpp index 329723f..9dee46f 100644 --- a/test/depth_observation_buffer_test.cpp +++ b/test/depth_observation_buffer_test.cpp @@ -241,6 +241,17 @@ TEST(DepthBuffer, RuntimeFactoryForwardsObservedVolumeModeAndPairsSources) std::string mode; ASSERT_TRUE(settings.getParam("depth_clearing_mode", mode)); EXPECT_EQ(mode,"observed_volume"); + // Every observed_volume key of the runtime YAML must reach the layer namespace; a key + // missing from the factory forward list silently falls back to its C++ default. + const YAML::Node runtime_clearing = + YAML::LoadFile((runtime / "costmap_common_params.yaml").string())["obstacles"]["pc_clearing"]; + for (const char* key : {"depth_evidence_points_enabled", "depth_evidence_points_per_voxel", + "depth_marking_border_px", "depth_projection_margin_px", "depth_valid_max_z_m"}) + { + ASSERT_TRUE(runtime_clearing[key].IsDefined()) << key; + ASSERT_TRUE(settings.hasParam(key)) << key; + EXPECT_EQ(YAML::Dump(settings.getParamValue(key)), YAML::Dump(runtime_clearing[key])) << key; + } // Instantiate with the factory's scoped parameters, then verify the paired // owner exists and a marking-only half does not enter legacy observations. robot_costmap_2d::LayeredCostmap parent("odom", true, false);