LEGO ROBOT CHALLENGE
- Oana Donose
- Nov 23, 2017
- 3 min read
This is the end of our "Robodoz3r"'s journey. And what a journey it's been. From the very first two pieces of Lego put together and up until we picked up our prizes and gave the robot back it's been an adventure.
Back when we had no idea how it was going to work, this is how it looked like:

Marked with a white arrow, the colour sensor, placed at the back, in case the robot was pushed off the arena. Also at the back, in case it was bumped from behind, the touch sensor(purple mark). The red arrow marks the infrared sensor, the most important part in our success and the worst of our downfall(as I believe).
After a couple of hours spent building the robot, we finally got to 'program' in a drag&drop interface, using the software provided by LEGO MINDSTORMS: EV3 HOME EDITION.

First, we tested out the values. The volume, the speed, the turn angle. We measured the arena and properly calculated the speed that the robot should have when going forwards as to not get off the arena by itself. Then, we checked the light sensor, the values; we decided that 'reflected light intensity' would be the best choice and stuck with it. Because of the nature of the arena(a black matte surface that reflected little to no light and a clean white border), it was hard to simulate it. Sometimes, while testing the robot, the colour sensor would go off.
But then, what do we like if not challenges? So we assumed(spoiler alert: we were right) that it was just the surface that gave us headaches, not the actual program. Now, about the program.
We first grabbed different sensors and tried our best to simulate a fight and test out what we've done. This, for reference, is what we've done for the touch sensor:

This checks for the level of the bump '2' (in a loop) which is a minor touch for the touch sensor and if it gets bumped, it goes forward for a second and then it turns , assumingly facing the opponent that bumped it.
This is our fearless, sneaky robot challenging Luke while he was trying to test out the touch sensor. (note: the robot lost) But there was still time to fix it.
We then went on programming the colour sensor as such:

As I've stated a few sentences ago, we chose reflected light intensity for the check and set the threshold value to 10, again in a loop. If the sensor detected anything in that range of light, it went backwards at a speed of 74 for 1 second.
The hardest sensor of all, though, was the infrared sensor. Tricky because it was placed quite high as our robot was tall, and by observing the competition we found out that almost all of the other robots were flat and down to the ground. Worrying that our gorgeous robodoz3r would not even see its opponent, we hoped for the best.

This is the part of our program that deals with the infrared sensor. It checks for a threshold value of 50, which is, as we've tested for a while, about 40 centimeters distance. That's how far it could see. Then, we printed out a message on the display of the brick saying 'ROBOT FOUND' and also it played a sound like a horn, similar to speeding up(clearly audible when the robot challenged Luke) , while going forward at a speed of 100(-100 in the program because that's how it rolled), again in a loop.
And we were almost done.

We added a loop that turned at different angles, indefinitely, all at the same time while checking for colour, infrared or touches.
This was the final program that brought our robodoz3r to life:

Comentários