feat: add dock_anchor mating_edge for goals already offset to the docked pose

The charger detector offsets its target to the docked base_link pose (offset_x 0.40 from
the V apex), so the charger face is at the robot's rear edge at the goal. dock_anchor=face
places the face at the goal itself, so the pivot vertex came out 0.624 m in front of the
goal, about 0.40 m more than needed. Robots standing 0.38-0.58 m out had to back off or
failed to plan.

dock_anchor=mating_edge keeps every face behaviour, except that the on-the-spot pivot
clearance is measured from the real face, mating_extent behind the goal:
vertex = max(straight_length, circumscribed - mating_extent + pivot_safety_margin).
For the KIT robot (0.65 x 0.69) the vertex drops from 0.624 m to 0.4 m. footprint_dock is
ignored, as with face. center, face, direct entry and single cusp are unchanged.

Test: the 29/10 starts 0.579/0.292 and 0.427/0.155 now pivot directly at 0.4 m;
0.375/-0.149 backs off only to 0.45 m (26 poses against 36 with face).
This commit is contained in:
2026-10-29 15:59:47 +07:00
parent 7c93fe47aa
commit 9d31c0e5db
6 changed files with 89 additions and 7 deletions

View File

@@ -322,14 +322,18 @@ bool DockPlanner::initialize(std::string name,
}
std::vector<robot_geometry_msgs::Point> loaded_footprint;
if (loaded_config.dock_anchor == DockAnchor::kFace)
if (loaded_config.dock_anchor == DockAnchor::kFace ||
loaded_config.dock_anchor == DockAnchor::kMatingEdge)
{
// Goal sits on the approach face: dock size never enters the approach
// formula, so a declared footprint_dock is deliberately ignored.
// Goal sits on the approach face (face) or the face touches the robot at
// the goal (mating_edge): dock size never enters the approach formula,
// so a declared footprint_dock is deliberately ignored.
if (planner_nh.hasParam("footprint_dock"))
{
robot::log_info("[dock_planner] '%s' uses dock_anchor=face; footprint_dock is ignored.\n",
name.c_str());
robot::log_info("[dock_planner] '%s' uses dock_anchor=%s; footprint_dock is ignored.\n",
name.c_str(),
loaded_config.dock_anchor == DockAnchor::kFace ? "face"
: "mating_edge");
}
}
else