Robot-Specific Blocks#

Introduction#

The VIQRC 24-25 Rapid Relay Playground features blocks exclusive to this Playground, including two motor options.

All standard VEXcode VR Blocks are available for use in the VIQRC 24-25 Rapid Relay Playground.

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

Motion - Move and track the robot’s motors.

  • Actions

    • spin motor - Spins the selected motor or motor group indefinitely.

    • spin motor for - Spins a motor or motor group for a specific distance in degrees or turns.

    • spin motor to position - Spins a motor or motor group to a set position.

    • stop motor - Stops a specific motor or motor group from spinning.

  • Settings

    • set motor velocity - Sets the speed of a motor or motor group as a percentage.

    • set motor timeout - Limits how long a motor block waits before giving up if movement is blocked.

  • Position

    • motor position - Returns the motor’s current rotational position in degrees or turns.

    • set motor position - Sets the encoder value of a motor or motor group.

  • Values

    • motor is done? - Returns a Boolean indicating whether the motor is no longer spinning.

    • motor is spinning? - Returns a Boolean indicating whether the motor is currently spinning.

    • motor velocity - Returns the motor’s current velocity in %.

Sensing - Utilize the robot’s various sensors.

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

Motion#

Actions#

spin motor#

The spin motor block spins a selected motor or motor group in a specified direction using the current motor velocity.

spin [IntakeMotor v] [intake v]

Parameters

Description

motor

The motor or motor group to spin:

  • IntakeMotor
  • CatapultGroup

direction

The direction to spin:

  • IntakeMotor
    • intake
    • outtake
  • CatapultGroup
    • lower
    • release

Example

当开始
[Launch the preloaded Ball.]
spin [CatapultGroup v] [release v]
[Lower the Catapult to load a new Ball.]
spin [CatapultGroup v] [lower v]

spin motor for#

The spin motor for block spins a selected motor or motor group for a specific amount of rotation using the current motor velocity, measured in degrees or turns.

spin [IntakeMotor v] [intake v] for [90] [degrees v] ▶

Parameters

Description

motor

The motor or motor group to spin:

  • IntakeMotor
  • CatapultGroup

direction

The direction to spin:

  • IntakeMotor
    • intake
    • outtake
  • CatapultGroup
    • lower
    • release

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

当开始
[Launch the preloaded Ball.]
spin [CatapultGroup v] [release v]
[Lower the Catapult to load a new Ball.]
spin [CatapultGroup v] [lower v] for [1350] [degrees v] ▶

spin motor to position#

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

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

Parameters

Description

motor

The motor or motor group to spin:

  • IntakeMotor
  • CatapultGroup

position

The target position to spin the motor or motor group 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

当开始
[Launch the preloaded Ball.]
spin [CatapultGroup v] [release v]
[Lower the Catapult to load a new Ball.]
spin [CatapultGroup v] to position [1260] [degrees v] ▶

stop motor#

The stop motor block immediately stops the selected motor or motor group.

stop [IntakeMotor v]

Parameters

Description

motor

The motor or motor group to stop:

  • IntakeMotor
  • CatapultGroup

Example

当开始
[Start spinning Intake Motor to prepare to pick up a Ball.]
spin [IntakeMotor v] [intake v]
等待 (1) 秒
[After the Ball is picked up, stop spinning the Intake Motor.]
stop [IntakeMotor v]

Settings#

set motor position#

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

set [IntakeMotor v] position to [0] [degrees v]

Parameters

Description

motor

The motor or motor group to set the position of:

  • IntakeMotor
  • CatapultGroup

position

The encoder position value to set.

unit

The unit of measurement:

  • degrees
  • turns

Example

当开始
[Release the preloaded Ball.]
spin [CatapultGroup v] [release v]
[Lower the Catapult Arm to prepare for the next Ball.]
spin [CatapultGroup v] to position [1260] [degrees v] ▶
[Make the lowered Catapult Arm position the new 0 degrees position.]
set [CatapultGroup v] position to [0] [degrees v]

set motor velocity#

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

set [IntakeMotor v] velocity to [50] [% v]

Parameters

Description

motor

