Driving straight using gyroscope (Lego Dance): Difference between revisions
(→Theory) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Introduction == | == Introduction == | ||
We create a simple code with gyroscope to drive a straight line. Sometimes starting the gyroscope fails and it starts drifting. Fix it by unplugging and plugging the cable. | |||
== Theory == | == Theory == | ||
Line 5: | Line 7: | ||
The plan: | The plan: | ||
[[File:LineExample ManimCE v0.13.1.gif|thumb|The plan]] | [[File:LineExample ManimCE v0.13.1.gif|thumb|The plan]] | ||
Robot drives a straight line perpendicular to its starting position. If the robot for some reason goes to different direction, the gyroscope will fix the direction. However, the final position might be different. | |||
The code: | |||
[[File:DriveStraight.png|thumb|The code]] | |||
We use loop (orange) with gyroscope (yellow) block, math add block (red) and steering (green) block. This is called as a proportional control system, P-controller. | |||
<youtube>mKhBmhKoZSg</youtube> | <youtube>mKhBmhKoZSg</youtube> | ||
== Exercises == | == Exercises == | ||
#Drive a longer distance. | |||
#Add small obstacles, eg a mat or small LEGO building on the driveway to disturb the robot. | |||
#What is the meaning of ''b'' in math block? Try with different values. | |||
#Drive a square by creating similar Drive Straight code blocks one by one. Use gyro reset in between. | |||
== References == | == References == | ||
See the detailed instructions made by Robotiikka- ja tiedekasvatus ry [http://www.fllsuomi.org/wp-content/uploads/2021/11/Viivanseuranta-pahkinankuoressa.pdf here]. | |||
== The Instructors == | == The Instructors == |
Latest revision as of 12:36, 19 December 2021
Introduction
We create a simple code with gyroscope to drive a straight line. Sometimes starting the gyroscope fails and it starts drifting. Fix it by unplugging and plugging the cable.
Theory
The plan:

Robot drives a straight line perpendicular to its starting position. If the robot for some reason goes to different direction, the gyroscope will fix the direction. However, the final position might be different.
The code:

We use loop (orange) with gyroscope (yellow) block, math add block (red) and steering (green) block. This is called as a proportional control system, P-controller.
Exercises
- Drive a longer distance.
- Add small obstacles, eg a mat or small LEGO building on the driveway to disturb the robot.
- What is the meaning of b in math block? Try with different values.
- Drive a square by creating similar Drive Straight code blocks one by one. Use gyro reset in between.
References
See the detailed instructions made by Robotiikka- ja tiedekasvatus ry here.
The Instructors
The course is held in Finnish, though English guidance is possible. The instructors are Markku Leino and Zwenkka Pietilä.
This course is supported by Meet and Code. The course is made in collaboration with Robotiikka- ja tiedekasvatus ry.