运动#
介绍#
VEX AIM 编码机器人采用完整的传动系统,使其能够向任何方向移动并独立旋转。Motion 模块用于移动、旋转、速度调节和位置跟踪。
以下是可用块的列表:
动作——移动和转动机器人。
move – Moves the robot forward, reverse, left, or right.
move at angle – Moves the robot in a specified direction using an angle.
move for – Moves the robot in a specific direction for a set distance.
move at angle for – Moves the robot at a specific angle for a set distance.
turn – Rotates the robot left or right.
turn for – Rotates the robot for a specified number of degrees.
turn to heading – Rotates the robot to face a specific heading.
move with controller – Allows the robot to be driven using the controller.
stop all movement – Stops all movement of the robot.
设置——调整移动和转动速度。
set move velocity – Sets the movement speed as a percentage.
set turn velocity – Sets the turning speed as a percentage.
位置——跟踪和修改机器人的位置。
position – Returns the robot’s current x or y coordinate.
set robot position – Manually sets the robot’s x and y position.
值——检查运动状态。
move active? – Returns whether the robot is currently moving.
turn active? – Returns whether the robot is currently turning.
stopped? – Returns whether the robot is neither moving nor turning.
行动#
移动#
The move block moves the robot in four specific directions using the current move velocity.
移动 [正 v]
参数 |
描述 |
---|---|
方向 |
Move the robot in one of the following directions:
|
例子
当开始 :: hat events
[前进]
移动 [正 v]
以角度移动#
The move at angle block moves the robot at a specified angle using the current move velocity.
以 (90) 度移动
参数 |
描述 |
---|---|
角度 |
机器人移动的角度,以整数或小数表示,范围从 -360 度到 360 度。 |
示例
当开始 :: hat events
[向右移动,然后向前移动并停止.]
以 (90) 度移动
等待 (1) 秒
以 (0) 度移动
等待 (1) 秒
停止移动
当开始 :: hat events
[向右斜移并停止.]
以 (45.33) 度移动
等待 (1) 秒
停止移动
移动#
The move for block moves the robot in four specific directions for a specific distance using the current move velocity.
移动 [正 v] (200) [mm v] ▶
参数 |
描述 |
---|---|
方向 |
Move the robot in one of the following directions:
|
距离 |
机器人将移动的距离,以整数或小数表示,以单位测量。 |
单元 |
The unit of measurement, which can be one of the following:
|
扩大箭头 |
默认情况下,这是一个等待块,因此机器人会在运行下一个块之前完成移动。要使机器人开始移动并立即运行下一个块,请将块扩展为并且不要等待。 |
例子
当开始 :: hat events
[向前移动 200 毫米]
移动 [正 v] (200) [mm v] ▶
以一定角度移动#
The move at angle for block moves the robot at a specific angle for a specified distance using the current move velocity.
以 (45) 度移动 (200) [mm v] ▶
参数 |
描述 |
---|---|
角度 |
机器人移动的角度,以整数或小数表示,范围从 -360 度到 360 度。 |
距离 |
机器人将移动的距离,以整数或小数表示,以单位测量。 |
单元 |
The unit of measurement, which can be one of the following:
|
扩大箭头 |
默认情况下,这是一个等待块,因此机器人会在运行下一个块之前完成移动。要使机器人开始移动并立即运行下一个块,请将块扩展为并且不要等待。 |
示例
当开始 :: hat events
[向右移动,然后向前移动.]
以 (90) 度移动 (50) [mm v] ▶
以 (0) 度移动 (100) [mm v] ▶
当开始 :: hat events
[向前行驶,所有 LED 灯闪烁红色.]
以 (0) 度移动 (100) [mm v] ◀ 并且不等待
将 [lightall v] LED颜色设置为 [红色 v]
等待 (0.5) 秒
将 [lightall v] LED颜色设置为 [灭 v]
等待 (0.5) 秒
将 [lightall v] LED颜色设置为 [红色 v]
等待 (0.5) 秒
将 [lightall v] LED颜色设置为 [灭 v]
等待 (0.5) 秒
转动#
The turn block turns the robot in a specific direction using the current turn velocity.
[右 v] 转
参数 |
描述 |
---|---|
方向 |
The direction in which the robot turns:
|
例子
当开始 :: hat events
[左转然后停.]
[左 v] 转
等待 (1) 秒
停止移动
转向#
The turn for block turns the robot in a specified direction for a set distance relative to its current facing direction using the current turn velocity.
[右 v] 转 (90) 度 ▶
参数 |
描述 |
---|---|
方向 |
The direction in which the robot turns:
|
角度 |
机器人移动的角度,以整数或小数表示,范围从 -360 度到 360 度。 |
扩大箭头 |
默认情况下,这是一个等待块,因此机器人会在运行下一个块之前完成转向。要使机器人开始转向并立即运行下一个块,请将块扩展为并且不等待。 |
示例
当开始 :: hat events
[向左转,然后向右转.]
[左 v] 转 (90) 度 ▶
[右 v] 转 (180) 度 ▶
当开始 :: hat events
[向右转,所有 LED 闪烁蓝色.]
[右 v] 转 (180) 度 ◀ 并且不等待
将 [lightall v] LED颜色设置为 [蓝色 v]
等待 (0.5) 秒
将 [lightall v] LED颜色设置为 [灭 v]
等待 (0.5) 秒
将 [lightall v] LED颜色设置为 [蓝色 v]
等待 (0.5) 秒
将 [lightall v] LED颜色设置为 [灭 v]
等待 (0.5) 秒
转向航向#
The turn to heading block turns the robot to face a specific heading using the current turn velocity.
归位至 (270) 度 ▶
参数 |
描述 |
---|---|
标题 |
机器人将转向的方向,范围是 -360 度到 360 度。 |
扩大箭头 |
默认情况下,这是一个等待块,因此机器人会在运行下一个块之前完成转向。要使机器人开始转向并立即运行下一个块,请将块扩展为并且不等待。 |
示例
当开始 :: hat events
[转向各个基本方向.]
归位至 (90) 度 ▶
等待 (2) 秒
归位至 (180) 度 ▶
等待 (2) 秒
归位至 (270) 度 ▶
等待 (2) 秒
归位至 (0) 度 ▶
等待 (2) 秒
当开始 :: hat events
[快速转身,所有 LED 灯闪烁绿色.]
归位至 (180) 度 ◀ 并且不等待
将 [lightall v] LED颜色设置为 [绿色 v]
等待 (0.5) 秒
将 [lightall v] LED颜色设置为 [灭 v]
等待 (0.5) 秒
将 [lightall v] LED颜色设置为 [绿色 v]
等待 (0.5) 秒
将 [lightall v] LED颜色设置为 [灭 v]
等待 (0.5) 秒
使用控制器移动#
使用使用控制器移动积木,您可以使用单摇杆控制器来驱动机器人。要使用该控制器,您需要将积木放入循环中,例如“永久”循环。如果循环停止,并且没有其他积木指示机器人移动,则机器人将继续沿着您上次推动操纵杆的方向前进。
与遥控器一起移动
参数 |
描述 |
---|---|
该块没有参数。 |
例子
当开始 :: hat events
[使用控制器驾驶五秒钟.]
重置计时器 :: custom-orientation
当 <(计时器秒数) [math_less_than v] [5]>
与遥控器一起移动
结束
停止移动
停止一切运动#
停止所有运动块停止机器人的所有运动。
停止移动
参数 |
描述 |
---|---|
该块没有参数。 |
例子
当开始 :: hat events
[右转然后停.]
[右 v] 转
等待 (1) 秒
停止移动
设置#
设置移动速度#
设置移动速度 模块以百分比形式设置项目中所有后续移动模块的默认移动速度。100% 的移动速度相当于 200 毫米/秒 (mmps)。
设定移动转速为 (50) %
参数 |
描述 |
---|---|
速度 |
将默认移动速度设置为百分比。 |
例子
当开始 :: hat events
[以默认速度向前移动.]
设定移动转速为 (50) %
以 (0) 度移动 (100) [mm v] ▶
等待 (1) 秒
[移动得慢一点.]
设定移动转速为 (20) %
以 (0) 度移动 (100) [mm v] ▶
等待 (1) 秒
[移动更快.]
设定移动转速为 (100) %
以 (0) 度移动 (100) [mm v] ▶
等待 (1) 秒
设置转弯速度#
设置转弯速度 会将项目中所有后续转弯块的默认速度设置为百分比。转弯速度 100% 相当于每秒 150 度 (dps)。
设定转向速度为 (50) %
参数 |
描述 |
---|---|
速度 |
将默认转弯速度设置为百分比。 |
例子
当开始 :: hat events
[以默认速度转弯.]
设定转向速度为 (50) %
[右 v] 转 (180) 度 ▶
等待 (1) 秒
[转身慢一点.]
设定转向速度为 (20) %
[右 v] 转 (180) 度 ▶
等待 (1) 秒
[转得更快.]
设定转向速度为 (20) %
[右 v] 转 (180) 度 ▶
等待 (1) 秒
位置#
位置#
位置块以整数形式返回机器人当前的 x 或 y 坐标,以毫米为单位。
在 [x v] 上 [mm v]
参数 |
描述 |
---|---|
协调 |
The coordinate axis, which can be one of the following:
|
单元 |
The unit of measurement, which can be one of the following:
|
例子
当开始 :: hat events
以 (0) 度移动 (200) [mm v] ▶
[向前移动并打印新的坐标和航向.]
设置机器位置为 [0] [0]
以 (45) 度移动 (200) [mm v] ▶
打印 (在 [x v] 上 [mm v]) 在屏幕 ▶
在屏幕上设定光标至下一行
打印 (在 [y v] 上 [mm v]) 在屏幕 ▶
设置机器人位置#
设置机器人位置块将机器人的当前位置设置为以毫米(mm)为单位的指定值。
设置机器位置为 [0] [0]
参数 |
描述 |
---|---|
十 |
为机器人设置的 x 位置,以毫米为单位。 |
是 |
为机器人设置的 y 位置,以毫米为单位。 |
例子
当开始 :: hat events
[移动后重置机器人的位置.]
移动 [正 v] [60] [mm v] ▶
设置机器位置为 [0] [0]
打印 (在 [y v] 上 [mm v]) 在屏幕 ▶
价值观#
移動?#
move active? 块返回一个布尔值,指示机器人当前是否正在移动。
True - The robot is moving.
False` - The robot is not moving.
<移动中?>
参数 |
描述 |
---|---|
该块没有参数。 |
例子
当开始 :: hat events
[机器人移动时,所有 LED 闪烁.]
以 (0) 度移动 (200) [mm v] ◀ 并且不等待
当 <移动中?>
将 [lightall v] LED颜色设置为 [红色 v]
等待 (0.5) 秒
将 [lightall v] LED颜色设置为 [灭 v]
等待 (0.5) 秒
结束
将 [lightall v] LED颜色设置为 [灭 v]
转为活跃?#
turn active? 块返回一个布尔值,指示机器人当前是否正在转弯。
“True”——机器人正在转动。
“False”——机器人没有转动。
<转弯中?>
参数 |
描述 |
---|---|
该块没有参数。 |
例子
当开始 :: hat events
[机器人转动时,所有 LED 闪烁.]
[右 v] 转 (180) 度 ◀ 并且不等待
当 <转弯中?>
将 [lightall v] LED颜色设置为 [红色 v]
等待 (0.5) 秒
将 [lightall v] LED颜色设置为 [灭 v]
等待 (0.5) 秒
结束
将 [lightall v] LED颜色设置为 [灭 v]
停止了?#
stopped? 块返回一个布尔值,指示机器人是否既不移动也不转动。
True - The robot is not moving or turning.
False - The robot is moving or turning.
<已停止?>
参数 |
描述 |
---|---|
该块没有参数。 |
例子
定义 light show
[机器人移动或转动时 LED 闪烁.]
重复直到 <已停止?>
将 [lightall v] LED颜色设置为 [绿色 v]
等待 (0.5) 秒
将 [lightall v] LED颜色设置为 [紫色 v]
等待 (0.5) 秒
结束
当开始 :: hat events
[机器人移动或转动时,所有 LED 闪烁.]
以 (0) 度移动 (200) [mm v] ◀ 并且不等待
light show
[右 v] 转 (180) 度 ◀ 并且不等待
light show