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.

[Gyro 1 v] 校准 [2 v] 秒

Parameters

Description

gyro

The Gyro Sensor to calibrate.

duration

How long to calibrate the sensor for in seconds:

  • 2
  • 4
  • 8

Example

当开始
[Calibrate a Gyro Sensor and display its angle of heading.]
[Gyro 1 v] 校准 [2 v] 秒
在 [Brain v] 上打印 ([Gyro 1 v] 归位角度值) ◀ 并设定光标为下一行

set Gyro heading#

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

设定 [Gyro 1 v] 归位为 (0) 度

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

当开始
[Turn to the new 0 degrees heading.]
设定 [Gyro 1 v] 归位为 (90) 度
归位至 (0) 度 ▶

set Gyro rotation#

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

设定 [Gyro 1 v] 转向为 (0) 度

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

当开始
[Turn to the new 0 rotation.]
设定 [Gyro 1 v] 转向为 (-100) 度
转向至 (0) 度 ▶

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] 归位角度值)

Parameters

Description

gyro

The Gyro Sensor to return the heading from.

Example

当开始
[Display the Gyro Sensor's heading before and after rotating.]
在 [Brain v] 上打印 ([Gyro 1 v] 归位角度值) ◀ 并设定光标为下一行
[右 v] 转 (390) 度 ▶
在 [Brain v] 上打印 ([Gyro 1 v] 归位角度值) ◀ 并设定光标为下一行

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] 转向角度值)

Parameters

Description

gyro

The Gyro Sensor to return the rotation from.

Example

当开始
[Display the Gyro Sensor's angle of rotation before and after rotating.]
在 [Brain v] 上打印 ([Gyro 1 v] 转向角度值) ◀ 并设定光标为下一行
[右 v] 转 (390) 度 ▶
在 [Brain v] 上打印 ([Gyro 1 v] 转向角度值) ◀ 并设定光标为下一行

rate of gyro#

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

([Gyro 1 v] 角速度\(dps\))

Parameters

Description

gyro

The Gyro Sensor to return the rotation speed from.

Example

当开始
[Display the Gyro Sensor's current rotation speed.]
[右 v] 转
等待 (1) 秒
在 [Brain v] 上打印 ([Gyro 1 v] 角速度\(dps\)) ◀ 并设定光标为下一行