The reason why you would want to watch this tutorial is because it demonstrates one of the most reliable ways to know where you are on the field and to accomplish missions successfully and this is aligning to a line. In the tutorial you will also see how a parallel program is developed and who parallel programs could be used in a meaningful way.
- #1939
- 20 Jul 2022
- 4:58
- LEGO Education SPIKE Prime
- Align, Scratch, LEGO Education SPIKE App Word Blocks 2, Programming, Light and Color Sensor
The process of aligning involves moving with both motors until any of them reaches a line and then only the other motor continues. Simple, right? Check out the tutorial to see the implementation and the program.
How to use this tutorial?
Download and experiment with the program. Start the robot and align to different lines. All kinds of lines. See if you are happy with the precision of the robot.
English
In this video tutorial we will look at one of the most important programs for FIRST LEGO League competitions and this is how to align to a line with two LEGO Education Spike Prime sensors.
Why is this important? It's important because it's one of the most reliable way to know where we are on the field and how the robot is positioned. And we can use the lines, we can follow the lines, but at a certain point we can even align to these lines. And how do we align? We move from the left and from the right, and when one of the sensors see the line, we move with the other model. Let's go into the programming. Here is the program for our robot. On the right you can see the recording of the robot. And these are the few simple blocks. That would allow us to align to the line with our LEGO Education Spike Prime robot. And again, let's start the program again and let's see how the program behaves. We move with both motors until the left sensor sees a black line, and because it sees a black line, we start moving with the right sensor, until the right sensor sees a black line. That is a simple, straightforward program where we have a very simple algorithm for aligning to the line. And in this way we know precisely how are we located on the field and how to approach the mission model and how to accomplish the mission model. Because once we know where we are, we can then accomplish it. Same thing from the other side. We start, we move forward, we see a black line and we stop. That's it. How does the robot behave and how is the program implemented? We have the following blocks. First, we have a block when the program starts, and when the program starts, we set the speed of motor A to 20%. Let me return back to video. Motor A is the left motor of our robot, motor A is the left motor. And what we do is we say move forward with motor A until sensor E, which is the left sensor, detects a black line and then stop the motor. That's it. Move forward until we see a black line. And you can see how right here it stops. In parallel, which is something interesting for this program. In parallel, we run the following program: Another set of blocks that again start when the program starts. So when we press the button, this other set of blocks will also start. And how would they behave? We start the program, we move with motor B, which is the right motor, and we wait until sensor F, which is the right sensor, detects a black color and then we stop the motor. So we start. And because both programs run in parallel, here is the moment where motor A stops, and only motor B continues until it detects a black line and then it stops. Now there could be an argument that now it is good to return the left side of the robot a little back. And we leave this to you as a decision. And we can also implement this in some of the next programs for aligning. But that's the simplest way to align. We have two sets of blocks in our Scratch program and they are executed in parallel. One is responsible for motor A, the other is responsible for motor B. That's it. That's the importance. And that's how the robot behaves. And it's important to know this, because we found out that during the years, that's probably the most reliable way to know where you are on the field. To align to the different lines that are available on the field. Download the program, experiment with your robot, try to align. And in some of the next tutorials we'll look at, how do we align but moving backward. See you in the next tutorial.
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons
LEGO Education SPIKE Prime Programming for competition with Word Blocks
Two concepts are important for robotics competitions - consistently navigate and position the robot exactly where we need it to be on the field, and builing attachments that would accomplish a mission once we have reached it. This course is focused on the first part. The second part is the whole FLLCasts platform, but start at FIRST LEGO League with LEGO Education SPIKE Prime. "Challenge" competition for 9-16 years old
The goal of this course is the help you learn to program LEGO Education SPIKE Prime robots to behave consistently and reliably during competitions. As a language we use LEGO Education SPIKE App Word Blocks which is based on Scratch. We look at a lot of concepts that could be used for FIRST LEGO League and World Robot Olympiad competitions - eg how to follow a line fast, slow, in a smooth way, with 5 states. Also how to align to lines, how to do double alignment, how to keep a straight line with motion sensor.
- 40
- 188:21
- 19
Forward align to a line with two sensors
The reason why you would want to watch this tutorial is because it demonstrates one of the most reliable ways to know where you are on the field and to accomplish missions successfully and this is aligning to a line. In the tutorial you will also see how a parallel program is developed and who parallel programs could be used in a meaningful way.
- 2
- 0
- 1
- 3d_rotation 1