WRO Junior-High 2015. Treasure Hunt. Part 3. Decoding field color code Pro Preview

The robot works on the field and decodes the different colours that represent the rows and the columns.

  • #200
  • 17 Apr 2016
  • 4:04

It actually moves on the field and with the color sensors decodes the different colors.

Arrays vs Variables

The robot could store the values of the detected colours in variables or in arrays.

Variables

If we choose to store in variable we need eight different variable. R1 to R4 and C1 to C4. This is possible and is shown in the video, but makes the program difficult to maintain, read and use. 

Arrays

Another option is to store the values of the colours in an EV3-G array. The first detected colour will be stored as a first element of the array. The second will be stored as a second element of the array and so on. We could have two arrays - columns and rows each storing the values for the different rows and columns.

Complete playlist

Find the complete playlist at WRO Junior-High 2015. Treasure Hunt

 

WRO Box Collecting Robot

Building instructions for this LEGO Mindstorms EV3 robot used in the World Robotics Olympiad Junior competition

English

The next step of World Robotics Olympiad 2015 (WRO) Junior high competition is to use the robot and its color sensor and to work on the real field not this small model here and to detect the colors so that we know the rows and the columns. Here is how it goes.

What the robot does is that it detects a different colors from the grid and then we display this color and the value that we detected on the display of the brick. Currently what you can see are the values for the row, the values for the columns, the values for the first detected color and for the second. And, for example, for the first row we have the color 5, for as the second row we have the color 2. And in the same way we had the different colors for the different rows and columns. So we have decoded this code and we know the color of the different row and columns. Let's see how we do this in the program.

This here is the program for our robot and it's pretty straight forward, we just move the robot forward and then we detect. First we detect the first 8 color and then the last 2 colors. So this are the rows and the columns for the grid and these are the coordinates of the first intersection that we must go. And at the end we just turn and the program is pretty simple, but if we enter in the grid block, we decided to do the following thing. How does that program work? First, we wait with the color sensor to detect white. This is where we start. Then we wait to detect one of the colors from 2 to 5. These are green, blue, yellow and red. We wait for 0.1 second, just to be sure that we are over the colored spot and then we detect the color. And then we get red, green, blue. Where do we store these values? We decided to sort the values in variables. And we have 8 different variables.

In these variables we store the color that was detected by the color sensor and by each measurement we just play a tone and we have our solution with 8 different variables. The problem that we solve with these solution is getting pretty complex, after that, to move the robot on the field, with the intersection, because it has too many switches.

So we built this solution, but it's not very clean. And the next solution that we are working on is arrays, but this will be in the next video.

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Decoding field color code
  • 1
  • 0
  • 0
  • 3d_rotation 1