Inertial and Gyro Sensor#
介绍#
The VEX IQ (2nd gen) Brain features a built-in Inertial Sensor that includes a 3-axis gyroscope for measuring rotational movement and a 3-axis accelerometer for detecting changes in motion. This sensor is automatically configured and ready to use at the start of every project. For additional sensing options, an external Gyro Sensor is also available, but it must be configured before use. The Inertial Sensor can track orientation, heading, and acceleration, while the Gyro Sensor measures rotational movement only.
Below is a list of all blocks:
Gyro Sensing — Work with heading and rotation tracking.
calibrate gyro — Calibrates an external Gyro Sensor for stable heading tracking.
calibrate BrainInertial — Calibrates the brain’s built-in Inertial Sensor for stable heading tracking.
set Inertial/Gyro heading — Sets the sensor’s heading to a specified value.
set Inertial/Gyro rotation — Sets the sensor’s rotation value.
angle of Inertial/Gyro heading — Returns the sensor’s current heading.
angle of Inertial/Gyro rotation — Returns the sensor’s cumulative rotation.
rate of gyro — Returns the angular velocity.
Inertial Sensing — Use the accelerometer in the Inertial Sensor.
acceleration — Returns linear acceleration along the x, y, or z axis.
gyro rate — Returns angular velocity around the x, y, or z axis.
orientation — Returns roll, pitch, or yaw based on tilt and rotation.
陀螺仪感应#
校准陀螺仪#
校准陀螺仪 模块用于校准陀螺仪传感器。所有后续模块都将等待校准完成后再执行。校准是一个内部过程,用于测量并补偿指定时间段内的传感器噪声和漂移。在此期间,陀螺仪传感器必须保持完全静止(即,放置在稳定的表面上,且不受任何外部运动的影响)。校准期间的移动会导致结果不准确。
Note: This block is only available if there is a configured Gyro Sensor.
[Gyro 1 v] 校准 [2 v] 秒
参数 |
描述 |
|---|---|
陀螺仪 |
The Gyro Sensor to calibrate. |
期间 |
传感器校准所需时间(秒):
|
例子
当开始
[Calibrate a Gyro Sensor and display its angle of heading.]
[Gyro 1 v] 校准 [2 v] 秒
在 [Brain v] 上打印 ([Gyro 1 v] 归位角度值) ◀ 并设定光标为下一行
校准 BrainInertial#
The calibrate BrainInertial block calibrates the brain’s built-in Inertial 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 brain must remain completely still (i.e., on a stable surface without any external movement). Movement during calibration will produce inaccurate results.
VEX 机器人会在每次项目开始时尝试自动校准。但是,如果在项目启动期间搬运或移动机器人,传感器可能无法正确校准或产生错误的校准结果。
校准BrainInertial
参数 |
描述 |
|---|---|
该块没有参数。 |
例子
当开始
[Calibrate the Brain's sensor and display its angle of heading.]
校准BrainInertial
在 [Brain v] 上打印 ([BrainInertial v] 归位角度值) ◀ 并设定光标为下一行
set Inertial/Gyro heading#
The set Inertial/Gyro heading block sets the Gyro Sensor’s heading to a specified value.
设定 [Gyro 1 v] 归位为 (0) 度
参数 |
描述 |
|---|---|
陀螺仪 |
The Inertial or Gyro Sensor to set the heading of. |
标题 |
新航向使用的值在 0 至 359.99 度范围内。 |
例子
当开始
[Turn to the new 0 degrees heading.]
设定 [Gyro 1 v] 归位为 (90) 度
归位至 (0) 度 ▶
set Inertial/Gyro rotation#
The set Inertial/Gyro rotation block sets the Gyro Sensor’s heading to a specified value.
设定 [Gyro 1 v] 转向为 (0) 度
参数 |
描述 |
|---|---|
陀螺仪 |
The Inertial or Gyro Sensor to set the rotation of. |
旋转 |
The value to use for the new rotation as a decimal number or integer. |
例子
当开始
[Turn to the new 0 rotation.]
设定 [Gyro 1 v] 转向为 (-100) 度
转向至 (0) 度 ▶
angle of Inertial/Gyro heading#
The angle of Inertial/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] 归位角度值)
参数 |
描述 |
|---|---|
陀螺仪 |
The Inertial or Gyro Sensor to return the heading from. |
例子
当开始
[Display the Gyro Sensor's heading before and after rotating.]
在 [Brain v] 上打印 ([Gyro 1 v] 归位角度值) ◀ 并设定光标为下一行
[右 v] 转 (390) 度 ▶
在 [Brain v] 上打印 ([Gyro 1 v] 归位角度值) ◀ 并设定光标为下一行
angle of Inertial/Gyro rotation#
The angle of Inertial/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] 转向角度值)
参数 |
描述 |
|---|---|
陀螺仪 |
The Inertial or Gyro Sensor to return the rotation from. |
例子
当开始
[Display the Gyro Sensor's angle of rotation before and after rotating.]
在 [Brain v] 上打印 ([Gyro 1 v] 转向角度值) ◀ 并设定光标为下一行
[右 v] 转 (390) 度 ▶
在 [Brain v] 上打印 ([Gyro 1 v] 转向角度值) ◀ 并设定光标为下一行
陀螺仪速率#
陀螺仪速率 块返回陀螺仪传感器的当前旋转速度(以 dps 为单位)。
([Gyro 1 v] 角速度\(dps\))
参数 |
描述 |
|---|---|
陀螺仪 |
The Gyro Sensor to return the rotation speed from. |
例子
当开始
[Display the Gyro Sensor's current rotation speed.]
[右 v] 转
等待 (1) 秒
在 [Brain v] 上打印 ([Gyro 1 v] 角速度\(dps\)) ◀ 并设定光标为下一行
惯性传感#
加速度#
The acceleration block returns the brain’s acceleration along the specified axis (forward, rightward, or downward) in units of g, ranging from -4.00 to 4.00.
(BrainInertial [X v] 轴加速度值\(g\))
参数 |
描述 |
|---|---|
轴 |
返回加速度的轴:
|
例子
当开始
[Display the acceleration along the x-axis while the drivetrain is moving.]
将打印精度设置为 [0.01 v] 到 [Brain v]
设定驱动速度为 (100)%
在 [Brain v] 上打印 [Resting: ] ◀ 并设定光标为下一行
在 [Brain v] 上打印 (BrainInertial [X v] 轴加速度值\(g\)) ◀ 并设定光标为下一行
等待 (1) 秒
驱动 [向前 v] (500) [毫米 v] ◀ 并且不等待
等待 (0.1) 秒
在 [Brain v] 上打印 [Startup : ] ◀ 并设定光标为下一行
在 [Brain v] 上打印 (BrainInertial [X v] 轴加速度值\(g\)) ◀ 并设定光标为下一行
陀螺仪速率#
The gyro rate block returns the brain’s current rotation speed in dps as a decimal number.
(BrainInertial [X v] 轴陀螺仪角速度\(dps\))
参数 |
描述 |
|---|---|
轴 |
返回旋转速度的轴:
|
例子
当开始
[Display the gyro rate around the z-axis while the drivetrain is turning.]
[右 v] 转
等待 (1) 秒
在 [Brain v] 上打印 (BrainInertial [z v] 轴陀螺仪角速度\(dps\)) ◀ 并设定光标为下一行
方向#
The orientation block returns the brain’s roll, pitch, or yaw, in the range of -180.00 to 180.00 degrees as a decimal number.
(BrainInertial [横滚 v] 偏转角度值)
参数 |
描述 |
|---|---|
轴 |
方向轴:
|
例子
当开始
[Display the roll, pitch, and yaw of the Brain as it is rotated by hand.]
永久循环
清除 [Brain v] 所有行
在 [Brain v] 上打印 (BrainInertial [横滚 v] 偏转角度值) ◀ 并设定光标为下一行
在 [Brain v] 上打印 (BrainInertial [俯仰 v] 偏转角度值) ◀ 并设定光标为下一行
在 [Brain v] 上打印 (BrainInertial [偏转 v] 偏转角度值) ◀ 并设定光标为下一行
在 [Brain v] 设定光标至 (1) 行 (1) 列
等待 (0.05) 秒
结束


