Files
FT542-WCS/.trae/documents/Implement Collision Avoidance Logic for SRGVs.md
2026-01-07 13:30:08 +08:00

1.7 KiB

I will implement collision avoidance logic in BaseSRgvThread.java to handle scenarios where a path is blocked by another SRGV.

Implementation Plan:

  1. Modify sendPointToPointTask method in BaseSRgvThread.java:
    • Locate the block where shortestPath is null or empty (indicating a blocked path).
    • After the existing specific logic for "Floor 1", add a generic avoidance strategy.
    • Avoidance Strategy:
      1. Query WcsSrgvMap for all sites with remark="cache" (avoidance points) on the current floor.
      2. Filter out sites that are currently occupied by other SRGVs.
      3. Find the nearest reachable avoidance point to the current car.
      4. Task Splitting (Yielding Logic):
        • Create a new "Continuation" Queue: Clone the current task but set its StartSite to the avoidance point and keep the original EndSite. Insert this as a new pending task.
        • Update Current Queue: Change the EndSite of the current blocked task to the Avoidance Point. This effectively converts the current task into a "Yielding" task.
      5. Return false to allow the scheduler to pick up the modified task in the next cycle.

Technical Details:

  • Use wcsSrgvMapService to fetch avoidance points.
  • Use PathFinder to verify reachability of the avoidance point.
  • Use BeanUtil (Hutool) or manual setters to clone the queue.
  • Ensure the new logic does not interfere with the existing "Floor 1" logic (put it after or as an else condition).

This approach ensures that when blocked, the car moves to a safe spot (Yielding Queue) and then resumes its original journey (Continuation Queue).