Discover our
resources

Activity: Autonomous robot race

Materials required:

  • 2 robots minimum
  • 1 computer/robot
  • Racing arena


The advantages of this activity :

  • Fun
  • Popular with all ages
  • Perfect for introducing the principle of supervised learning

Duration :

40 to 60 minutes

Age :

+ 8 years

Software configuration :

Robot race mode

A fun activity for an arena with several robots: students train the robots to drive around a circuit, then organize a race. Through manipulation, students learn the principle of supervised learning and the importance of quality training data.

Robot racing is the recommended activity for getting started with AlphAI.

Introduction

Build your arena to form a circuit. We recommend using a racing arena designed by Learning Robots, but you can also build your own circuit: in this case, make sure there's a good visual contrast between the ground and the edges of the circuit, that the lighting is uniform and that the ground is clean.

Setting

Connect each robot to a computer, then choose the "robot race" example configuration or create your own settings.

Make sure that all robots have the same settings and, above all, the same speed.

Training

Check that the "stand-alone" button is deactivated, and that the "learning" button is activated.

It's your turn to play! You can train your robot to move by clicking on the actions on the right of the screen, or by controlling it with the arrow keys or AZEQSD on the keyboard.
We recommend that you move around the arena in a clockwise direction.

During this learning phase, there's no need to try to go fast: the aim is to teach the robot to make turns in the right direction, without bumping into walls. Take the time to choose the right action each time (if you make a mistake, click on "Forget action" next to the learning button). Be careful not to confuse left and right when the robot is moving in the opposite direction!

Teach the robot to stay away from the central obstacle to avoid getting stuck when it becomes autonomous.

You can also move the robot by hand to intentionally confront obstacles and teach it what to do in these situations.

In the control panel at the bottom of the screen, you can set the robot's top speed. We recommend a maximum speed of 30 for a small race arena, 35 for a large race arena, and 40 for a very large race arena.

The higher the speed, the faster the robot will be, but the harder it will be to control. Choosing a very high speed is not always an advantage!

Learning tests and improvements

Once you've done a few laps around the arena, you can activate autonomy. If your robot is well trained, it will then start doing tricks on its own!

But the learning process isn't over yet: even when the robot is self-piloting, you can continue to control it by pressing the arrow keys while it's moving. For example, if the robot gets stuck against a wall and doesn't know what to do, you can unblock it by asking it to move backwards (provided the "move backwards" action has been activated in the "actions" tab on the left of the software interface.

The robot race

Once your robots have been trained, organize a competition: place the competing robots on the starting line. Give the starting signal, and the teams simultaneously click on the "Autonomous" button (or press the space bar on the keyboard) to start the race.

During the race, only autonomous mode is allowed: participants must not give instructions to their robot. A referee may move robots that are blocked for more than 5 seconds, to allow them to continue the race.

The first robot to complete 3 full laps wins!

Feedback and conclusion

We have used a supervised learning algorithm. This algorithm is based on the artificial neural network displayed on the screen (but there are other types of algorithms that are not based on neural networks, such as the K-nearest neighbor algorithm). All supervised learning algorithms work as follows:

In a first phase called training, we provided the algorithm with example decisions, i.e. both images of what the robot's camera sees and the actions it should choose when the camera sees these images. During training, the artificial neural network was modified by the learning algorithm (more specifically, certain connections were strengthened, others diminished, so that the neural network became capable of mimicking the same decision making).

In a second phase, called utilization, the algorithm is able to make good decisions on new images.

We have seen that not all the robots learned the same thing: some performed better during the race, others worse. As all participants used the same algorithm, we can see that the quality of autonomous decision-making depends on the quality of the training data.

We can discuss together what makes quality training data:

- Quality of training data = absence of decision-making errors

- Data quantity not always a guarantee of autonomy quality

- Exhaustiveness of situations: the robot is more likely to make the wrong choice when faced with an unknown situation.

Further information

Now that the students have understood that the most important factor in winning the race is the quality of the training data, start the activity all over again!

You can also restart the race by adding new rules:

  • Limit training data (e.g. 25 data points maximum), but allow participants to move their robot by hand during the training phase.
  • Making the arena more complex
  • A different arena for training and racing