传动系统#

介绍#

The VEX GO Drivetrain uses a built-in Inertial Sensor to support precise forward, reverse, and turning movements. These blocks allow the robot to move continuously or for set distances, rotate by degrees or to a heading, and respond to changes in its rotational orientation.

The Drivetrain category also includes configuration blocks that let you set drive and turn speeds, define stopping behavior, apply timeouts to avoid execution stalls, and manually update the robot’s heading or rotation values.

Below is a list of all blocks:

动作——移动和转向机器人。

  • drive — Drives the robot continuously forward or in reverse.

  • drive for — Drives the robot for a set distance.

  • drive until — Drives until a specified condition.

  • turn — Turns the robot continuously left or right.

  • turn for — Turns the robot a specific number of degrees.

  • turn to heading — Turns the robot to face a specific absolute heading.

  • turn to rotation — Turns the robot to reach a specific cumulative rotation.

  • stop driving — Stops all robot movement.

设置 — 调整传动系统设置。

数值 — 检查移动状态。

  • drive is done? — Returns a Boolean indicating whether the drivetrain is no longer moving.

  • drive heading — Returns the drivetrain’s heading angle (0 to 359.99 degrees).

  • drive rotation — Returns how much the drivetrain has turned since the project started.

  • drive velocity — Returns the drivetrain’s current velocity in %.

行动#

驾驶#

The drive block moves the drivetrain forward or in reverse using the current drive velocity. This block runs continuously until another Drivetrain block interrupts it or the project stops.

驱动 [向前 v]

参数

描述

方向

The direction in which the robot drives:

  • forward
  • reverse

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Drive forward then stop.]
驱动 [向前 v]
等待 (2) 秒
驱动停止

开车去#

The drive for block moves the drivetrain forward or in reverse for a specified distance using the current drive velocity.

驱动 [向前 v] [100] [毫米 v] ▶

参数

描述

方向

The direction in which the robot drives:

  • forward
  • reverse

距离

The distance the robot drives, as an integer or decimal.

单元

The unit of measurement that represents the distance:

  • mm — Millimeters
  • inches

expanding arrow

By default, this is a waiting block, so the drivetrain will finish moving before running the next block. To make the drivetrain start moving and immediately run the next block right away, expand the block to say and don’t wait.

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Drive back and forth.]
驱动 [向前 v] [100] [毫米 v] ▶
驱动 [反 v] [4] [英寸 v] ▶

开车直到#

The drive until block is used to move the drivetrain indefinitely using the current drive velocity until the Eye Sensor detects an object or the robot crashes into an object or wall.

驱动 [向前 v] 直到 [撞毁 v] ▶

参数

描述

方向

The direction in which the robot drives:

  • forward
  • reverse

状况

The condition that stops the drivetrain:

  • crash — When the robot crashes into an object.
  • object — When the Eye Sensor detects an object (Eye Sensor must be installed).

expanding arrow

By default, this is a waiting block, so the drivetrain will finish moving before running the next block. To make the drivetrain start moving and immediately run the next block right away, expand the block to say and don’t wait.

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Turn right after a crash.]
驱动 [向前 v] 直到 [撞毁 v] ▶
[右 v] 转 (90) 度 ▶

转动#

The turn block turns the drivetrain continuously left or right using the current turn velocity. The drivetrain will keep turning until another Drivetrain block runs or the project stops.

[右 v] 转

参数

描述

方向

The direction in which the robot turns:

  • left
  • right

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Turn right and left, then stop.]
[右 v] 转
等待 [2] 秒
[左 v] 转
等待 [2] 秒
驱动停止

转向#

The turn for block turns the drivetrain left or right for a specific number of degrees using the current turn velocity.

[右 v] 转 (90) 度 ▶

参数

描述

方向

The direction in which the robot turns:

  • left
  • right

角度

The number of degrees the robot turns, as an integer or decimal.

expanding arrow

By default, this is a waiting block, so the drivetrain will finish turning before running the next block. To make the drivetrain start turning and immediately run the next block right away, expand the block to say and don’t wait.

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Turn right then left.]
[右 v] 转 (90) 度 ▶
[左 v] 转 (90) 度 ▶

转向航向#

The turn to heading block turns the drivetrain to face a specific heading using the current turn velocity.

归位至 [90] 度 ▶

参数

描述

标题

The absolute heading the drivetrain will turn to, from -360 to 360 degrees.

expanding arrow

By default, this is a waiting block, so the drivetrain will finish turning before running the next block. To make the drivetrain start turning and immediately run the next block right away, expand the block to say and don’t wait.

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Turn to face the cardinal directions.]
归位至 [90] 度 ▶
等待 [1] 秒
归位至 [180] 度 ▶
等待 [1] 秒
归位至 [270] 度 ▶
等待 [1] 秒
归位至 [0] 度 ▶

转向旋转#

The turn to rotation block turns the drivetrain to face a specific rotational value using the current turn velocity.

转向至 (90) 度 ▶

参数

描述

旋转

The cumulative rotation value the robot will turn to, as an integer or decimal.

expanding arrow

