How to use gyroscope: Difference between revisions
(Marked this version for translation) |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<languages/> | |||
<translate> | |||
=== Introduction === <!--T:1--> | |||
<!--T:2--> | |||
The gyroscope is very powerful tool in navigation. The gyroscope is similar to a compass, and it gives the angle with respect to robot orientation at the reset. The gyroscope can be used to steer the correct amount, or to drive straight at given angle. These gyroscope algorithms are proportional, but it is easy to implement with e.g. the PID algorihm, too. | |||
<!--T:3--> | |||
The gyroscope driving functions should be done as MyBlock so that they are easy to use at your own codes. | The gyroscope driving functions should be done as MyBlock so that they are easy to use at your own codes. | ||
We show two different methods, (i) drives straights, and (ii) | <!--T:4--> | ||
We show two different methods, (i) the robot drives straights, and (ii) the robot steers to a given angle. | |||
=== Robot === | === Robot === <!--T:5--> | ||
<!--T:6--> | |||
Almost any robot will do, though these examples are done by using Verne/ Asimov 2. | Almost any robot will do, though these examples are done by using Verne/ Asimov 2. | ||
=== Sensors === | === Sensors === <!--T:7--> | ||
<!--T:8--> | |||
The gyroscope sensor is used. | The gyroscope sensor is used. | ||
=== Example Videos === | === Example Videos === <!--T:9--> | ||
<!--T:10--> | |||
The two different methods are shown. | The two different methods are shown. | ||
<!--T:11--> | |||
<youtube>lkucnBnS16Q</youtube> | |||
<!--T:12--> | |||
<youtube>g3d5Kh0aT14</youtube> | |||
=== Theory === | === Theory === <!--T:13--> | ||
<!--T:14--> | |||
The limitations of gyroscope sensor should be known. E.g. the magnetic field affects the sensor values. Also, the sensor should be exactly still while starting the sensor. Otherwise, it might start drifting. If the sensor starts drifting, the easiest method to make it work properly is to unplug and plug the sensor again. Usually it works on the first replugging. | The limitations of gyroscope sensor should be known. E.g. the magnetic field affects the sensor values. Also, the sensor should be exactly still while starting the sensor. Otherwise, it might start drifting. If the sensor starts drifting, the easiest method to make it work properly is to unplug and plug the sensor again. Usually it works on the first replugging. | ||
=== Example Code === | === Example Code === <!--T:15--> | ||
<!--T:16--> | |||
The first example code explains the resetting, and how to use proportional algorithm to drive straight. The second code employs the proportional algorithm to follow a given compass direction. | The first example code explains the resetting, and how to use proportional algorithm to drive straight. The second code employs the proportional algorithm to follow a given compass direction. | ||
<!--T:17--> | |||
[[File:Gyro0degrees.png|thumb|The gyro drives to 0 degrees.]] | [[File:Gyro0degrees.png|thumb|The gyro drives to 0 degrees.]] | ||
<!--T:18--> | |||
[[File:GyroAngle.png|thumb|The MyBlock version of gyro program to drive the given angle.]] | [[File:GyroAngle.png|thumb|The MyBlock version of gyro program to drive the given angle.]] | ||
=== Exercises === | === Exercises === <!--T:19--> | ||
* Make the robot to turn the shorter distance. | <!--T:20--> | ||
* Make the robot to turn the longer distance. | * Make the robot to always turn the shorter distance. | ||
* Make the robot to always turn the longer distance. | |||
* Use the Modulo operator to fix the number of turns the robot makes during the drive. | * Use the Modulo operator to fix the number of turns the robot makes during the drive. | ||
* Make a MyBlock that drives, and turns the robot as LEGOs steering block, but while using the gyro sensor. | * Make a MyBlock that drives, and turns the robot as LEGOs steering block, but while using the gyro sensor. | ||
Line 43: | Line 62: | ||
<!--T:21--> | |||
This course is supported by [https://meet-and-code.org/ Meet and Code]. The course is made in collaboration with [http://www.fllsuomi.org/ Robotiikka- ja tiedekasvatus ry]. | This course is supported by [https://meet-and-code.org/ Meet and Code]. The course is made in collaboration with [http://www.fllsuomi.org/ Robotiikka- ja tiedekasvatus ry]. | ||
[[File:MeetAndcodeLogo.png|thumb]] | [[File:MeetAndcodeLogo.png|thumb]] | ||
<!--T:22--> | |||
Back to [[Meet_and_Code_2020_I:_Ev3-G]] | |||
</translate> |
Latest revision as of 20:34, 15 September 2020
<languages/> <translate>
Introduction
The gyroscope is very powerful tool in navigation. The gyroscope is similar to a compass, and it gives the angle with respect to robot orientation at the reset. The gyroscope can be used to steer the correct amount, or to drive straight at given angle. These gyroscope algorithms are proportional, but it is easy to implement with e.g. the PID algorihm, too.
The gyroscope driving functions should be done as MyBlock so that they are easy to use at your own codes.
We show two different methods, (i) the robot drives straights, and (ii) the robot steers to a given angle.
Robot
Almost any robot will do, though these examples are done by using Verne/ Asimov 2.
Sensors
The gyroscope sensor is used.
Example Videos
The two different methods are shown.
Theory
The limitations of gyroscope sensor should be known. E.g. the magnetic field affects the sensor values. Also, the sensor should be exactly still while starting the sensor. Otherwise, it might start drifting. If the sensor starts drifting, the easiest method to make it work properly is to unplug and plug the sensor again. Usually it works on the first replugging.
Example Code
The first example code explains the resetting, and how to use proportional algorithm to drive straight. The second code employs the proportional algorithm to follow a given compass direction.


Exercises
- Make the robot to always turn the shorter distance.
- Make the robot to always turn the longer distance.
- Use the Modulo operator to fix the number of turns the robot makes during the drive.
- Make a MyBlock that drives, and turns the robot as LEGOs steering block, but while using the gyro sensor.
This course is supported by Meet and Code. The course is made in collaboration with Robotiikka- ja tiedekasvatus ry.

Back to Meet_and_Code_2020_I:_Ev3-G
</translate>