feat: per-marker dock_face_offset and pivot margin for dock_anchor mating_edge

The charger goal is the docked base_link pose, and the real charger face lies 0.40 m behind
it (detector offset_x). mating_edge measured the pivot sweep from a face assumed at
mating_extent (0.325 m) behind the goal, and still forced a terminal of at least
rear_extent. So the robot rotated with its centre about 0.725 m from the charger face.

Two optional keys, valid only with dock_anchor: mating_edge (rejected with center or face):
- dock_face_offset [m]: distance from the goal back to the real dock face. Default
  mating_extent.
- dock_pivot_safety_margin [m]: overrides maneuver/pivot_safety_margin for this marker.
A YAML null reads as unset, so move_base2 can clear a previous marker's value.

For mating_edge, the terminal floor becomes
max(mating_extent - face_offset, 0) + padding (floored at path_point_spacing), and the pivot
vertex becomes max(straight_distance, circumscribed - face_offset + margin). The costmap
rotation radius uses the same margin. center and face are unchanged.

KIT charger (face offset 0.40, margin 0.10, straight_length 0.2): vertex 0.2 m, robot centre
0.60 m from the charger face. Tests cover the three robot starts, the defaults, validation
and null handling. The test target now links yaml-cpp itself.
This commit is contained in:
2026-10-29 16:54:16 +07:00
parent 9d31c0e5db
commit 07e2fd3b38
8 changed files with 406 additions and 32 deletions

View File

@@ -2,6 +2,7 @@
#include <algorithm>
#include <cmath>
#include <optional>
#include <utility>
#include <boost/dll/alias.hpp>
@@ -93,6 +94,11 @@ FootprintLoadStatus loadDockFootprint(
return FootprintLoadStatus::kValid;
}
std::string optionalDistanceText(const std::optional<double>& value)
{
return value.has_value() ? std::to_string(*value) + " m" : "unset";
}
} // namespace
DockPlanner::DockPlanner() = default;
@@ -366,11 +372,16 @@ bool DockPlanner::initialize(std::string name,
});
initialized_ = true;
const std::string dock_face_offset_text =
optionalDistanceText(loaded_config.dock_face_offset);
const std::string dock_pivot_safety_margin_text =
optionalDistanceText(loaded_config.dock_pivot_safety_margin);
robot::log_info(
"[dock_planner] Initialized dock maneuver (docking edge is derived per plan "
"from the side the robot stands on): model=%s, TF %s -> %s, wheel_base=%.4f m, "
"max_steering_angle=%.4f rad, minimum_turning_radius=%.4f m, "
"pivot_fallback_extension=%.3f m, pivot_safety_margin=%.3f m, "
"dock_face_offset=%s, dock_pivot_safety_margin=%s, "
"pivot_backoff_max_distance=%.3f m, pivot_check_costmap=%s.\n",
loaded_config.requiresAxleTf() ? "ackermann" : "differential",
loaded_config.requiresAxleTf() ? loaded_config.front_axle_frame.c_str() : "-",
@@ -378,6 +389,7 @@ bool DockPlanner::initialize(std::string name,
loaded_config.wheel_base, loaded_config.max_steering_angle,
minimum_turning_radius, loaded_config.pivot_fallback_extension,
loaded_config.pivot_safety_margin,
dock_face_offset_text.c_str(), dock_pivot_safety_margin_text.c_str(),
loaded_config.pivot_backoff_max_distance,
loaded_config.pivot_check_costmap ? "true" : "false");
return true;