Time for another competition. This time your robot will be sumo wrestling. For this, two robots will be placed in a black ring with a white border. They will have to drive around the ring autonomously trying to push the other robot out without driving over the edge. The first robot to touch the ground outside the ring loses. Despite sounding very different from Line Follower, the code for Sumo is extremely similar. Let's look at the basic rules, then try to create the code.
Basic rules of robot sumo:
Two robots are placed in the ring, each on their half
Reset buttons (small red button in the center of the Arduino) are held until the referee says go
The round starts with a three second pause to give people time to get away from the ring and ensure there are no shadows that could interfere with the sensors
Robots must drive autonomously
First robot (or part of a robot) to touch ground loses
The robots can NOT be dangerous or intentionally damage the other robot
At competitions, there are typically weight (500 g) and size (10cm x 10cm x unlimited height) limits that your class can decide to implement or ignore. These are the rules we will use, but RoboGames has a more complete list of competition rules for Mini Sumo.
Let's look at the basic outline of the code you'll need.
Here's the code with the same parts that you'll need to complete.
int _ABVAR_1_Light;
void setup()
{
delay(3000);
}
void loop()
{
if ( ( analogRead(0) ) < ( 250 ) )
{
//Right motor forward
//Left motor backward
delay(300);
}
else
{
//Right motor forward
//Left motor forward
}
}
This is a very basic sumo bot so far. What can you do to improve it? Currently, when it gets to the edge, it starts to turn. Is that best or should it back up first? Is the threshold value for your light sensor optimal? Would it be better to detect the white line too early or too late? Could you work with a partner to add more sensors to your robot? What other modifications can you make to the physical robot or the code to make it better?