A grade 3 student has been given a challenge for a competition and we are stuck on how to code this challenge. The challenge is to place the battle bot into a large black circular battle ring with a white line around the perimeter against another competitor. The first to get pushed out by the other loses. Here is what my students wants to do (if possible):
- hook up three cameras and train each that when it gets within 2cm (ish) of the white perimeter to retreat for 2 seconds and then turn about 45 degrees.
- recognise the other bot and charge to it. When contact is made, keep pushing.
- if it senses another bot pushing it to push back.
- is pushing towards white, do not stop pushing (so override the retreat when pushing).
- this all has to occur on its own. Student is only allowed to start program and then stand back so bot has to operate on its own.
- mainly its competitor are Lego Mindstorms, so we kinda want to beat them!

We know how to colour train and object train (but this doesn't always work, so hoping to find a colour on the other bot to lock onto instead, but need a backup plan). We know how to code forward and turns (where we left yesterday)

We are hoping that with three cameras, all three will be able to colour/object track, to make him more accurate...

And yes, this was a grade 3 student's idea!

Any help with how to program the code. The if/then blocks are not my speciality... yet... Competition is in 2 weeks. Will gladly share results and take video if we can figure this out Smile

Amber (from Kelowna)


Hi Amber from Kelowna! Kudos to the grade 3 student being creative with awesome suggestions. Here's some answers to your question

1) The type of "robot battle" that you're referring to is "Sumo"

2) I have implemented a strict "no battle bot robot fighting" with ezrobot - and instead promote social and safety inventions with robotics that help society, not destroy it. I strong disagree with robots being programmed to fight. Using advanced technology for war-far or fighting is a taking steps back as a society. Maybe the student can be asked to invent an idea that helps society rather than destroys it? Here's some positive use-case ideas for robotics helping society:
- simulate a mars mission
- assist person with disability eat or fetch items
- navigate a disaster area
- instruct a group to exercise (use jd)

Here's more detail:

3) Now, because I also like to help, i can give a few pointers if you continue to go through with using advanced technology in a destructive way Winky.
- The EZ-B (that's the computer on your robot) can support 1 camera max (not three)
- Detecting object (i.e. another robot) would have to be trained in nearly a thousand positions. Just like children with autism, when a robot views a trained object at different angles, it looks like a new object. Viewing angles change the physical outline and details of an object, making it indistinguishable from the original angle. While this can be solved by training the robot for thousands of viewing angles, it's not practical. Also, since only one camera can be connected to a robot, it makes sense to use the camera for detecting the ring border instead.

Detecting the ring
What i recommend is pointing the camera down toward the ground. Train the robot to recognize the white of the outside ring. When the white is detected, have the robot reverse for a second or two to avoid the ring. Turn around 180 degrees, and move forward again. The idea is ping-pong to bounce off the edges over and over until the robots run into each other and one pushes the other out.

Detecting the opponent
Sumo robots don't actually detect the opponent. They simply keep moving back and forth within the ring hoping they run into an opponent. Due to the size of the ring and the opponent, the chances of running into each other are quite high. Usually the robot is approx 10% size of the ring, which gives the robot a 1:10 chance of colliding with the opponent.

- Robots fighting each other is a terrible idea to teach to the next generation of humans taking over our planet Smile
- The robot doesn't "look" or "detect" the opponent robot, it just bounces back and forth in the ring
- The camera is used to detect the outter ring edge, reverse, turn the robot around, and move forward. Loop
- Have the camera point down to detect the ring border. There is a The Robot Program episode about line following by using the camera pointed down that you can reference.
- The Robot Program and ezrobot will never support robots fighting. This means you will never see a tutorial or activity on this subject. But, we'd gladly help your students build robots that have a positive influence on society Grin


I appreciate (and agree) with your perspective... it's that digital citizenship (responsibility) piece!

There is a big Robotics "tournament" at the local college, hence they set the Activities. I will use your suggestions to learn how to detect, but suggest to the student to use these skills to enter the soccer game challenge. This one, they try to score on the opponent's net... similar programming concepts.

I also have a student entering the dance/theatre challenge, where JD will be re-enacting a scene from a movie.



Those are great objectives! They'll clearly take home the gold Grin


I also don't condone bots for violence but in relation to the technical question of 3 cameras i assume you can always use more than 1 EZB in a project and UART or MQTT connect them so you can use more cameras just sending the results of the image color motion recognition to the primary EZB.


WOW, a no " battlebots" rule? but those are so cool watch. Seeing robots ripped to shreds and parts flying is so cool. Plus I'm a big fan of terminators Smile just a matter of time and we will wipe ourselves out by the machine at the rate technology is going I think.


Sorry but if you have implemented a strict "no battle bot robot fighting" with ezrobot, then why is there a "battle bot" product available in your e-store?

I don't see much of a difference between pushing an opponent out of a ring versus flipping it.

Battle Flipper