1.7 KiB
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:
- Modify
sendPointToPointTaskmethod inBaseSRgvThread.java:- Locate the block where
shortestPathis null or empty (indicating a blocked path). - After the existing specific logic for "Floor 1", add a generic avoidance strategy.
- Avoidance Strategy:
- Query
WcsSrgvMapfor all sites withremark="cache"(avoidance points) on the current floor. - Filter out sites that are currently occupied by other SRGVs.
- Find the nearest reachable avoidance point to the current car.
- Task Splitting (Yielding Logic):
- Create a new "Continuation" Queue: Clone the current task but set its
StartSiteto the avoidance point and keep the originalEndSite. Insert this as a new pending task. - Update Current Queue: Change the
EndSiteof the current blocked task to the Avoidance Point. This effectively converts the current task into a "Yielding" task.
- Create a new "Continuation" Queue: Clone the current task but set its
- Return
falseto allow the scheduler to pick up the modified task in the next cycle.
- Query
- Locate the block where
Technical Details:
- Use
wcsSrgvMapServiceto fetch avoidance points. - Use
PathFinderto 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
elsecondition).
This approach ensures that when blocked, the car moves to a safe spot (Yielding Queue) and then resumes its original journey (Continuation Queue).