This second part continues with importing two previously developed in Episode 53 blocks into our program. With them we can for align to lines. We program the robot to align to the cross line and start following it.
- 05 Nov 2015
Buiding instructions for this robot are available at:
Previously we did a program that was following a line and it was trying to stop on the intersection but we only got this far.
The robot follows and turns and then moves. Now we should also search for the second line, find it and align to it.
This here is the program. As a last step in our program we would like to add the align to line and we have this on the FLL Casts site. If I just open and search for a playlist and we have the playlist and there is one for following and aligning to line and in this playlist we have a few programs. There is a video for how to align Lego Mindstorms robots to a black line. It is for the EV3 version, it is something that we can find useful. In the materials section we have the program. Download the program, save it and I can then open this program from the software. open episode 53 and this here are the blocks for aligning to a line. We have the program in 3 parts. We have AlignPartOne, AlignPartTwo, and common block aligned to black line that's called AlignedPartOne, AlignedPartTwo. There are some explanations, you can go the explanations, read them. Now we must modify this program for our case, for our robot as with most of the programs you must modify them, you must configure them. In our case we would like to use these blocks in our program.
How do we import the blocks from episode 53 to our program. First, we go to the episode 53 program, we select the project properties and these are the different properties of the project and we have 2 blocks. I'll select both of the blocks and I'll click export. I would like to export the block as block EV3s and it's located on my desktop.
Then I can go to the program, click on project properties, click on my blocks but then import and I'll import the blocks from EV3s. I have now the 3 blocks in my project and I can use these blocks. How can I use them? They are located here in the my block section. First, is AlignPartOne
and AlignPartTwo. This will align the robot to the line. We can enter these blocks and now we must configure them. We must change the motors and the sensors. First, our right motor (motor A) and our right sensor (sensor 1). Then our left motor (motor D) and our left sensor (sensor 4). When we detect black, we would like to detect something less than 50 for my current situation in this room. Less than 50. This will be part 1 of the align and I'll just reduce the power to let's say 30. So that you can see it better on the camera, 30. This was part 1 I'll save it.
Then we must open part 2 of the align process and we do the same modifications.
We can add different parameters but we are doing it in a very simple way. Motor A, motor A, sensor 1. Motor D, motor D, sensor 4. When we are detecting something white we must detect something that's larger than let's say 60 or even 55. In my current case in this room, 55.
Again, we do this with the power of -20 and here it's again -20. So this is the process of aligning to a line. Let's see how it works.
Robot move, follows the line and then aligns to the second line. That's a very easy and fast way to move to the second line, align to it, know where your position is then you can even turn around back to this line and then you can continue forward, following this line or doing a mission. I hope you like the video for detecting the intersection. There are other more complex ways but I believe that this will do the job for most of the time.