Robot-Specific Blocks#

Introduction#

The GO Competition - Mars Math Expedition Playground features blocks exclusive to the virtual GO Hero Robot, including Arm Motor controls and robot-specific sensing blocks.

All standard VEXcode VR Blocks are available for use in the GO Competition - Mars Math Expedition Playground.

Below is a list of all available Playground-specific Blocks:

Motion - Move and track the robot’s Arm Motor.

Sensing - Utilize the robot’s sensors.

  • Eye Sensor

    • Eye found an object? - Returns whether the Front Eye Sensor detects an object.

    • Eye detects color? - Returns whether the Front Eye Sensor detects a selected color.

    • Eye brightness - Returns the brightness detected by the Front Eye Sensor.

    • Eye hue - Returns the hue detected by the Front Eye Sensor.

  • Gyro Sensing

    • detected crash? - Returns whether the robot has crashed into a wall or object.

The examples on this page use the default Playground start position.

Motion#

Actions#

spin motor#

The spin motor block spins the Arm Motor in a specified direction using the current motor velocity.

[ArmMotor v] [向上 v] 转

Parameters

Description

direction

The direction to spin the motor:

  • up
  • down

Example

当开始
[Raise the Arm Motor, then stop.]
[ArmMotor v] [向上 v] 转
等待 (1) 秒
[ArmMotor v] 停止

spin motor for#

The spin motor for block spins the Arm Motor for a specific amount of rotation using the current motor velocity.

[ArmMotor v] [向上 v] 转 [90] [度 v] ▶

Parameters

Description

direction

The direction to spin the motor:

  • up
  • down

distance

The rotation amount, as an integer or decimal.

unit

The unit of measurement representing the distance:

  • degrees
  • turns

expanding arrow

By default, this is a waiting block, so the motor will finish moving before running the next block. Expand the block to say and don’t wait to make it non-waiting.

Example

当开始
[Raise the Arm Motor by 200 degrees.]
spin [ArmMotor v] [up v] for [200] [degrees v] ▶

spin motor to position#

The spin motor to position block spins the Arm Motor to a specific absolute position using the current motor velocity and motor position.

spin [ArmMotor v] to position [90] [degrees v] ▶

Parameters

Description

position

The target position to spin the motor to.

unit

The unit of measurement:

  • degrees
  • turns

expanding arrow

By default, this is a waiting block, so the motor will finish moving before running the next block. Expand the block to say and don’t wait to make it non-waiting.

Example

当开始
[Move the Arm Motor to 180 degrees.]
spin [ArmMotor v] to position [180] [degrees v] ▶

stop motor#

The stop motor block immediately stops the Arm Motor.

[ArmMotor v] 停止

Parameters

Description

This block has no parameters.

Example

当开始
[Raise the Arm Motor, then stop.]
[ArmMotor v] [向上 v] 转
等待 (1) 秒
[ArmMotor v] 停止

Settings#

set motor velocity#

The set motor velocity block sets the default spinning speed of the Arm Motor as a percentage for all subsequent Motion blocks in the project.

set [ArmMotor v] velocity to [50] %

Parameters

Description

velocity

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

Example

当开始
[Set the Arm Motor velocity to 100%.]
set [ArmMotor v] velocity to [100] %
spin [ArmMotor v] [up v] for [1] [turns v] ▶

set motor timeout#

The set motor timeout block sets a time limit for how long a Motor 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 motor’s time limit is used to prevent Motor blocks that do not reach their target position from stopping the execution of other blocks in the stack.

设定 [ArmMotor v] 超时为 [1] 秒

Parameters

Description

time

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

Example

当开始
[Limit Arm Motor movement to 1 second.]
设定 [ArmMotor v] 超时为 [1] 秒
spin [ArmMotor v] [up v] for [3] [turns v] ▶

Position#

motor position#

The motor position block returns the total distance the Arm Motor has rotated.

([ArmMotor v] 转位 [度 v] :: custom-motion)

Parameters

Description

unit

The unit of measurement:

  • degrees
  • turns

Example

当开始
[Print the Arm Motor position.]
打印 ([ArmMotor v] 转位 [度 v] :: custom-motion) ▶

