We list the number of decisions that the robot is making while following the line. Then, we group them and decide on the number of sensors to be used.
- 20 Jan 2016
Three sensors is a good solution. I would say it is possible to follow the line with two sensors, but I am also making the assumption this would make the robot program quite complex. It is a good practice to always keep your programs as simple as possible. We might do one course of following the same line with two sensors, but for this course, we would stick with three.
Four sensors are the maximum number of Mindstorms sensors that could be attached to the Mindstorms brick (at least, officially). It might make the program more precise, but for this line three is just good enough.
The instructions for building the EV3 Competition Robot with 3 color sensors are given below.
Разновидност на състезателния робот от EV3, при който отпред има сензори за светлина.
We already have the construction, you can check out the links below for instructions on how do we build this construction. We have the proportional line following algorithm from previous videos. Now we must decide based on our strategy, we must develop it and decide on the number of sensors that we should use for this program. We should always try to keep it at the minimum. For this line following challenge, I think it's a good idea to use 3 sensors and I would like to walk you through the way we decide on using 3 sensors.
Let's look at the different behaviors that our robot should have. First, if the robot is coming in this direction
we must decide on turning left. This is our left behavior, let's mark it as 1, left - L.
Then we have one more behavior.
We are moving in this direction and we find a gap. That's a gap - G. Then we are moving in this direction and as we do so we must turn right - R. For this section here, we have the 2 crossed lines, we must again move forward and turn right, which is basically the previous behavior. These 2 behaviors are identical, although we have a line, forward and a line, left, we must decide on moving right.
For this section here, we move forward, in this direction and by moving forward we must decide to move left, which is the same as this left, even though we have a line continuing forward, we must decide to move left. So this here is again left - L.
Now for this section as you can see, they are quite similar, but in different places on the field we must decide for this to move left and for this to move right.
And that's kind of tricky. How do we know whether we should move left or right? We must decide on a priority. This is priority is the following. If we see a line to the right, then we move to the right. Would this work for this case? Yes, because there is no line to the right, we don't move to the right. Here there is no line to the right, here if there is a line to the right, we move to the right. Here, yes, there is a line to the right, so we move right. Here, there is no line to the right, so we move left. And here, there is a line to the right and we move right, but actually we must build a program to move left and what our program will do in this case is, it will move the robot forward, then it will decide to move right, then it will lose the line, because this is the end of the line, the robot will turn and we'll start following the line and we'll move left. This is what our robot will do. If on this intersection the line stops here and it continues left, it will actually decide to move right, find that the line is stopping here, turn back and continue left. And for this intersection if the line is stopping here, we just move forward, if there is a line to the right, we move right.
So our first priority is to check for lines on the right. Let's right this down, the 1st priority is right.
Our second priority if there is no line to the right,
but there is only a line to the left, then we move to the left.
That's our second priority, but if there is no line to the left and to the right, we check if there is a line that we can follow and if there is a line that we can follow we just follow it.
If we are in this situation here, there is no line to the left, right or continuing, it's a gap and this is our fourth priority.
And we have the states for our program. So we need a sensor that detects right lines, we need a sensor for left lines and one for the central line. So we need 3 sensors for our robot. In the construction, this one here, we have 3 sensors.
I''ll disassemble it, you can find the instructions for building these 3 sensors below the video. They look like this.
Just a construction of 3 light or color sensors that have some gaps between them and we'll use it, adding it as an attachment to the robot and with them we'll follow the line. This will be our middle sensor, this sensor will detect the left lines, this one will detect the right lines. We'll try to solve this mission with only 3 sensors. Theoretically is possible to solve it with 2 sensors, but it will be much trickier, so let's keep it with 3 sensors. In the next video we'll start with following the line, detecting the gap and deciding what to do if there is a gap.
Lessons with this tutorial
This tutorial is used in the following lessons