Robot Death Match

You’ve learned about sensors, motors, micro-controllers and built your own robot. Now it’s time to make it fight to the death, all in the name of education.

The arena is a rectangular table that is black in the middle and white around the edges as seen here:

Two robots will be put into the arena and the idea is you need to push the other robot out of the arena to win.

You will need to come up with the best way to program your robot to do this. By combining the information and code examples in these blog posts:

  • Adding the IR sensor
  • Adding the Ultrasonic sensor
  • Driving two motors using an arduino and L239D driver chip.
  • Programming the robot to stay on black using the IR sensor.

Let’s think about a strategy. A strategy is important because you need to have an idea of what you want the robot to do before you actually sit down to write some code.

Take a look at the image below for an example starting point to the match. (it won’t be exactly like this , it’s just one example)

Just so we can tell the robots apart, I’ve given our robot blue wheels. The robot with the black wheels is the enemy and must be destroyed without mercy 🙂

So right now, our robot is looking straight ahead. It doesn’t know where the other robot is. One method of attack is to have our robot spin around while ‘looking’ with the ultrasonic sensor. If it detects an object (the other robot) it can then stop spinning and drive forward to attack.

So let’s say we’ve spun around and detected an object. Now we can charge towards it and attempt to knock it off the table.

 

This is one example of a strategy. If we are to write code to do this it would look something like the following pseudocode:

 

There are also a couple of problems with the “spin and attack” strategy. What is the enemy robot going to do? If the other robot is doing the exact same thing then both robots will just spin and charge at each other. What could you do to give your robot an advantage ? Maybe moving around more instead of just spinning is something to consider.

This entry was posted in games, Tutorial and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *