Track Distance Robot Has Travelled With Ball

Summary Currently, we don’t track how far a robot has travelled while carrying the ball. This makes it difficult to analyze performance, enforce strategy rules (e.g., max dribble distance), or feed this information into BehaviorTree nodes for decision-making.

Acceptance Criteria

  • Maintain a running distance counter for a robot once it has possession of the ball.
  • Distance should reset when the robot loses the ball.
  • Expose the travelled distance as a property (e.g., via WorldStateManager or blackboard).
  • Ensure updates happen in real time as robot position changes.
  • Add unit/integration test verifying distance increments correctly.

Implementation Ideas

  • Use robot pose updates (from WorldStateManager) to calculate incremental distances (Euclidean distance between consecutive positions).
  • Maintain a flag for whether the robot currently has ball possession.
  • Accumulate distance only while possession flag is true.
  • Consider exposing a signal (e.g., distanceUpdated) if external observers need live updates.

Why This Is Important

  • Enables testing compliance with game rules (e.g., limiting dribble distance).
  • Provides useful metrics for AI decision-making.
  • Supports debugging and visualization in tools like PathPlanner or UI dashboards.

Next Steps

  • Decide ownership of distance tracking (in AgentControl, WorldStateManager, or a dedicated tracker class).
  • Implement incremental distance calculation.
  • Integrate with possession detection logic.