惯性#

介绍#

The VEX AIM Coding Robot has a built-in Inertial Sensor. This sensor measures how the robot is moving and turning.

The Inertial Sensor uses two parts to do this. The gyroscope measures turning, such as the robot’s heading, rotation, turn rate, and orientation. The accelerometer measures changes in motion, such as speeding up, slowing down, or stopping suddenly during a crash.

The Inertial blocks can be used to track turns, measure acceleration, detect crashes, and reset heading or rotation values.

以下是所有模块的列表:

Values — Report orientation and movement data.

  • heading — Reports the direction the robot is facing, from 0 to 359.99 degrees.

  • rotation — Reports how far the robot has turned.

  • acceleration — Reports how quickly the robot is speeding up or slowing down on the selected axis.

  • get turn rate — Reports how fast the robot is rotating on the selected axis.

  • orientation — Reports the robot’s roll, pitch, or yaw angle.

Actions — Respond to crashes or reset turn values.

价值观#

标题#

A heading is the direction the robot is facing, measured in degrees from 0 to 359.99. The heading reporter block reports the robot’s current heading.

The starting heading is 0 degrees. If the robot turns past 359.99 degrees, the heading wraps back to 0 degrees.

标题报告器块。#
归位角度值

参数

描述

该块没有参数。

示例

当开始
[Turn right until the heading reaches 90 degrees.]
[右 v] 转
等待 [0.05] 秒
等到 <(归位角度值) [math_greater_than v] [90]>
停止移动