set motor position#

The set motor position block sets a specific position value to the Arm Motor, which updates the encoder reading.

设定 [ArmMotor v] 转位至 [0] [度 v]

Parameters

Description

position

The encoder position value to set.

unit

The unit of measurement:

  • degrees
  • turns

Example

当开始
[Set the Arm Motor to 90 degrees, then return to 0 degrees.]
set [ArmMotor v] position to [90] [degrees v]
[ArmMotor v] 转至 [0] [度 v] ▶

Values#

motor is done?#

The motor is done? block returns a Boolean indicating whether the Arm Motor is not spinning.

  • True - The motor is not spinning.

  • False - The motor is spinning.

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

<[ArmMotor v] 已结束?>

Parameters

Description

This block has no parameters.

Example

当开始
[Check when the Arm Motor has finished moving.]
[ArmMotor v] [向上 v] 转 [180] [度 v] ◀ 并且不等待
等待 (0.1) 秒
如果 <[ArmMotor v] 已结束?> 那么
print [Arm Motor is done.] ▶
结束

motor is spinning?#

The motor is spinning? block returns a Boolean indicating whether the Arm Motor is spinning.

  • True - The motor is spinning.

  • False - The motor is not spinning.

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

<[ArmMotor v] 正在转?>

Parameters

Description

This block has no parameters.

Example

当开始
[Check whether the Arm Motor is moving.]
[ArmMotor v] [向上 v] 转 [180] [度 v] ◀ 并且不等待
等待 (0.1) 秒
如果 <[ArmMotor v] 正在转?> 那么
print [Arm Motor is spinning.] ▶
结束

motor velocity#

The motor velocity block returns the current rotational speed of the Arm Motor in a range from -100% to 100%.

([ArmMotor v] velocity in [% v] :: custom-motion)

Parameters

Description

This block has no parameters.

Example

当开始
[Print the Arm Motor velocity.]
print ([ArmMotor v] velocity in [% v] :: custom-motion) ▶

Sensing#

The virtual Hero Robot also has access to the standard Brain and Drivetrain Sensing Blocks.

Eye#

Eye found an object?#

The Eye found an object? block returns a Boolean indicating whether the Front Eye Sensor detects an object within range.

  • True - The sensor has detected an object.

  • False - The sensor has not detected an object.

<[FrontEye v] found an object?>

Parameters

Description

This block has no parameters.

Example

当开始
[Check whether the Front Eye Sensor detects an object.]
if <[FrontEye v] found an object?> then
print [Object detected!] ▶
否则
print [No object detected.] ▶
结束

Eye detects color?#

The Eye detects color? block returns a Boolean indicating whether the Front Eye Sensor detects a specified color.

  • True - The sensor detects the specified color.

  • False - The sensor does not detect the specified color.

<[FrontEye v] 测得 [红色 v]?>

Parameters

Description

color

The color to detect:

  • red
  • green
  • blue

Example

当开始
[Check whether the Front Eye Sensor detects blue.]
if <[FrontEye v] detects [blue v]?> then
print [Blue object detected.] ▶
结束

Eye brightness#

The Eye brightness block returns the brightness detected by the Front Eye Sensor from 0% to 100%.

([FrontEye v] 亮度百分比)

Parameters

Description

This block has no parameters.

Example

当开始
[Print the brightness detected by the Front Eye Sensor.]
print ([FrontEye v] brightness in %) ▶

Eye hue#

The Eye hue block returns the hue detected by the Front Eye Sensor in degrees from 0 to 359.

([FrontEye v] hue in degrees)

Parameters

Description

This block has no parameters.

Example

当开始
[Print the hue detected by the Front Eye Sensor.]
print ([FrontEye v] hue in degrees) ▶

Gyro#

detected crash?#

The detected crash? block returns a Boolean indicating whether or not the robot crashed.

  • True - A crash was detected.

  • False - A crash was not detected.

<检测到碰撞?>

Parameters

Description

This block has no parameters.

Example

当开始
[Drive until the robot crashes, then stop.]
驱动 [向前 v]
等到 <检测到碰撞?>
驱动停止