В момента ресурсът е наличен само на английски

How to align LEGO Mindstorms robots to a black line (EV3 version) Pro Preview

In this tutorial we present a way to align your robot to a black line. Go through common difficulties, that the teams face, when they need to align their robot, and provide a solution for them.

  • #53
  • 15 Jan 2014
  • 7:58

Preparing for the FIRST LEGO League Competition, it is essential to know how to align your robot to a black line. In this tutorial we provide an algorithm to do so with two light or color sensors and also explain some problems you may face during reaching this solution.

In the tutorial we use a NXT Color Sensor and a EV3 Color Sensor. The same can be achieved with NXT Light Sensor and of course with two EV3 Color Sensor. For further review on the three sensors please take a look at Episode 48.

Program for aligning to a black line with a LEGO Mindstorms EV3 robot

EV3-G program. Before running the program check whether the ports on which you have connected the sensors and the motors are the same as in the program

English

As we have said in previous tutorials - the main problem during the first LEGO competition is: "How to position your robot precisely on the field?" We showed in episode #41 and #42 that is virtually impossible to do so without using sensors. In this tutorial I will provide you one more way to orientate your robot on the field. In the next few minutes you will learn how to aline your robot perpendicular to a black line.

It is known that the line is defined by two points. That's why if we just use one sensor to determine a black line, you will need to make several maneiras and this will be inaccurate and time consuming. And so useless on a competition where time matters. That's why we will use two colour sensors to align on the black line. We have received e-mails from users that they do not possess two EV3 color sensors. That's why during this tutorial we will use one EV3 color sensor and one NXT color sensor. Same can be achieved also using NXT white sense, for further information on that take a look at episode 48. Now let's see how to align that line. The first problem we faced when we want to align our robot to a black line is that we don't know which of the two sensors we will reach first the black line. So if we move like this the first sensor will be this one,the NXT color sensor and if we move like this the first sensor will be that one. That's why we will use pardo actions and I will move this motor until this sensor reaches the black line. And then stop the motor, and in pardo action I will move this motor until the EV3 color sensor reaches a black line and then stop this motor. That's how to achieve something like this.

Now let's see how it will look like when we program it. So, as I said we will need parallel actions and first I will move motor B until the robot detecs light.

So I'll go to Port View and first I'll move motor B when I put the robot on the black line we'll see that the value of the EV3 colour sensor is 6 and the value of the NXT coulour sensor is fifty-some. So, a good traceful value for the NXT color sensor will be 75.

And then I will stop motor B. I repeat the same thing in parlo but this time for motor C. And with the EV3 color sensor where traceful value will be on white space 60 so it will be 30 and then I will stop motor C. OK. So now let's run the program and see what are the results. So, first let's run the robot from here.And as you could see the robot is aligning to the black line. Now if I run the robot from here the result will be the same and so there's no difference in whether the NXT color sensor or the EV3 color sensor first sees the black line. But if I run it again from here you could see that when this motor stops while the other one is continuing moving there's change in the position of the NXT color sensor. By this at the end we have us light an accuracy of the position of the robot compared to the black line. In order to clear this inaccuracy I will make the robot move forward again with bolt motors and parallel actions. But this time I want them to stop when the sensors see white space. By this I will have made the robot to align to the border of the black line. So now let's see how this implemented in a program. OK. I won't continue the program here because If I do so when motor B stops it will right away continue running until it sees white space. That's why I will make this one into MyBlock and then make another MyBlock and put it afterwards. So in the MyBlock the program should be on one threat, so I will do it like this. Now select these six blocks and go to Tools -> MyBlock Builder I will name it AlignPartOne and finish. OK. So now I will open it and copy the content. Go back to Program and paste here the content. And this time I will switch the size so the robot will move forward until it sees value greater than 75 and greather than 30. Again I will select these blocks, go to Tools-> MyBlock Builder This will be AlignPartTwo, finish. OK. So now I'll put then on one thread and delete these threads.

Now I will open the tool blocks and return them in their original condition like this. And I'll do the same for AlignPartTwo. Ok now we have our alignment program ready. So I'll download it and see the result. So now I will run the robot again from here and as you could see it is aligning much more precisely compared to the previous run. So basically it is a good way to align your robot perpendicular to a black line. You could download the whole EV3 project we have created in this tutorial under the material tab below this video. Keep in mind that you could also increase the power of the motors and by this earn some time while aligning faster to the black line but also when you have power of 10 you could align to really small black lines for example the border of the base of the field and this could be sometimes useful.

Курсове и занятия включващи този Урок

Този Урок е използван в следните курсове и занятия.

Image for FIRST LEGO League Competition. Constructing and Programming a Robot Base
  • 42
  • 249:53
  • 10
Image for Simple following and aligning to lines and borders
  • 11
  • 5
  • 1
  • 3d_rotation 0
Image for FIRST LEGO League with LEGO Education SPIKE Prime. "Challenge" competition for 9-16 years old
  • 40
  • 127:22
  • 24
Image for FIRST LEGO League with LEGO Mindstorms Robot Inventor. "Challenge" competition for 9-16 years old
  • 43
  • 131:34
  • 21
Image for Align using two Color Sensors and a line
  • 3
  • 0
  • 1
  • 3d_rotation 1