Gyro Sensor#

Introduction#

The VEX IQ (1st gen) Gyro Sensor measures rotational movement around a single axis. It is used to track changes in heading as a robot turns.

Below is a list of all blocks:

calibrate gyro#

The calibrate gyro block calibrates a Gyro Sensor. All subsequent blocks will wait for the calibration to complete before executing. Calibration is an internal procedure that measures and compensates for sensor noise and drift over a specified period. During this time, the Gyro Sensor must remain completely still (i.e., on a stable surface without any external movement). Movement during calibration will produce inaccurate results.

Note: This block is only available if there is a configured Gyro Sensor outside of a drivetrain.

calibrar [Gyro 1 v] durante [2 v] segundo

Parameters

Description

gyro

The Gyro Sensor to calibrate.

duration

How long to calibrate the sensor for in seconds:

  • 2
  • 4
  • 8

Example

cuando empezó
[Calibrate a Gyro Sensor and display its angle of heading.]
calibrar [Gyro 1 v] durante [2 v] segundo
imprimir ([Gyro 1 v] rumbo en grados) en [Brain v] ◀ y coloque el cursor en la siguiente fila

set Gyro heading#

The set Gyro heading block sets the Gyro Sensor’s heading to a specified value.

Establecer el rumbo [Gyro 1 v] a (0) grado

Parameters

Description

gyro

The Gyro Sensor to set the heading of.

heading

The value to use for the new heading in the range 0 to 359.99 degrees.

Example

cuando empezó
[Turn to the new 0 degrees heading.]
Establecer el rumbo [Gyro 1 v] a (90) grado
girar hacia el rumbo (0) grados ▶

set Gyro rotation#

The set Gyro rotation block sets the Gyro Sensor’s heading to a specified value.

Establezca la rotación [Gyro 1 v] a (0) grado

Parameters

Description

gyro

The Gyro Sensor to set the rotation of.

rotation

The value to use for the new rotation as a decimal number or integer.

Example

cuando empezó
[Turn to the new 0 rotation.]
Establezca la rotación [Gyro 1 v] a (-100) grado
girar a rotación (0) grados ▶

angle of Gyro heading#

The angle of Gyro heading block returns the Gyro Sensor’s heading angle as a decimal number, in the range 0 to 359.99 degrees.

([Gyro 1 v] rumbo en grados)

Parameters

Description

gyro

The Gyro Sensor to return the heading from.

Example

cuando empezó
[Display the Gyro Sensor's heading before and after rotating.]
imprimir ([Gyro 1 v] rumbo en grados) en [Brain v] ◀ y coloque el cursor en la siguiente fila
girar [derecha v] por (390) grado ▶
imprimir ([Gyro 1 v] rumbo en grados) en [Brain v] ◀ y coloque el cursor en la siguiente fila

angle of Gyro rotation#

The angle of Gyro rotation block returns how much the Gyro Sensor has turned since it started, in degrees as a decimal number: positive for clockwise, negative for counterclockwise.

([Gyro 1 v] rotación en grados)

Parameters

Description

gyro

The Gyro Sensor to return the rotation from.

Example

cuando empezó
[Display the Gyro Sensor's angle of rotation before and after rotating.]
imprimir ([Gyro 1 v] rotación en grados) en [Brain v] ◀ y coloque el cursor en la siguiente fila
girar [derecha v] por (390) grado ▶
imprimir ([Gyro 1 v] rotación en grados) en [Brain v] ◀ y coloque el cursor en la siguiente fila

rate of gyro#

The rate of gyro block returns the Gyro Sensor’s current rotation speed in dps.

([Gyro 1 v] tasa de dps)

Parameters

Description

gyro

The Gyro Sensor to return the rotation speed from.

Example

cuando empezó
[Display the Gyro Sensor's current rotation speed.]
turno [derecha v]
esperar (1) segundos
imprimir ([Gyro 1 v] tasa de dps) en [Brain v] ◀ y coloque el cursor en la siguiente fila