惯性#
介绍#
VEX AIM 编程机器人的惯性传感器内置一个用于测量旋转运动的三轴陀螺仪和一个用于检测运动变化的三轴加速度计。这些传感器使机器人能够追踪其方向、航向和加速度。以下是所有可用模块的列表,按功能分组:
值 - 返回方向和运动数据。
heading – Returns the robot’s heading angle (0 to 359.99 degrees).
rotation – Returns how much the robot has turned since it started.
acceleration – Returns acceleration along the forward, rightward, or downward axis.
get turn rate – Returns the robot’s current rotation speed in degrees per second (dps).
orientation – Returns the robot’s roll, pitch, or yaw (–180.00 to 180.00 degrees).
动作——检测并响应加速度的变化或重置航向/方向。
when crashed – Triggers an event when the robot detects a sudden impact.
set crash sensitivity – Adjusts how sensitive the crash detection is to impacts.
reset heading – Resets the heading value to zero.
reset rotation – Resets the rotation value to zero.
价值观#
标题#
heading 块以十进制数返回机器人的航向角,范围在 0 到 359.99 度之间。
归位角度值
参数 |
描述 |
---|---|
该块没有参数。 |
示例
当开始 :: hat events
[向右转,直到航向达到 90 度.]
[右 v] 转
等待 [0.05] 秒
等到 <(归位角度值) [math_greater_than v] [90]>
停止移动
当开始 :: hat events
[显示机器人手动旋转时的航向.]
永久循环
清除屏幕第 [1] 行
在屏幕上设定光标至 [1] 行 [1] 列
打印 (归位角度值) 在屏幕 ▶
等待 [0.05] 秒
旋转#
旋转块返回机器人自启动以来旋转了多少度(以度为单位):顺时针为正,逆时针为负。
(转向角度值)
参数 |
描述 |
---|---|
该块没有参数。 |
例子
当开始 :: hat events
[打印机器人转动时的旋转值.]
[右 v] 转 [480] 度 ◀ 并且不等待
永久循环
清屏
在屏幕上设定光标至 [1] 行 [1] 列
打印 (转向角度值) 在屏幕 ▶
加速度#
加速度块以 g 为单位返回机器人沿指定轴(向前、向右或向下)的加速度,范围从 -4.00 到 4.00。
([向前 v] 轴加速度值(g) :: custom-controller-inertial-timer
参数 |
描述 |
---|---|
轴 |
The axis to return the acceleration of:
|
例子
当开始 :: hat events
[显示机器人开始移动时加速度的变化.]
在屏幕上设定光标至 [4] 行 [1] 列
打印 (加入 [休息: ] ([向右 v] 轴加速度值(g) :: custom-controller-inertial-timer)) 在屏幕 ▶
在屏幕上设定光标至下一行
等待 [0.5] 秒
移动 [右 v] [50] [mm v] ◀ 并且不等待
等待 [0.1] 秒
打印 (加入 [启动: ] ([向右 v] 轴加速度值(g) :: custom-controller-inertial-timer)) 在屏幕 ▶
获取转弯速率#
获取转弯速率 块以整数形式返回机器人沿指定轴(滚动、俯仰或偏航)的当前旋转速度(以每秒度数 (dps) 为单位)。
下图使用箭头表示滚动、俯仰、偏航的正旋转方向。
(以dps为单位获取 [偏转 v] 轴的转弯率)
参数 |
描述 |
---|---|
轴 |
The axis to return the turn rate of:
|
例子
当开始 :: hat events
[观察机器人转弯时的偏航转弯率.]
[右 v] 转 [180] 度 ◀ 并且不等待
永久循环
清屏
在屏幕上设定光标至 [1] 行 [1] 列
打印 (以dps为单位获取 [偏转 v] 轴的转弯率) 在屏幕 ▶
方向#
orientation 块以十进制数返回机器人的滚动、俯仰或偏航,范围在 -180.00 到 180.00 度之间。
下图使用箭头表示滚动、俯仰、偏航的正旋转方向。
以度为 [偏转 v] 单位的方向
参数 |
描述 |
---|---|
轴 |
The orientation axis:
|
例子
当开始 :: hat events
[显示机器人手动旋转时的方向.]
永久循环
清除屏幕第 [1] 行
在屏幕上设定光标至 [1] 行 [1] 列
打印 (以度为 [横滚 v] 单位的方向) 在屏幕 ▶
等待 [0.05] 秒
行动#
当崩溃时#
The when crashed block triggers an event when the robot detects a sudden impact or collision based on the accelerometer’s readings and the current crash sensitivity.
崩溃时 :: hat events
参数 |
描述 |
---|---|
该块没有参数。 |
例子
当开始 :: hat events
[向前移动直到机器人崩溃]
设定移动转速为 [100] %
移动 [正 v]
崩溃时 :: hat events
停止移动
播放声音 [撞毁 v] ▶
设置碰撞敏感度#
设置碰撞灵敏度块调整触发碰撞响应所需的加速度阈值。
设定碰撞灵敏度为 [低 v]
参数 |
描述 |
---|---|
敏感度 |
The sensitivity of the robot to detect crashes:
|
例子
当开始 :: hat events
[检测低速碰撞.]
设定移动转速为 [5] %
设定碰撞灵敏度为 [高 v]
移动 [正 v]
崩溃时 :: hat events
停止移动
播放声音 [撞毁 v] ▶
重置标题#
重置航向块将机器人的航向重置为 0 度。
重置归位角度值
参数 |
描述 |
---|---|
该块没有参数。 |
例子
当开始 :: hat events
[转身前先看向左侧.]
归位至 [270] 度 ▶
重置归位角度值
等待 [1] 秒
归位至 [180] 度 ▶
重置旋转#
重置旋转块将机器人的旋转值重置为 0 度。
重置转向角度值
参数 |
描述 |
---|---|
该块没有参数。 |
例子
当开始 :: hat events
[旋转 480 度后再重新设置旋转.]
[右 v] 转 [480] 度 ▶
重置转向角度值
当开始 :: hat events
永久循环
清屏
在屏幕上设定光标至 [1] 行 [1] 列
打印 (转向角度值) 在屏幕 ▶