Line follower algorithm: Difference between revisions
(→Robot) |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<languages /> | |||
<translate> | |||
== Introduction == | == Introduction == | ||
The easiest line follower algorithm is Zig Zag algorithm, which | The easiest line follower algorithm is the Zig Zag algorithm, which makes the robot move like zig zag and never straight. However, it is funny to observe the movements of the robot, and test the meaning of the different parameters. | ||
=== Aim === | === Aim === | ||
If block (programming). Color. | If block and loop block (programming). Color. | ||
== Robot == | == Robot == | ||
Line 13: | Line 17: | ||
=== Sensors === | === Sensors === | ||
The color sensor is used to read the color. | The color sensor is used to read the color of line and surroundings. | ||
== Example Video == | == Example Video == | ||
Line 21: | Line 25: | ||
== Theory == | == Theory == | ||
''Zig zag'' algorithm turns to right if sees white, and to left if the sensor is on the black. Or vice versa. The algorithm is easy to program using only one if block. The speed and turning value need to be considered and adjusted. | The ''Zig zag'' algorithm turns the robot to right if the sensor sees white, and to left if the sensor is on the black. Or vice versa. The algorithm is easy to program using only one if block and loop block. The speed and turning value need to be considered and adjusted. | ||
[[File:Zigzag.png|thumb|''The Zig Zag'' algorithm.]] | [[File:Zigzag.png|thumb|''The Zig Zag'' algorithm.]] | ||
Line 27: | Line 31: | ||
== Example Code == | == Example Code == | ||
Zig Zag never drives straight. Either | The ''Zig Zag'' never drives the robot straight. Either the robot turns to the left or to the right. However, the robot can be made very fast, and reliable---of course depending on the line. The turning part is coded into ''if else'' block which is in the loop that continuously examines the line. | ||
== Exercises == | == Exercises == | ||
Line 42: | Line 43: | ||
Back to [[Mahtavaa Matematiikkaa 2020]] | Back to [[Mahtavaa Matematiikkaa 2020]] | ||
</translate> | |||
[[File:Mahtavaa matematiikkaa.png|thumb]] | [[File:Mahtavaa matematiikkaa.png|thumb]] |
Latest revision as of 19:49, 25 October 2020
<languages />
<translate>
Introduction
The easiest line follower algorithm is the Zig Zag algorithm, which makes the robot move like zig zag and never straight. However, it is funny to observe the movements of the robot, and test the meaning of the different parameters.
Aim
If block and loop block (programming). Color.
Robot
Almost any robot will do, but this example is done using Asimov 2/ Verne.
Sensors
The color sensor is used to read the color of line and surroundings.
Example Video
Theory
The Zig zag algorithm turns the robot to right if the sensor sees white, and to left if the sensor is on the black. Or vice versa. The algorithm is easy to program using only one if block and loop block. The speed and turning value need to be considered and adjusted.
Example Code
The Zig Zag never drives the robot straight. Either the robot turns to the left or to the right. However, the robot can be made very fast, and reliable---of course depending on the line. The turning part is coded into if else block which is in the loop that continuously examines the line.
Exercises
- Use the other side of the line to follow the line
- Make the robot to change the side of the line during the line following: Thus, after following the line e.g. 2 wheel rotations, use the other side of the line
- Make a robot with two color sensors, and use the information from the other sensor to stop the robot when the other sensor recognizes black line.
- Make a robot with two color sensors, and make the robot to follow a line that is in between the two sensors.
- Make a robot with two color sensors, and make the robot to follow first the line with left sensor, then after two wheel rotations use the other sensor to follow the line to the end.
Back to Mahtavaa Matematiikkaa 2020
</translate>