惯性#
介绍#
VEX AIM 编程机器人的惯性传感器内置一个用于测量旋转运动的三轴陀螺仪和一个用于检测运动变化的三轴加速度计。这些传感器使机器人能够追踪其方向、航向和加速度。以下是所有可用模块的列表,按功能分组:
值 - 返回方向和运动数据。
heading – 返回机器人的航向角(0 到 359.99 度)。
rotation – 返回机器人自启动以来旋转了多少度。
加速度 – 返回沿向前、向右或向下轴向上的加速度。
获取转弯速率 – 返回机器人当前的旋转速度,以每秒度数 (dps) 为单位。
orientation – 返回机器人的滚动、俯仰或偏航(-180.00 到 180.00 度)。
动作——检测并响应加速度的变化或重置航向/方向。
价值观#
标题#
heading 块以十进制数返回机器人的航向角,范围在 0 到 359.99 度之间。
归位角度值
参数 |
描述 |
---|---|
该块没有参数。 |
示例
当开始 :: hat events
[Turn right until the heading reaches 90 degrees.]
[右 v] 转
等待 [0.05] 秒
等到 <(归位角度值) [math_greater_than v] [90]>
停止移动
当开始 :: hat events
[Display the robot's heading as it is rotated by hand.]
永久循环
清除屏幕第 [1] 行
在屏幕上设定光标至 [1] 行 [1] 列
在屏幕上打印 (归位角度值)▶
等待 [0.05] 秒
旋转#
旋转块返回机器人自启动以来旋转了多少度(以度为单位):顺时针为正,逆时针为负。
(转向角度值)
参数 |
描述 |
---|---|
该块没有参数。 |
例子
当开始 :: hat events
[Print the rotation value as the robot turns.]
[右 v] 转 [480] 度 ◀ 并且不等待
永久循环
清屏
在屏幕上设定光标至 [1] 行 [1] 列
在屏幕上打印 (转向角度值)▶
加速度#
加速度块以 g 为单位返回机器人沿指定轴(向前、向右或向下)的加速度,范围从 -4.00 到 4.00。
(acceleration of [forward v] axis in g :: custom-controller-inertial-timer :: custom-controller-inertial-timer)
参数 |
描述 |
---|---|
轴 |
返回加速度的轴:
|
例子
当开始 :: hat events
[Show the change in acceleration as the robot begins to move.]
在屏幕上设定光标至 [4] 行 [1] 列
在屏幕上打印 (连接 [Resting: ] (acceleration of [rightward v] axis in g :: custom-controller-inertial-timer :: custom-controller-inertial-timer))▶
在屏幕上设定光标至下一行
等待 [0.5] 秒
将 [右 v] 移至 [50] [毫米 v] ◀ 并且不等待
等待 [0.1] 秒
在屏幕上打印 (连接 [Startup: ] (acceleration of [rightward v] axis in g :: custom-controller-inertial-timer :: custom-controller-inertial-timer))▶
获取转弯速率#
获取转弯速率 块以整数形式返回机器人沿指定轴(滚动、俯仰或偏航)的当前旋转速度(以每秒度数 (dps) 为单位)。
下图使用箭头表示滚动、俯仰、偏航的正旋转方向。
(get turn rate of [yaw v] axis in dps)
参数 |
描述 |
---|---|
轴 |
返回转弯速率的轴:
|
例子
当开始 :: hat events
[Observe the yaw turn rate as the robot turns.]
[右 v] 转 [180] 度 ◀ 并且不等待
永久循环
清屏
在屏幕上设定光标至 [1] 行 [1] 列
在屏幕上打印 (get turn rate of [yaw v] axis in dps)▶
方向#
orientation 块以十进制数返回机器人的滚动、俯仰或偏航,范围在 -180.00 到 180.00 度之间。
下图使用箭头表示滚动、俯仰、偏航的正旋转方向。
orientation of [yaw v] in degrees
参数 |
描述 |
---|---|
轴 |
方向轴:
|
例子
当开始 :: hat events
[Display the robot's orientation as it is rotated by hand.]
永久循环
清除屏幕第 [1] 行
在屏幕上设定光标至 [1] 行 [1] 列
在屏幕上打印 (orientation of [roll v] in degrees)▶
等待 [0.05] 秒
行动#
当崩溃时#
当机器人根据加速度计的读数和 当前碰撞灵敏度 检测到突然的撞击或碰撞时, 当碰撞时 块会触发事件。
当碰撞 :: hat events
参数 |
描述 |
---|---|
该块没有参数。 |
例子
当开始 :: hat events
[Move forward until the robot crashes.]
set move velocity to [100]%
移动 [向前 v]
当碰撞 :: hat events
停止移动
播放声音 [撞毁 v] ▶
设置碰撞敏感度#
设置碰撞灵敏度块调整触发碰撞响应所需的加速度阈值。
设定碰撞灵敏度为 [低 v]
参数 |
描述 |
---|---|
敏感度 |
机器人检测碰撞的灵敏度:
|
例子
当开始 :: hat events
[Detect a crash at a slow velocity.]
set move velocity to [35]%
设定碰撞灵敏度为 [高 v]
移动 [向前 v]
当碰撞 :: hat events
停止移动
播放声音 [撞毁 v] ▶
重置标题#
重置航向块将机器人的航向重置为 0 度。
reset heading
参数 |
描述 |
---|---|
该块没有参数。 |
例子
当开始 :: hat events
[Face left before turning around.]
归位至 [270] 度 ▶
reset heading
等待 [1] 秒
归位至 [180] 度 ▶
重置旋转#
重置旋转块将机器人的旋转值重置为 0 度。
reset rotation
参数 |
描述 |
---|---|
该块没有参数。 |
例子
当开始 :: hat events
[Turn for 480 degrees before resetting rotation.]
[右 v] 转 [480] 度 ▶
reset rotation
当开始 :: hat events
永久循环
清屏
在屏幕上设定光标至 [1] 行 [1] 列
在屏幕上打印 (转向角度值)▶