惯性#

介绍#

VEX GO Brain 包含一个内置惯性传感器,用于测量加速度和检测运动变化。

以下是所有可用块的列表:

  • 校准陀螺仪 – 校准大脑的惯性传感器。

  • 设置航向 – 手动设置机器人的航向值。

  • 设置旋转 – 手动设置机器人的累积旋转值。

  • heading – 返回机器人的航向角(0 到 359.99 度)。

  • rotation – 返回自项目开始以来机器人转动的次数。

  • 检测到崩溃? – 返回一个布尔值,指示是否检测到崩溃。

  • 加速度 – 返回惯性传感器检测到的沿轴的加速度。

校准陀螺仪#

校准陀螺仪模块用于校准 Brain 的惯性传感器。所有后续模块都将等待校准完成后再执行。校准是一个内部过程,用于测量并补偿指定时间段内的传感器噪声和漂移。在此期间,Brain 必须保持完全静止(即,在稳定的表面上,没有任何外部运动)。校准期间的移动会导致结果不准确。

Note: If a Code Base, Super Car, or Drivetrain is configured, this block becomes unavailable. This occurs because any project containing a Drivetrain block will automatically calibrate at startup.

校准陀螺仪

参数

描述

该块没有参数。

设置标题#

set heading 块将惯性传感器的当前航向设置为指定值。

Note: If a Code Base, Super Car, or Drivetrain is configured, this turns into the set drive heading block.

aria-description 放在这里#
设定归位为 [0] 度

参数

描述

标题

要分配的航向值(以度为单位)。

设置旋转#

设置旋转块设置惯性传感器的当前累积旋转值。

Note: If a Code Base, Super Car, or Drivetrain is configured, this turns into the set drive rotation block.

aria-description 放在这里#
设定转向为 [0] 度

参数

描述

旋转

要分配的累积旋转值(以度为单位)。

标题#

heading 块返回机器人的航向角,范围从 0 到 359.99 度。

Note: If a Code Base, Super Car, or Drivetrain is configured, this turns into the drive heading block.

(归位角度值)

参数

描述

该块没有参数。

旋转#

旋转块返回自项目启动以来机器人旋转的度数(以度为单位):顺时针为正,逆时针为负。

Note: If a Code Base, Super Car, or Drivetrain is configured, this turns into the drive rotation block.

(转向角度值)

参数

描述

该块没有参数。

检测到崩溃?#

**检测到崩溃?**块返回一个布尔值,指示机器人是否崩溃。

  • 真 – 检测到碰撞。

  • 错误 – 未检测到碰撞

Note: This block requires a configured Code Base, Super Car, or Drivetrain.

<检测到碰撞?>

参数

描述

该块没有参数。

例子

aria-description 放在这里#
当开始 :: hat events
[Build Used: Super Code Base 2.0]
[Back up and turn after crashing.]
set drive velocity to [100] %
驱动 [向前 v]
等到 <检测到碰撞?>
驱动 [反 v] [100] [毫米 v] ▶
[右 v] 转 [90] 度 ▶

加速度#

加速度块将 VEX GO Brain 惯性传感器的轴(x、y 或 z)之一的加速度以 -4.0 到 4.0 G 之间的小数形式返回。

([X v] 轴加速度值\(g\))

参数

描述

获取加速度的轴:

  • x
  • y
  • z

例子

aria-description 放在这里#
当开始 :: hat events
[Build Used: Super Code Base 2.0]
[Display the acceleration after moving.]
设定打印精度为 [All Digits v]
set drive velocity to [100] %
打印 [Resting: ] ▶
打印 ([X v] 轴加速度值\(g\)) ▶
设定光标至下一行
等待 [1] 秒
驱动 [向前 v] [500] [毫米 v] ◀ 并且不等待
等待 [0.2] 秒
打印 [Startup: ] ▶
打印 ([X v] 轴加速度值\(g\)) ▶