当开始
[Display the robot's heading as it is rotated by hand.]
永久循环
清除屏幕第 [1] 行
在屏幕上设定光标至 [1] 行 [1] 列
在屏幕上打印 (归位角度值)▶
等待 [0.05] 秒

旋转#

Rotation is how much the robot has turned, measured in degrees. Unlike heading, rotation can increase past 359.99 degrees or decrease below 0 degrees. At the beginning of a project, the rotation value is set to 0 degrees. The rotation reporter block reports the robot’s current rotation.

Turning right increases the rotation, and turning left decreases the rotation. For example, making two full turns to the right will report a rotation of 720 degrees. Turning one full turn to the left from 0 degrees will report a rotation of -360 degrees.

旋转报告块。#
(转向角度值)

参数

描述

该块没有参数。

例子

当开始
[Print the rotation value as the robot turns.]
[右 v] 转 [480] 度 ◀ 并且不等待
永久循环
清屏
在屏幕上设定光标至 [1] 行 [1] 列
在屏幕上打印 (转向角度值)▶

加速度#

Acceleration is how quickly the robot is speeding up or slowing down. The acceleration reporter block reports the robot’s acceleration along the selected axis, from -4.00 G to 4.00 G.

A G is a unit used to measure acceleration. 1 G is about the acceleration you feel from gravity while sitting still.

The value can be positive or negative depending on the direction of acceleration on the selected axis. On AIM, the axis options are named for directions on the robot: forward, rightward, and downward.

加速度报告器块。#
([向前 v] 轴加速度值\(g\) :: custom-controller-inertial-timer)

参数

描述

The axis to measure acceleration on:

  • forward
  • rightward
  • downward

VEX 传感器设备图示为三个带颜色标记的箭头,分别指示方向。红色箭头“向右”指向左侧斜上方,绿色箭头“向前”指向右侧斜上方,蓝色箭头“向下”指向中心正下方。

例子

当开始
[Show the change in acceleration as the robot begins to move.]
在屏幕上设定光标至 [4] 行 [1] 列
在屏幕上打印 (连接 [Resting: ] ([向右 v] 轴加速度值\(g\) :: custom-controller-inertial-timer))▶
在屏幕上设定光标至下一行
等待 [0.5] 秒
将 [右 v] 移至 [50] [毫米 v] ◀ 并且不等待
等待 [0.1] 秒
在屏幕上打印 (连接 [Startup: ] ([向右 v] 轴加速度值\(g\) :: custom-controller-inertial-timer))▶

获取转弯速率#

Turn rate is how fast the robot is rotating. The get turn rate reporter block reports the robot’s current rotation speed along the selected axis in degrees per second \(dps\), as an integer.

The value can be positive or negative depending on the direction the robot is rotating on that axis. The image below uses arrows to show the direction of positive rotation for roll, pitch, and yaw.

VEX 传感器设备图中显示了三个带颜色的箭头,分别指示其旋转轴。红色箭头“俯仰”(Pitch)指向左侧对角线上方,绿色箭头“滚动”(Roll)指向右侧对角线上方,蓝色箭头“偏航”(Yaw)从中心直接指向下方。

获取转弯率报告器块。#
([偏转 v] 轴角速度\(dps\))

参数

描述

The axis to report turn rate on:

  • roll
  • pitch
  • yaw

例子

当开始
[Observe the yaw turn rate as the robot turns.]
[右 v] 转 [180] 度 ◀ 并且不等待
永久循环
清屏
在屏幕上设定光标至 [1] 行 [1] 列
在屏幕上打印 ([偏转 v] 轴角速度\(dps\))▶

方向#

Orientation is the robot’s current angle on a selected turning axis. The orientation reporter block reports the robot’s roll, pitch, or yaw, from -180.00 to 180.00 degrees as a decimal number.

Roll, pitch, and yaw describe different ways the robot can tilt or turn. The image below uses arrows to show the direction of positive rotation for roll, pitch, and yaw.

VEX 传感器设备图中显示了三个带颜色的箭头,分别指示其旋转轴。红色箭头“俯仰”(Pitch)指向左侧对角线上方,绿色箭头“滚动”(Roll)指向右侧对角线上方,蓝色箭头“偏航”(Yaw)从中心直接指向下方。

方向报告块。#
[偏转 v] 偏转角度值

参数

描述

The orientation axis to report:

  • roll
  • pitch
  • yaw

例子

当开始
[Display the robot's orientation as it is rotated by hand.]
永久循环
清除屏幕第 [1] 行
在屏幕上设定光标至 [1] 行 [1] 列
在屏幕上打印 ([横滚 v] 偏转角度值)▶
等待 [0.05] 秒

行动#

当崩溃时#

The when crashed hat block runs the attached stack when the robot detects a sudden impact or collision. Crash detection uses the accelerometer and the current crash sensitivity.

当帽子块坠毁时。#
当碰撞

参数

描述

该块没有参数。

例子

当开始
[Start moving forward.]
将移动速度设置为 [100]%
移动 [向前 v]

当碰撞
[Respond when a crash is detected.]
停止移动
播放声音 [撞毁 v] ▶

设置碰撞敏感度#

The set crash sensitivity stack block adjusts how much sudden acceleration is needed for the robot to detect a crash.

设置崩溃敏感度堆栈块。#
设定碰撞灵敏度为 [低 v]

参数

描述

敏感度

How sensitive the robot is when detecting crashes:

  • low — Detects stronger impacts only.
  • medium — Detects moderate impacts.
  • high — Detects smaller impacts.

例子

当开始
[Move slowly with high crash sensitivity.]
将移动速度设置为 [35]%
设定碰撞灵敏度为 [高 v]
移动 [向前 v]

当碰撞
[Respond when a crash is detected.]
停止移动
播放声音 [撞毁 v] ▶

重置标题#

The reset heading stack block resets the robot’s current heading to 0 degrees. After this block runs, the direction the robot is currently facing becomes the new 0-degree heading.

重置标题堆栈块。#
重置航向角度值

参数

描述

该块没有参数。

例子

当开始
[Face left before turning around.]
归位至 [270] 度 ▶
重置航向角度值
等待 [1] 秒
归位至 [180] 度 ▶

重置旋转#

The reset rotation stack block resets the robot’s current rotation value to 0 degrees. After this block runs, the robot tracks future turns from the new 0-degree rotation value.

重置旋转堆栈块。#
重置转向角度值

参数

描述

该块没有参数。

例子

当开始
[Turn for 480 degrees before resetting rotation.]
[右 v] 转 [480] 度 ▶
重置转向角度值
永久循环
清屏
在屏幕上设定光标至 [1] 行 [1] 列
在屏幕上打印 (转向角度值)▶