Skip to content

Fix closed-track false goal stop, planner wp clamp, and short velocity crash - #32

Draft
cursor[bot] wants to merge 1 commit into
devfrom
cursor/critical-bug-inspection-d8b8
Draft

Fix closed-track false goal stop, planner wp clamp, and short velocity crash#32
cursor[bot] wants to merge 1 commit into
devfrom
cursor/critical-bug-inspection-d8b8

Conversation

@cursor

@cursor cursor Bot commented Aug 5, 2026

Copy link
Copy Markdown

Bug and impact

  1. Closed-track false GOAL_ARRIVED / immediate stop — With GoalArrivalMonitor + StopExecAtGoalTask, the rising-edge detector started as "not arrived". On closed race lines (goal_point == start_point), default Yas Marina start pose is ~2.1 m from the goal (inside the 3 m radius), so the first tick fired GOAL_ARRIVED and stopped execution before any driving.

  2. Plan waypoint step-back / OOB — Plan UI step-back from wp 0 passed wp=-1 into LocalPlanningStrategy.reset. Numpy negative indexing jumped localization to track end (~5251 m on Yas). Oversized wp values could IndexError in the Tk UI.

  3. Control crash on short/empty velocity profile — Stanley / PID / Pure Pursuit indexed velocity[current_wp] with no length guard. A plan whose ReferenceSpeed is shorter than the path crashed mid-drive once current_wp passed the short array.

Root cause

  • Goal monitor treated "already inside radius at t0" as a rising edge.
  • reset(wp) did not clamp; UI allowed negative wp.
  • Controllers assumed len(velocity) == len(path).

Fix

  • Seed GoalArrivalMonitor on the first tick (and after reset) without notifying; real arrivals still fire on leave → re-enter.
  • Clamp LocalPlanningStrategy.reset(wp) to [0, n-1]; Plan UI step-back floors at 0.
  • Clamp velocity index in Stanley / PID / Pure Pursuit; empty profile → zero accel.

Validation

  • pytest for goal-monitor seeding, planner reset clamp, and short/empty velocity profiles — 20 related tests passed.
  • Concrete Yas Marina numbers: start–goal distance 2.10 m; pre-fix step-back from wp0 → s≈track_end, post-fix stays at s≈0.
Open in Web View Automation 

…y crash.

GoalArrivalMonitor seeded its rising edge after the first in-radius sample, so
Yas-style closed lines (goal==start) fired GOAL_ARRIVED/StopExecAtGoal immediately.
LocalPlanningStrategy.reset now clamps wp (Plan step-back from 0 no longer jumps
to track end). Controllers clamp velocity index when ReferenceSpeed is short.

Co-authored-by: Majid Khonji <majid-khonji@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant