- # 225
- 21 Aug 2016
Tasks description, submission and evaluation are available to subscribed users.
Subscribe now to acces the full capacity and get feedback.
- We start our robot from the green region and we program with the manual what are the different regions, where are they, and the different blocks and their order on the robot. And we did this point deduction on the program with the menu and then on counting the lines. But in between, there is some transformation of this information, and there are a few arrays involved. And in this video, I will introduce you to the arrays and how we work with them.
This here is the full program. And in this program, we'll look at the block for moving to the fourth line and for sorting blocks. And to test with you, we'll take a look at the Find Places. If we enter this block, we can see that these blocks involve only different calculations of different variables and arrays. And that's it. There are no movements, no control motors or sensors. The purpose of this block is very interesting. It's only calculation and it demonstrates how we can use arrays to calculate. And we have... In our program we have one array that's called "InRobot." And that's from the previous videos where we add, we configure the order of the different blocks. And that's the array "InRobot." We have a second array that's called "Sectors" with the different values. And the values are the following; First the two blocks at the beginning are green and green is a...we have the order of our colors. And blue is actually one, and green is two, and red is three. So we have our blocks and we have two, two let's say, then one blue, one blue and one red. And these are the values that we have entered in the menu for the order of the blocks. These here are the blocks, and these here are the sectors, S. And the sectors are the following; the first sector is red which means it is three, the second sector is blue which means it is two, and the third sector is green. Sorry, the second sector is blue which means it is one and the third sector is green which means it is two. And these are the two arrays. First, the order of the blocks then the order of the sectors. And as a result from this Sort Blocks array, sort block program, we must...from the Find Places, we must get a new array, and this new array is called "Places." And it will have five different cells. And the purpose of this cell is to tell us in which place should we add the first element. So in which place should we add the first element. And if we take a look at the value of two and we see that this is green. And we have a green sector as a third sector. This means that we must calculate a value of three because that's where we should place this block. We should place this block in the third sector, one, two, three. And the second block should also be placed in the third sector. So we have here the connections like this. This goes into the third, this goes into the third. This blue goes into the blue which is the second, so this and this goes here. And the value in places should be two for the third element and two for the fourth element. And for the last element in the blocks that are on the robot, the last block should be placed in the first sector. So the value here is one. And that's the purpose of this block. Sorry not like this. I need another tool. It's just an array. And that's what we should do in our program. That's the goal of this array transformation. It might sound a little bit difficult but once you get to know how to work it with arrays, these programs will be pretty easy. Let's now go into the next video where we'll discuss the exact way in which we program our robot and how we transform these arrays. Check out also the program that we added below the video and the task for this program.