feat: add a back-off pivot as the last-resort dock maneuver, with optional costmap checks

A differential robot that stood closer to the dock than the safe pivot point had no
maneuver at all. Direct entry lacked curve room, the single cusp exceeded
maximum_forward_extension, and straight-pivot-straight requires the vertex between the
robot and the dock. Two charger dockings on the KIT robot failed this way (start
0.579/0.292 m and 0.427/0.155 m).

- New shape backoff_pivot_straight, differential only. It is tried only after every
  existing shape failed. The robot drives straight along its current heading (no rotation
  at the start) until it is past the pivot vertex, then follows the existing
  straight-pivot-straight geometry. Its feasibility does not depend on the turning radius.
- maneuver/pivot_backoff_max_distance [m]: longest allowed back-off; 0 disables the shape.
- maneuver/pivot_check_costmap: rejects a pivot shape when a rotation sweep (circumscribed
  radius + pivot_safety_margin) or an approach-leg footprint covers a LETHAL cell. The
  terminal into the dock is not checked: it ends in contact with the dock by design.
- Defaults keep every existing plan unchanged. Tests cover the two robot failures, unchanged
  plans for the existing shapes, ackermann, the gates and the costmap callbacks.
This commit is contained in:
2026-10-29 15:17:24 +07:00
parent 1f04a95e1b
commit 7c969d037b
9 changed files with 1008 additions and 49 deletions

View File

@@ -26,6 +26,24 @@ bool readOptionalDouble(const robot::NodeHandle& nh, const std::string& key,
return true;
}
bool readOptionalBool(const robot::NodeHandle& nh, const std::string& key,
bool& value, std::string& error)
{
if (!nh.hasParam(key))
{
return true;
}
bool parsed = value;
if (!nh.getParam(key, parsed, value))
{
error = "parameter '" + key + "' must be a boolean";
return false;
}
value = parsed;
return true;
}
bool readOptionalString(const robot::NodeHandle& nh, const std::string& key,
std::string& value, std::string& error)
{
@@ -123,6 +141,10 @@ bool DockPlannerConfig::load(const robot::NodeHandle& nh, DockPlannerConfig& con
loaded.pivot_fallback_extension, error) ||
!readOptionalDouble(nh, "maneuver/pivot_safety_margin",
loaded.pivot_safety_margin, error) ||
!readOptionalDouble(nh, "maneuver/pivot_backoff_max_distance",
loaded.pivot_backoff_max_distance, error) ||
!readOptionalBool(nh, "maneuver/pivot_check_costmap",
loaded.pivot_check_costmap, error) ||
!readOptionalString(nh, "kinematics/front_axle_frame",
loaded.front_axle_frame, error) ||
!readOptionalString(nh, "kinematics/rear_axle_frame",
@@ -172,6 +194,7 @@ bool DockPlannerConfig::validate(std::string& error) const
{"kinematics/minimum_turning_radius", minimum_turning_radius},
{"maneuver/pivot_fallback_extension", pivot_fallback_extension},
{"maneuver/pivot_safety_margin", pivot_safety_margin},
{"maneuver/pivot_backoff_max_distance", pivot_backoff_max_distance},
{"terminal/reverse_distance_padding", reverse_distance_padding},
{"terminal/straight_length", straight_length},
{"maneuver/minimum_forward_distance", minimum_forward_distance},
@@ -257,6 +280,11 @@ bool DockPlannerConfig::validate(std::string& error) const
error = "parameter 'maneuver/pivot_safety_margin' must be >= 0 m";
return false;
}
if (pivot_backoff_max_distance < 0.0 || pivot_backoff_max_distance > 3.0)
{
error = "parameter 'maneuver/pivot_backoff_max_distance' must be in [0, 3] m";
return false;
}
if (path_point_spacing <= 0.0 || path_point_spacing > 1.0)
{
error = "parameter 'sampling/path_point_spacing' must be in (0, 1] m";