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.

girar [ArmMotor v] [arriba v]

Parameters

Description

direction

The direction to spin the motor:

  • up
  • down

Example

cuando empezó
[Raise the Arm Motor, then stop.]
girar [ArmMotor v] [arriba v]
esperar (1) segundos
parada [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.

girar [ArmMotor v] [arriba v] por [90] [grados 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

cuando empezó
[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

cuando empezó
[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.

parada [ArmMotor v]

Parameters

Description

This block has no parameters.

Example

cuando empezó
[Raise the Arm Motor, then stop.]
girar [ArmMotor v] [arriba v]
esperar (1) segundos
parada [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

cuando empezó
[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.

Establezca el tiempo de espera [ArmMotor v] en [1] segundo

Parameters

Description

time

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

Example

cuando empezó
[Limit Arm Motor movement to 1 second.]
Establezca el tiempo de espera [ArmMotor v] en [1] segundo
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] posición en [grados v] :: custom-motion)

Parameters

Description

unit

The unit of measurement:

  • degrees
  • turns

Example

cuando empezó
[Print the Arm Motor position.]
imprimir ([ArmMotor v] posición en [grados 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.

Establezca la posición [ArmMotor v] en [0] [grados v]

Parameters

Description

position

The encoder position value to set.

unit

The unit of measurement:

  • degrees
  • turns

Example

cuando empezó
[Set the Arm Motor to 90 degrees, then return to 0 degrees.]
set [ArmMotor v] position to [90] [degrees v]
girar [ArmMotor v] a la posición [0] [grados 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] ¿está hecho?>

Parameters

Description

This block has no parameters.

Example

cuando empezó
[Check when the Arm Motor has finished moving.]
girar [ArmMotor v] [arriba v] por [180] [grados v] ◀ y no esperes
esperar (0.1) segundos
si <[ArmMotor v] ¿está hecho?> entonces
print [Arm Motor is done.] ▶
fin

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] esta girando?>

Parameters

Description

This block has no parameters.

Example

cuando empezó
[Check whether the Arm Motor is moving.]
girar [ArmMotor v] [arriba v] por [180] [grados v] ◀ y no esperes
esperar (0.1) segundos
si <[ArmMotor v] esta girando?> entonces
print [Arm Motor is spinning.] ▶
fin

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

cuando empezó
[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

cuando empezó
[Check whether the Front Eye Sensor detects an object.]
if <[FrontEye v] found an object?> then
print [Object detected!] ▶
demás
print [No object detected.] ▶
fin

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] detecta [rojo v]?>

Parameters

Description

color

The color to detect:

  • red
  • green
  • blue

Example

cuando empezó
[Check whether the Front Eye Sensor detects blue.]
if <[FrontEye v] detects [blue v]?> then
print [Blue object detected.] ▶
fin

Eye brightness#

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

([FrontEye v] brillo en %)

Parameters

Description

This block has no parameters.

Example

cuando empezó
[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

cuando empezó
[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.

<¿Se detectó un accidente?>

Parameters

Description

This block has no parameters.

Example

cuando empezó
[Drive until the robot crashes, then stop.]
unidad [adelante v]
esperar hasta <¿Se detectó un accidente?>
deja de conducir