The motor or motor group to set the velocity of:

  • IntakeMotor
  • CatapultGroup

velocity

Sets the default movement velocity from -100 to 100 as a percent.

unit

The unit that represents the velocity:

  • %

Example

当开始
[Start spinning the Intake Motor to prepare to pick up Balls.]
set [IntakeMotor v] velocity to [100] [% v]
spin [IntakeMotor v] [intake 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.

set [IntakeMotor v] timeout to [1] seconds

Parameters

Description

motor

The motor or motor group to set the timeout of:

  • IntakeMotor
  • CatapultGroup

time

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

Example

当开始
set [CatapultGroup v] timeout to [2] seconds
[Lower Catapult Arm to prepare to pick up a Ball.]
spin [CatapultGroup v] [lower v] for [10] [turns v] ▶

Position#

motor position#

The motor position block returns the total distance the selected motor or motor group has rotated.

([IntakeMotor v] position in [degrees v])

Parameters

Description

motor

The motor or motor group to return the position of:

  • IntakeMotor
  • CatapultGroup

unit

The unit of measurement:

  • degrees
  • turns

Example

当开始
[Release the preloaded Ball.]
spin [CatapultGroup v] [release v]
[Lower the Catapult Arm to prepare for the next Ball.]
spin [CatapultGroup v] [lower v]
wait until <[1260] [math_less_than v] ([CatapultGroup v] position in [degrees v])>
stop [CatapultGroup v]

Values#

motor is done#

The motor is done? block returns a Boolean indicating whether the selected motor or motor group is not spinning.

  • True - The motor or motor group is not spinning.

  • False - The motor or motor group is spinning.

<[IntakeMotor v] is done?>

Parameters

Description

motor

The motor or motor group to check if it is done spinning:

  • IntakeMotor
  • CatapultGroup

motor is spinning?#

The motor is spinning? block returns a Boolean indicating whether the selected motor or motor group is spinning.

  • True - The motor or motor group is spinning.

  • False - The motor or motor group is not spinning.

<[IntakeMotor v] is spinning?>

Parameters

Description

motor

The motor or motor group to check if it is currently spinning:

  • IntakeMotor
  • CatapultGroup

motor velocity#

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

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

Parameters

Description

motor

The motor or motor group to return the velocity of:

  • IntakeMotor
  • CatapultGroup

unit

The unit that represents the velocity:

  • %

Sensing#

Optical#

Optical found an object?#

The Optical found an object? block returns a Boolean indicating whether the Optical Sensor has detected an object.

  • True - The Optical Sensor has detected an object.

  • False - The Optical Sensor has not detected an object.

<[IntakeOptical v] found an object?>

Parameters

Description

This block has no parameters.

Optical detects color#

The Optical detects color? block returns a Boolean indicating whether the Optical Sensor has detected a specific color.

  • True - The Optical Sensor has detected the specified color.

  • False - The Optical Sensor has not detected the specified color.

<[IntakeOptical v] detects [yellow v]?>

Parameters

Description

color

Which color to check for:

  • red
  • green
  • blue
  • white
  • yellow
  • orange
  • purple
  • red violet
  • violet
  • blue violet
  • blue green
  • yellow green
  • yellow orange
  • red orange

Optical brightness#

The Optical brightness block returns the amount of light detected by the Optical Sensor in a range from 0% to 100%.

([IntakeOptical v] brightness in %)

Parameters

Description

This block has no parameters.

Optical hue#

The Optical hue block returns the hue value of the color detected by the Optical Sensor.

Hue values range from 0 to 359 degrees, corresponding to positions on the color wheel shown below.

A circular color wheel displaying a full spectrum of hues labeled with degree values around the perimeter, increasing in 30-degree increments from 0 degrees at the top to 360 degrees.

([IntakeOptical v] hue in degrees)

Parameters

Description

This block has no parameters.

when Optical#

The when Optical block runs its stack when the Optical Sensor detects or loses an object. You can have multiple when Optical blocks to run multiple stacks of blocks at once.

when [IntakeOptical v] [detects v] an object

Parameters

Description

action

Which action triggers the hat block:

  • detects
  • loses