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 :)
Amber (from Kelowna)