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.
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons
FIRST LEGO League Competition. Constructing and Programming a Robot Base
This course if used by teams, mentors and students to structure the preparation for the Robotics Game of the FIRST LEGO League Robotics Competitions. One thing that is common each year at FLL is that experience matters a lot. Our goal with this course is to quickly bring new teams up to speed with experienced teams and to share some new tricks, patterns, constructions with the more experienced teams.
- 42
- 249:53
- 10
Simple following and aligning to lines and borders
Before looking at the way we do follow lines first we have to make sure the light/color sensors are covered. The next video is a classic NXT light sensor covering, but it also applies directly to EV3.
- 11
- 5
- 1
- 3d_rotation 0
FIRST LEGO League with LEGO Education SPIKE Prime. "Challenge" competition for 9-16 years old
This is the most detailed course we've ever built on how to prepare for a FIRST LEGO League robotics competition and we've specifically focused on the use of LEGO Education SPIKE Prime as a simple Box Robot. The course consists of 25 lessons suitable for both beginner and advanced students. We build on the knowledge of 10 years of sharing example solutions with explanations for FIRST LEGO League robotics competitions.
This course is one of the popular courses in the FIRST LEGO League Robot Game. The Complete Guide. We recommend you also check out the whole guide.
- 40
- 127:22
- 24
Align using two Color Sensors and a line
This tutorial demonstrates how a robot could align to a black line. The code for the program is available in the course. Aligning to black lines is popular at robotics competitions like FIRST LEGO League as it is the primary way to know where you are on the field and to develop a program that is reproducible. The attachment uses Luly, a small LEGO Education SPIKE Prime competition robot with 3D building instructions as a robot base.
- 2
- 0
- 1
- 3d_rotation 1
FIRST LEGO League with LEGO Mindstorms Robot Inventor. "Challenge" competition for 9-16 years old
The goal of this course is to take you through some of the most useful principles for building and using attachments to accomplish missions at FIRST LEGO League competitions. The whole course is based on a LEGO MINDSTORMS Robot Inventor and you need a single 51515 set and without additional parts (you will need a second color sensor for the lessons for using two color sensors, but feel free to skip them if you don't have it). For every mission there is a Scratch and Python program attachment. The course consists of 25 lessons suitable for beginner and advanced students. Every lessons consists of a video tutorial demonstrating the principle and how the mission could be accomplished along with building instructions for the robot, the attachment and programs for controlling the robot.
- 43
- 131:34
- 21
Align using two Color Sensors and a line
This animation demonstrates the principle of aligning to a line with two color sensors and a LEGO Mindstorms Robot Inventor robot. This is a useful concept for FIRST LEGO League competitions where you want to know exactly where you are on the field and to achieve consistent behavior. In the course lesson you will also find a live video tutorial where we enter into more details about aligning. We align the robot to a line by moving both sensors slowly until they both see a black line. When one of them sees the line we move only the other. At the end we return the first sensor back.
- 3
- 0
- 1
- 3d_rotation 1