Counting lines and stopping on the third is the subject of this video. It is important to know how to do this in order to conduct more than one experiment in STEM classes (if we consider that each line is an experiment)
- #148
- 23 Oct 2015
- 6:57
First detect a line. Stop at it. Then try to move and detect a second line. This seems quite straighforward, but is quite un-intuitive, yet again logical. Many times this should be implement in FIRST LEGO League (FLL) or World Robotics Olympiad (WRO) competitions or just in different STEM classes.
English
The next program will be how do we build a program that stops the robot on the third black line. I'll add 2 more lines here and we want to stop on the third line.
Let's add the 3 lines. The second line will be right here
and the third line will be right here.
Now, what you might think is that it's quite straight forward just move stop at this line, then move stop at this, then move stop at this. As you might remember from the touch sensor some of the programs although very not intuitive are kind of logical so the solution for this will be not intuitive but logical, again. Let's start with the first try to build such a program. In the program we move forward, we wait for a black line, then we stop. This here moves the robot to the first line, then we can again move forward,
follow the same principle, move forward,
then wait for the color sensor to detect black
and then stop again.
Take the Tank block and make it stop.
Download.
This here is the program. I'll start it.
As you can see the robot stops at the first line and based on our program we would expect the robot to move forward detects the line, stop, then move forward again, detect the line, stop again. It only stops on the first line. Let's start the program again.
What happens here is the same that happened with our touch sensor a few videos ago and it is the way the robotic sensors work, basically on every robotic system.
The problem is that when the robot moves, it detects a black line, then it stops again and then it starts moving again until it detects a black line, the sensor is already above a black line, so it's already detecting a black line and what happens is that it moves, stops, tries to move again, but it is already over a black line, so it detects the black line instantly after a millisecond or so, and it stops. So it's actually detecting this line twice, that's why the program is not behaving as we would expect. How do we solve this? The first solution is to add a small Wait block. Let's try it. If we now add a small Wait block, just after we detect the first line. We can edit it several times. Let's do it even simpler. So, we move forward, detect a line, stop, then let's move forward with motor A and D, wait for about a second or half a second
and only after this half a second has passed we would start searching for the next line, the third line. This will give the robot a chance to move away from the black line,
before trying to detect the second black line, we are stopping, moving again, waiting for half a second, so that we are no longer over a black line and then trying to detect the second black line. The program is now running.
Let's run the program again.
Why is this happening, because we are moving, we are reaching the black line and after we reached the black line, we stop, then we start moving again for about half a second and in this half a second we actually move to here, so it's after the second line and then we start looking for a black line and then we detect the third. The question is how much should we wait after we are on the first line and after we move forward. It should not be half a second, let's try with a 10th of a second, something smaller. I have changed the value in the wait block in the program for 10th of a second. I'll now run the program and as you can see the robot stops on the second line. Again.
This is for this video in the next video we'll try to remove this wait block, because although it is working it is not a good practice to have such wait blocks in the program and it's kind of a hack so it's not a real solution.
Курсове и занятия включващи този Урок
Този Урок е използван в следните курсове и занятия.
EV3 Basic Course. Introduction to robot programming, construction and sensor use
This course is designed for students, mentors and teachers that are completely new to LEGO Mindstorms EV3 robots and would like to start using them to learn, in classes or at competitions. It is quite different from previously built resources at FLLCasts because it makes no assumption on any previous knowledge and tries to introduce everything step-by-step.
- 38
- 193:26
- 30
Color Sensor
Very simple and basic introduction to the color sensor in the LEGO Mindstorms EV3 set. The first program is to stop at a line. Then we can move from stoping at line to counting lines and even more complex tasks.
- 8
- 0
- 3
- 3d_rotation 0
Instructors Remote Training
If you are working with students and you want to introduce Robotics to your class or you want to mentor a FLL team, but you are insecure about your technical knowledge in the Robotics field, then this is the right place for you. Having in mind teachers' busy schedule, we have design two different schedules and added an option to design one just for you. FLLCasts's Mindstorms EV3 Robotics Online Training is the perfect match for any teacher.
After the completion of each task the participant has to upload his solution for verification.
- 136
- 280:11
- 156
Color Sensor Theory and Practice
Very simple and basic introduction to the color sensor in the LEGO Mindstorms EV3 set. The first program is to stop at a line. Then we can move from stoping at line to counting lines and even more complex tasks.
- 5
- 0
- 0
- 3d_rotation 0
Instructors Remote Training
If you are working with students and you want to introduce Robotics to your class or you want to mentor a FLL team, but you are insecure about your technical knowledge in the Robotics field, then this is the right place for you. Having in mind teachers' busy schedule, we have design two different schedules and added an option to design one just for you. FLLCasts's Mindstorms EV3 Robotics Online Training is the perfect match for any teacher.
After the completion of each task the participant has to upload his solution for verification.
- 136
- 280:11
- 156
Color Sensor
Какво е цветът?
Ако ви попитам какъв е цветът на топката на картинката отдолу, ще ми отговорите червен.
Всеки знае какво имаме предвид, когато си говорим за цвят, но какво всъщност е цветът? Това е едно от най-естествените понятия, чиито значение и произход хората често не осъзнават.
- 9
- 0
- 4
- 3d_rotation 0