refactor(depth_layer): read parameters like the other layers

DepthCameraObstacleLayer::loadParameters() wrapped each key in a
readParam() helper. It now reads the same way as
ObstacleLayer::getParams(): one block of loadParam() calls on the default
file, then one block of "if (priv_nh.hasParam(k)) priv_nh.getParam(k, v)"
on "<costmap>/<plugin>". The per-source keys do the same on
"<costmap>/<plugin>/<source>". Values and precedence are unchanged.

getParam() gets the current value as its default, so a value of the
wrong type keeps the file default instead of becoming 0, false or "".
The layer no longer throws on a wrong type itself. A wrong type in the
shared block still stops the costmap, in copyParentParameters(). The two
wrong-type test cases, which set the layer namespace directly, are
removed.
This commit is contained in:
2026-10-22 10:56:10 +07:00
parent e40e9c0104
commit 9b93a45b45
2 changed files with 115 additions and 70 deletions

View File

@@ -459,13 +459,6 @@ TEST(DepthCameraLayerConfig, RejectsUnportedModeAndOutOfRangeValues)
cfg = baseConfig();
cfg["voxel_resolution"] = 0.0;
expectThrow(cfg);
// A value of the wrong type stops the layer instead of becoming 0.
cfg = baseConfig();
cfg["number_clearing_threshold"] = "many";
expectThrow(cfg);
cfg = baseConfig();
cfg["depth_cam"]["FOV_W"] = "wide";
expectThrow(cfg);
}
TEST(DepthCameraLayerConfig, RefusesToStartWithoutItsDefaultFile)