Knowledge Base

Gyro Sensor

The EV3 Gyroscopic Sensor is typically used to measure rotational speed, but it can also calculate rotational change. When your robot turns around, the Gyro Sensor can measure the robot turn rate, in degrees per seconds. This rotational speed is measured at a rate of 1000 samples per second. Therefore, by multiplying the speed by the duration of the turn, the gyro can also tell how much it turned, in degrees.

This is incredibly useful when trying to make accurate turns to the degree, such as a 90 degree turn or a 180 degree turn.

When starting a program, the Gyro Sensor's starting position is 0 degrees It then adds (when turning counterclockwise) or subtracts (clockwise) the amount of degrees it turned.

Note that the faster you turn, the harder it is for the Gyro Sensor to keep up Therefore, accurate turns require either low speeds or some level of speed control.

There are two Gyro blocks, allowing for the use of three 3 methods:

  1. The Reset method is extremely useful whenever you want to repeat a turn, without accumulating the total degrees turned. For example: If you need the robot to turn 90 degrees 4 times.
  2. The getRateMode method returns the current turn rate in degrees per second. This is only useful for very advanced robotics applications.
  3. The getAngleMode method returns the accumulated angle of turn (in degrees) since the beginning of the program, or since the last Gyro Reset.

This sample code drives the robot along a square path. The Gyro helps the robot turn 90 degrees at each corner.

You can use the HUD to see just how accurate this program is at different power settings.

Of course, proportional control can help increase the accuracy of the program.


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.

Powered by Zendesk