feat(planner_runner): bind dock_straight_length per docking marker

A docking marker profile can now override DockPlanner's
terminal/straight_length with dock_straight_length (dock_planner c94c5b2).
It goes through the same path as dock_face_offset and
dock_pivot_safety_margin: copied into the planner namespace when the marker
declares it, written as YAML null when the next marker does not, so one
marker's value never leaks into another and the global default stays
untouched. Valid for every dock_anchor.

- Test: copied for the marker that declares it, null and rebuilt for the
  next marker, restored when the first marker comes back, and
  terminal/straight_length is never written.
- maker_sources.yaml / dock_global_params.yaml: document the key.
This commit is contained in:
2026-11-12 15:44:14 +07:00
parent 5882082172
commit 0d00c22fe8
4 changed files with 54 additions and 5 deletions

View File

@@ -819,6 +819,43 @@ TEST(PlannerRunnerDockingMarker, CopiesAndClearsOptionalDockOverridesPerMarker)
EXPECT_EQ(pluginInitializeCount(), before + 3);
}
TEST(PlannerRunnerDockingMarker, CopiesAndClearsDockStraightLengthPerMarker)
{
Fixture fixture;
ASSERT_TRUE(fixture.ok()) << fixture.error();
robot::NodeHandle nh;
nh.setParam("docking_marker_profiles/straight_override/dock_straight_length", 0.30);
nh.setParam("docking_marker_profiles/straight_default/global_planner",
YAML::Node("TestPlannerOk"));
nh.setParam("TestPlannerOk/terminal/straight_length", 0.40);
const std::size_t before = pluginInitializeCount();
ASSERT_TRUE(fixture.runner_.bindDockingMarker("straight_override", "TestPlannerOk"));
YAML::Node copied;
ASSERT_TRUE(nh.getParam("TestPlannerOk/dock_straight_length", copied));
EXPECT_DOUBLE_EQ(copied.as<double>(), 0.30);
ASSERT_TRUE(fixture.runner_.swapPlanner("TestPlannerOk"));
EXPECT_EQ(pluginInitializeCount(), before + 1);
ASSERT_TRUE(fixture.runner_.bindDockingMarker("straight_default", "TestPlannerOk"));
YAML::Node cleared;
ASSERT_TRUE(nh.getParam("TestPlannerOk/dock_straight_length", cleared));
EXPECT_TRUE(cleared.IsNull());
ASSERT_TRUE(fixture.runner_.swapPlanner("TestPlannerOk"));
EXPECT_EQ(pluginInitializeCount(), before + 2);
ASSERT_TRUE(fixture.runner_.bindDockingMarker("straight_override", "TestPlannerOk"));
YAML::Node restored;
ASSERT_TRUE(nh.getParam("TestPlannerOk/dock_straight_length", restored));
EXPECT_DOUBLE_EQ(restored.as<double>(), 0.30);
ASSERT_TRUE(fixture.runner_.swapPlanner("TestPlannerOk"));
EXPECT_EQ(pluginInitializeCount(), before + 3);
YAML::Node default_length;
ASSERT_TRUE(nh.getParam("TestPlannerOk/terminal/straight_length", default_length));
EXPECT_DOUBLE_EQ(default_length.as<double>(), 0.40);
}
TEST(PlannerRunnerDockingMarker, EmptyMarkerOrPlannerNameIsANoOp)
{
Fixture fixture;