Sequence Diagram
The communication between the KRL code and the Python environment is coordinated by a variable attributed to scanning phase and one attributed to the moving phase. Initially, "scanning" is true, and "moving" is false. The first while loop in the Python code ensures that the robot is in its scanning phase, accesses and processes the video stream from the Raspberry Pi, to determine the selected ball position. At the end of this phase, Python transmits the ball position to KRL, and sets a FALSE value for the variable SCAN in the KRL code. This triggers the KRL program to enter its while loop. When scan is equal to false, KRL set its MOVE variable to TRUE, and now it moves to the ball position, pushes the ball, and then returns to the scanning position. Once the robot is back at its scanning position, the variable called MOVE is set to false. The second while loop in the python code is intended to continue monitoring whether the robot is moving. While the robot is moving, scanning will not occur, as soon as the robot stops moving, scanning will reoccur.