State Switching

WARNING THIS IS A WORK IN PROGRESS!

Key points

The robot with the slave mode bluetooth module constantly sends its ball angle and ball distance data over to the robot with the master mode bluetooth module.

When the attack robot detects the ball is behind it while the defence robot detects that the ball is in front of it and that it is closer to the ball. The robot with the master bluetooth module will send a state switch signal.

The previously defence robot (now attacking) will start chasing the ball and (hopefully) catch the ball. The previously attack robot (now defence) will start its returning to goal manoeuvre, and since it moves towards the open area of its own goal, it will naturally avoid the incoming attack robot on its return.

In addition, during ambiguous cases such as when the ball is equally close to both robots, the robot with the master bluetooth module is always given priority of its “correct” role, preventing the possibility of excessive switching.

Updated: