传动系统#

介绍#

The 123 Robot has a two-wheel drivetrain that lets it drive and turn. The Drivetrain blocks control how the robot moves.

The drivetrain can measure distance in two ways: steps and mm (millimeters). One step is one square on a 123 Field.

There are many ways to code the drivetrain. Below is a list of all Drivetrain blocks:

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

  • drive — Moves the robot forward or reverse forever.

  • drive for — Moves the robot forward or reverse for a specific distance.

  • drive until — Moves the robot forward or reverse until it detects an object, crash, or line.

  • turn — Turns the robot left or right forever.

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

  • turn to heading — Turns the robot to face a specific heading from -359 to 359 degrees. The robot will turn the shortest direction to reach the target heading.

  • stop driving — Stops the robot’s movement.

Settings — Adjust drivetrain settings.

Values — Check movement status.

  • drive is done — Reports whether the robot is finished moving.

  • drive heading — Reports the robot’s current heading from 0 to 359 degrees.

行动#

驾驶#

The drive stack block moves the robot forward or reverse forever. The robot will continue to move until it is given another action, like turning or stopping.

驱动 [向前 v]

参数

描述

方向

The direction the robot moves: forward or reverse.

例子

当开始
[Drive for 2 seconds.]
驱动 [向前 v]
等待 (2) 秒
驱动停止

驱动#

The drive for stack block moves the robot forward or reverse for a specific distance. The project will wait until the robot is done moving before the next block in the stack runs.

驱动 [向前 v] (1) [步数 v]

参数

描述

方向

The direction the robot moves: forward or reverse.

距离

The distance the robot drives. This can be an integer or a decimal.

单元

The distance unit: steps or mm.

例子

当开始
[Drive back and forth.]
驱动 [向前 v] (3) [步数 v]
驱动 [反 v] (3) [步数 v]

开车直到#

The drive until stack block moves the robot forward or reverse until the Eye Sensor detects an object, crash, or line.

驱动 [向前 v] 直到 [对象 v]

参数

描述

方向

The direction the robot moves: forward or reverse.

状况

The condition that stops the robot:

  • object — The Eye Sensor detects an object.
  • crash — The robot crashes into an object.
  • line — The Line Detector detects a line under the robot.

例子

当开始
[Reverse after a crash.]
驱动 [向前 v] 直到 [撞毁 v]
驱动 [反 v] (1) [步数 v]

转动#

The turn stack block turns the robot left or right forever. The robot will continue to turn until it is given another action, like driving or stopping.

[右 v] 转

参数

描述

方向

The direction the robot turns: left or right.

例子

当开始
[Turn for 2 seconds.]
[右 v] 转
等待 (2) 秒
驱动停止

转向#

The turn for stack block turns the robot left or right for a specific number of degrees. The turn is relative to the current position of the robot. The project will wait until the robot is done turning before the next block in the stack runs.

[右 v] 转 (90) 度

参数

描述

方向

The direction the robot turns: left or right.

角度

The number of degrees the robot turns. This can be an integer or a decimal.

例子

当开始
[Turn left, then turn around to the right.]
[左 v] 转 (90) 度
[右 v] 转 (180) 度

转向标题#

A heading is the direction the robot is facing, measured in degrees. The turn to heading stack block turns the robot to face a specific heading from -359 to 359 degrees. The robot will turn the shortest direction to reach the target heading.

The robot’s starting heading is 0 degrees.

归位至 (90) 度

参数

描述

标题

The direction the robot should face, in degrees. This can be an integer or a decimal from -359 to 359.

例子

当开始
[Turn to face the cardinal directions.]
归位至 (90) 度
等待 (2) 秒
归位至 (180) 度
等待 (2) 秒
归位至 (270) 度
等待 (2) 秒
归位至 (0) 度
等待 (2) 秒

停止驾驶#

The stop driving stack block stops the robot’s movement.

驱动停止

参数

描述

此代码块没有参数。

例子

当开始
[Stop driving after 4 seconds.]
驱动 [向前 v]
等待 [4] 秒
驱动停止

设置#

设置驱动超时#

The set drive timeout stack block sets how many seconds the robot will try to finish a movement. If the robot cannot finish in that time, it will stop trying and move on to the next block in the stack. This keeps the robot from getting stuck on a movement.

设定驱动超时为 (1) 秒

参数

描述

时间

The number of seconds the robot can try to finish a movement. This can be a whole number or a decimal.

例子

当开始
[Turn right after driving for 1 second.]
设定驱动超时为 (1) 秒
驱动 [向前 v] (1000) [毫米 v]
[右 v] 转 (90) 度

设置驱动航向#

A heading is the direction the robot is facing, measured in degrees. The set drive heading stack block changes the robot’s current heading to a new heading value.

For example, if the robot has turned to face right, setting the heading to 0 degrees makes that right-facing position the new 0 degrees. Then the robot can turn to other positions based on that new heading.

设定底盘归位至 (0) 度

参数

描述

标题

The heading value, in degrees, to set for the robot. This can be an integer or a decimal from 0 to 359.

例子

当开始
[Face the new 0 degree heading.]
设定底盘归位至 (90) 度
归位至 (0) 度

价值观#

drive is done#

The drive is done Boolean block reports whether the robot is finished moving. This can be used to control the timing of other behaviors based on the robot’s movement.

  • True — The robot is finished moving.

  • False — The robot is still moving.

This block works together with the following Drivetrain blocks: drive for, drive until, turn for, and turn to heading.

<驱动已结束?>

参数

描述

此代码块没有参数。

例子

当开始
[Glow blue after a crash.]
驱动 [向前 v] 直到 [撞毁 v]
永久循环
如果 <驱动已结束?> 那么
发光 [蓝色 v]
否则
发光 [绿色 v]

行驶方向#

A heading is the direction the robot is facing, measured in degrees. The drive heading reporter block reports the robot’s current heading from 0 to 359 degrees.

The robot’s starting heading is 0 degrees.

(底盘归位角度值)

参数

描述

此代码块没有参数。

例子

当开始
[Display the heading after turning.]
[右 v] 转 (450) 度
打印 (底盘归位角度值) ▶