By default, this is a waiting block, so the drivetrain will finish turning before running the next block. To make the drivetrain start turning and immediately run the next block right away, expand the block to say and don’t wait.

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Spin around twice.]
转向至 (720) 度 ▶

停止驾驶#

The stop driving block immediately stops all movement of the drivetrain.

驱动停止

参数

描述

该块没有参数。

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Drive forward then stop.]
驱动 [向前 v]
等待 (2) 秒
驱动停止

设置驱动速度#

The set drive velocity block sets the default movement speed as a percentage for all subsequent movement blocks in the project.

set drive velocity to [50] %

参数

描述

速度

Sets the default movement velocity from 0% to 100%.

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Drive at different velocities.]
驱动 [向前 v] [100] [毫米 v] ▶
等待 [1] 秒
[Drive slow.]
set drive velocity to [20] %
驱动 [向前 v] [100] [毫米 v] ▶
等待 [1] 秒
[Drive fast.]
set drive velocity to [100] %
驱动 [向前 v] [100] [毫米 v] ▶

设置转弯速度#

The set turn velocity block sets the default velocity as a percentage for all subsequent turn blocks in the project.

set turn velocity to [50] %

参数

描述

速度

Sets the default turn velocity from 0% to 100%.

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Turn at different velocities.]
[右 v] 转 [180] 度 ▶
等待 [1] 秒
[Turn fast.]
set turn velocity to [100] %
[右 v] 转 [180] 度 ▶

设置驱动器停止#

The set drive stopping block sets how the drivetrain behaves when drivetrain movement ends.

设定驱动停止模式为 [刹车 v]

参数

描述

停止行为

Sets how the drivetrain stops:

  • brake — Stops immediately.
  • coast — Slows gradually to a stop.
  • hold — Stops and resists movement using motor feedback.

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Drive, then coast to a stop.]
set drive velocity to [100] %
设定驱动停止模式为 [滑行 v]
驱动 [向前 v]
等待 [2] 秒
驱动停止

设置驱动器超时#

The set drive timeout block sets a time limit for how long a Drivetrain block will wait to reach its target. If the robot cannot complete the movement within the set time, it will stop automatically and continue with the next block.

Note: The Drivetrain’s time limit is used to prevent Drivetrain blocks that do not reach their target position from stopping the execution of other blocks in the stack.

设定驱动超时为 [1] 秒

参数

描述

时间

The maximum number of seconds a Drivetrain block will run before stopping and moving to the next block.

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Drive as far as possible for 1 second before turning right.]
设定驱动超时为 [1] 秒
驱动 [向前 v] [25] [英寸 v] ▶
[右 v] 转 [90] 度 ▶

设置驾驶航向#

The set drive heading block sets the Inertial Sensor’s current heading to a specified value.

设定底盘归位至 [0] 度

参数

描述

标题

The heading value to assign, in degrees.

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Face the new 0 degree heading.]
设定底盘归位至 [90] 度
归位至 [0] 度 ▶

设置驱动器旋转#

The set drive rotation block sets the Inertial Sensor’s current cumulative rotation value.

设定底盘转向至 (0) 度

参数

描述

旋转

The cumulative rotation value to assign, in degrees.

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Spin counterclockwise two times.]
设定底盘转向至 [720] 度
转向至 [0] 度 ▶

价值观#

drive is done?#

The drive is done? block returns a Boolean indicating whether the drivetrain is not moving.

  • True — The drivetrain is not moving.

  • False — The drivetrain is moving.

Note: This block only detects movement from blocks that can expand to show the and don’t wait option.

<驱动已结束?>

参数

描述

该块没有参数。

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Turn when the drivetrain is done moving forward.]
驱动 [向前 v] [100] [毫米 v] ◀ 并且不等待
等待 [0.25] 秒
永久循环
如果 <驱动已结束?> 那么
[右 v] 转 [180] 度 ▶
退出循环
否则
打印 [Still moving...] ▶
等待 [0.1] 秒
清除所有行

行驶方向#

The drive heading block returns the drivetrain’s heading angle in a range from 0 to 359.99 degrees.

(底盘归位角度值)

参数

描述

该块没有参数。

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Display the heading while turning.]
[右 v] 转 [450] 度 ◀ 并且不等待
永久循环
清除所有行
打印 (底盘归位角度值) ▶
等待 [0.1] 秒

驱动旋转#

The drive rotation block returns how much the drivetrain has turned since the project started, in degrees: positive for clockwise, negative for counterclockwise.

(底盘转向角度值)

参数

描述

该块没有参数。

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Display the rotation while turning.]
[右 v] 转 [450] 度 ◀ 并且不等待
永久循环
清除所有行
打印 (底盘转向角度值) ▶
等待 [0.1] 秒

驱动速度#

The drive velocity block returns the current speed of the drivetrain in a range from -100% to 100%.

(驱动速度为%)

参数

描述

该块没有参数。

例子

当开始 :: hat events
[Build Used: Code Base 2.0]
[Display the velocity of the robot before and while moving.]
打印 [Start: ] ▶
打印 (驱动速度为%) ▶
设定光标至下一行
驱动 [向前 v]
等待 [0.5] 秒
打印 [Moving: ] ▶
打印 (驱动速度为%) ▶
驱动停止