From 7c93fe47aa10883dcf1a40301ac1e06b4d8e752e Mon Sep 17 00:00:00 2001 From: duongtd Date: Thu, 29 Oct 2026 15:46:30 +0700 Subject: [PATCH] fix: drop the start-footprint check from the back-off pivot The back-off pivot rejected a robot standing 0.375 m from a charger goal with about 10 deg of yaw ("current footprint does not clear the dock along the approach axis"). With dock_anchor=face the dock is modelled at the goal, which is the docked base pose, while the real charger face lies 0.40 m behind it. So a rear corner that projected behind the goal line was read as inside the dock, although it had 0.45 m of clearance. The robot physically stands at its start pose, and the back-off only moves it away from the dock, so the check guards nothing. Rotation sweeps and approach legs are still checked against the costmap when pivot_check_costmap is on. Test: the 29/10 15:36 robot start now yields backoff_pivot_straight; with the key at 0 it still fails as before. --- src/dock_calc.cpp | 24 ++++++------------------ test/dock_planner_test.cpp | 4 ++++ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/dock_calc.cpp b/src/dock_calc.cpp index cd0c82c..a5c7650 100644 --- a/src/dock_calc.cpp +++ b/src/dock_calc.cpp @@ -980,19 +980,13 @@ bool DockCalc::makePlanMoveToDock( const double backoff_length = (backoff_target_longitudinal - start_longitudinal) / std::fabs(longitudinal_gain); - double closest_footprint_projection = - std::numeric_limits::max(); - const double relative_yaw = normalizeAngle(start_yaw - approach_yaw); - const double cos_relative_yaw = std::cos(relative_yaw); - const double sin_relative_yaw = std::sin(relative_yaw); - for (const auto& point : footprint_robot) - { - const double projection = point.x * cos_relative_yaw - - point.y * sin_relative_yaw; - closest_footprint_projection = std::min( - closest_footprint_projection, projection); - } + // No check of the start footprint against the dock: the robot + // physically stands there, and the back-off only moves it away. + // With dock_anchor=face the dock is modelled at the goal, which + // is the docked base pose, not the real face (the charger apex + // sits 0.40 m behind it). That check rejected a robot whose rear + // was 0.45 m clear of the charger. if (!std::isfinite(backoff_length) || backoff_length > config_.pivot_backoff_max_distance + kEpsilon) { @@ -1001,12 +995,6 @@ bool DockCalc::makePlanMoveToDock( " m exceeds pivot_backoff_max_distance " + std::to_string(config_.pivot_backoff_max_distance) + " m"; } - else if (start_longitudinal + closest_footprint_projection < - dock_extent + config_.reverse_distance_padding - kEpsilon) - { - backoff_reason = - "current footprint does not clear the dock along the approach axis"; - } else { const int sample_count = std::max( diff --git a/test/dock_planner_test.cpp b/test/dock_planner_test.cpp index 1b3cd59..6c1e742 100644 --- a/test/dock_planner_test.cpp +++ b/test/dock_planner_test.cpp @@ -560,6 +560,10 @@ void testBackoffPivotRobotFailures() const std::vector starts = { pose(0.579, 0.292, 0.0), pose(0.427, 0.155, 0.0), + // 29/10 15:36: 0.375 m out and yawed about 10 deg, so a rear corner + // projects behind the goal line. A removed start-footprint check + // rejected this although the real charger face was 0.45 m away. + pose(0.375, -0.149, 0.17), }; for (const auto& start : starts)