Anonymous

Difference between revisions of "Line follower algorithm"

From cod3v
 
(4 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 goes 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.
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 ===
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 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.
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 it turns to left or right. However, it 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.
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 39: Line 43:


Back to [[Mahtavaa Matematiikkaa 2020]]
Back to [[Mahtavaa Matematiikkaa 2020]]
</translate>


[[File:Mahtavaa matematiikkaa.png|thumb]]
[[File:Mahtavaa matematiikkaa.png|thumb]]