Robot Specific Blocks#

Introduction#

The VIQRC 25-26 Mix & Match Playground features blocks exclusive to the build designed for this Playground, including two motor options, IQ AI Vision Sensor, Optical Sensor, and Touch LED.

All standard VEXcode VR Blocks are available for use in the VIQRC 25-26 Mix & Match Playground.

Below is a list of all available Playground specific Blocks:

Motion – Move and track the robot’s motors.

  • Actions

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

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

    • spin 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 %.

AI Vision – Capture and analyze objects using the IQ AI Vision Sensor.

Sensing - Utilize the robot’s various sensors.

Motion#

Actions#

spin#

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

girar [ClawMotor v] [abierto v]

Parameters

Description

motor

The motor or motor group to spin:

  • ClawMotor
  • LiftMotor

direction

The direction to spin:

    ClawMotor
    • open
    • close
    LiftMotor
    • down
    • up

Example

cuando empezó
[Place a pin atop another pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]

spin for#

The spin 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.

girar [ClawMotor v] [abierto v] por (90) [grados v] ▶

Parameters

Description

motor

The motor or motor group to spin:

  • ClawMotor
  • LiftMotor

direction

The direction to spin:

    ClawMotor
    • open
    • close
    LiftMotor
    • down
    • up

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. To make the motor start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

cuando empezó
[Place a pin atop another pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]

spin to position#

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

girar [ClawMotor v] a la posición (90) [grados v] ▶

Parameters

Description

motor

The motor or motor group to spin:

  • ClawMotor
  • LiftMotor

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. To make the motor start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

cuando empezó
[Place a pin atop another pin.]
girar [LiftMotor v] a la posición [-2] [giros v] ▶
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]

stop motor#

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

parada [ClawMotor v]

Parameters

Description

motor

The motor or motor group to stop:

  • ClawMotor
  • LiftMotor

Example

cuando empezó
[Place a pin atop another pin.]
girar [LiftMotor v] [arriba v]
esperar [2] segundos
parada [LiftMotor v]
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]

Settings#

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.

Establezca la velocidad [ClawMotor v] en (50) [% v]

Parameters

Description

motor

The motor or motor group to set the velocity of:

  • ClawMotor
  • LiftMotor

velocity

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

unit

The unit that represents the velocity:

  • %

Example

cuando empezó
[Place a pin atop another pin.]
Establezca la velocidad [LiftMotor v] en [100] [% v]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto 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 [ClawMotor v] en (1) segundo

Parameters

Description

motor

The motor or motor group to set the timeout of:

  • ClawMotor
  • LiftMotor

time

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

Example

cuando empezó
[Place a pin atop another pin.]
Establezca el tiempo de espera [LiftMotor v] en [2] segundo
girar [LiftMotor v] [arriba v] por [5] [giros v] ▶
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]

Position#

motor position#

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

([ClawMotor v] posición en [grados v])

Parameters

Description

motor

The motor or motor group to return the position of:

  • ClawMotor
  • LiftMotor

unit

The unit of measurement:

  • degrees
  • turns

Example

cuando empezó
[Place a pin atop another pin.]
girar [LiftMotor v] [arriba v]
esperar hasta <[-600] [math_greater_than v] ([LiftMotor v] posición en [grados v])>
parada [LiftMotor v]
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]

set motor position#

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

Establezca la posición [ClawMotor v] en (0) [grados v]

Parameters

Description

motor

The motor or motor group to set the position of:

  • ClawMotor
  • LiftMotor

position

The encoder position value to set.

unit

The unit of measurement:

  • degrees
  • turns

Example

cuando empezó
[Place a pin atop another pin.]
Establezca la posición [LiftMotor v] a [100] grado
girar [LiftMotor v] a la posición [-500] [grados v] ▶
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]

Values#

motor is done#

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

  • True – The motor is not spinning.

  • False – The motor is spinning.

<[ClawMotor v] ¿está hecho?>

Parameters

Description

motor

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

  • ClawMotor
  • LiftMotor

Example

cuando empezó
[Place a pin atop another pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ◀ y no esperes
esperar [0.1] segundos
repetir hasta <[LiftMotor v] ¿está hecho?>
establecer el color [TouchLED v] en [rojo v]
esperar [0.5] segundos
establecer el color [TouchLED v] en [rojo v]
esperar [0.5] segundos
fin
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]

motor is spinning?#

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

  • True – The motor is spinning.

  • False – The motor is not spinning.

<[ClawMotor v] esta girando?>

Parameters

Description

motor

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

  • ClawMotor
  • LiftMotor

Example

cuando empezó
[Place a pin atop another pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ◀ y no esperes
esperar [0.1] segundos
mientras <[LiftMotor v] esta girando?>
establecer el color [TouchLED v] en [rojo v]
esperar [0.5] segundos
establecer el color [TouchLED v] en [rojo v]
esperar [0.5] segundos
fin
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]

motor velocity#

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

([ClawMotor v] velocidad en [% v] :: custom-motion)

Parameters

Description

motor

The motor or motor group to return the velocity of:

  • ClawMotor
  • LiftMotor

unit

The unit that represents the velocity:

  • %

Example

cuando empezó
[Place a pin atop another pin.]
Establezca la velocidad [LiftMotor v] en [100] [% v]
girar [LiftMotor v] [arriba v] por [600] [grados v] ◀ y no esperes
esperar [0.5] segundos
imprimir ([LiftMotor v] velocidad en [% v] :: custom-motion) ▶
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]

AI Vision#

Actions#

get object data#

The get object data block filters data from the IQ AI Vision Sensor frame. The IQ AI Vision Sensor can detect Game Elements on the field.

The dataset stores objects ordered from largest to smallest by width, starting at index 0. Each object’s properties can be accessed using AI Vision object property block. An empty dataset is returned if no matching objects are detected.

The Get object data stack block.#
obtener [AI Classifications v] datos de [AIVision v]

Parameter

Description

signature

Filters the dataset to only include data of the given signature. The only available signature is:

  • AI Classifications – Detects Beams and Blue, Red, and Orange Pins.

Example

cuando empezó
[Place the Red Pin on the top left Blue Pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
girar [izquierda v] por [38] grado ▶
repetir hasta <([AIVision v] objeto [amplitud v]) [math_greater_than v] [48]>
[Move forward until the robot is close to the Pin.]
obtener [AI Classifications v] datos de [AIVision v]
unidad [adelante v]
fin
unidad [adelante v] para [160] [mm v] ▶
girar [ClawMotor v] [abierto v]

Settings#

set object item#

The set object item block sets which item in the dataset to use.

The Set AI Vision object item stack block.#
Establecer el elemento de objeto [AIVision v] en [1]

Parameters

Description

item

The number of the item in the dataset to use.

Example

cuando empezó
[Find the object index of the nearest Orange Pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
establecer de [object_counter v] a [1]
obtener [AI Classifications v] datos de [AIVision v]
[Iterate through all detected objects.]
repetir ([AIVision v] recuento de objetos)
Establecer el elemento de objeto [AIVision v] en (object_counter)
si <[AIVision v] object is [Orange Pin v] ?> entonces
imprimir (unirse [Nearest Orange Pin is ] (object_counter)) ▶
demás
cambiar [object_counter v] por [1]

Values#

object exists?#

The object exists? block returns a Boolean indicating whether any object is detected in the dataset.

  • True – The dataset includes a detected object.

  • False – The dataset does not include any detected objects.

The AI Vision object exists Boolean block.#
<¿Existe el objeto AI Vision?>

Parameters

Description

This block has no parameters.

Example

cuando empezó
[Raise the Lift until a Pin or Beam is detected.]
repetir hasta <¿Existe [AIVision v] objeto?>
obtener [AI Classifications v] datos de [AIVision v]
girar [LiftMotor v] [arriba v]
fin
parada [LiftMotor v]

object count#

The object count block returns the number of detected objects in the dataset as an integer.

The Set AI Vision object item stack block.#
([AIVision v] recuento de objetos)

Parameters

Description

This block has no parameters.

Example

cuando empezó
[Find the object index of the nearest Orange Pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
establecer de [object_counter v] a [1]
obtener [AI Classifications v] datos de [AIVision v]
[Iterate through all detected objects.]
repetir ([AIVision v] recuento de objetos)
Establecer el elemento de objeto [AIVision v] en (object_counter)
si <[AIVision v] object is [Orange Pin v] ?> entonces
imprimir (unirse [Nearest Orange Pin is ] (object_counter)) ▶
demás
cambiar [object_counter v] por [1]

object property#

There are six properties that are included with each object (shown below) stored after the get object data block is used.

The AI Vision object property reporter block.#
([AIVision v] objeto [amplitud v])

Some property values are based off of the detected object’s position in the IQ AI Vision Sensor’s view at the time that the get object data block was used. The IQ AI Vision Sensor has a resolution of 320 by 240 pixels.

Parameter

Description

property

Which property of the detected object to use:

width#

width returns the width of the detected object in pixels as an integer from 1 to 320.

The AI Vision object property stack block with its parameter set to width.#
([AIVision v] objeto [amplitud v])

Example

cuando empezó
[Place the Red Pin on the top left Blue Pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
girar [izquierda v] por [38] grado ▶
repetir hasta <([AIVision v] objeto [amplitud v]) [math_greater_than v] [48]>
[Move forward until the robot is close to the Pin.]
obtener [AI Classifications v] datos de [AIVision v]
unidad [adelante v]
fin
unidad [adelante v] para [160] [mm v] ▶
girar [ClawMotor v] [abierto v]
height#

height returns the height of the detected object in pixels as an integer from 1 to 240.

The AI Vision object property stack block with its parameter set to height.#
([AIVision v] objeto [altura v])

Example

cuando empezó
[Place the Red Pin on the top left Blue Pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
girar [izquierda v] por [38] grado ▶
repetir hasta <([AIVision v] objeto [altura v]) [math_greater_than v] [68]>
[Move forward until the robot is close to the Pin.]
obtener [AI Classifications v] datos de [AIVision v]
unidad [adelante v]
fin
unidad [adelante v] para [160] [mm v] ▶
girar [ClawMotor v] [abierto v]
centerX#

centerX returns the x-coordinate of the center of the detected object in pixels as an integer from 0 to 320.

The AI Vision object property stack block with its parameter set to centerX.#
([AIVision v] objeto [centroX v])

Example

cuando empezó
[Place the Red Pin on the bottom left Blue Pin.]
unidad [adelante v] para [50] [mm v] ▶
girar [LiftMotor v] [arriba v] por [450] [grados v] ▶
establecer la velocidad de giro a [10] [% v]
obtener [AI Classifications v] datos de [AIVision v]
repetir hasta <([AIVision v] objeto [centroX v]) [math_less_than v] [190]>
[Turn until the robot is centered on the Blue Pin.]
obtener [AI Classifications v] datos de [AIVision v]
turno [derecha v]
fin
unidad [adelante v] para [350] [mm v] ▶
girar [ClawMotor v] [abierto v]
centerY#

centerY returns the y-coordinate of the center of the detected object in pixels as an integer from 0 to 240.

The AI Vision object property stack block with its parameter set to centerY.#
([AIVision v] objeto [centroY v])

Example

cuando empezó
[Place the Red Pin on the top left Blue Pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
girar [izquierda v] por [38] grado ▶
repetir hasta <([AIVision v] objeto [centroY v]) [math_greater_than v] [210]>
[Move forward until the robot is close to the Pin.]
obtener [AI Classifications v] datos de [AIVision v]
unidad [adelante v]
fin
unidad [adelante v] para [160] [mm v] ▶
girar [ClawMotor v] [abierto v]
originX#

originX returns the x-coordinate of the top-left corner of the detected object’s bounding box in pixels as an integer from 0 to 320.

The AI Vision object property stack block with its parameter set to originX.#
([AIVision v] objeto [origenX v])

Example

cuando empezó
[Place the Red Pin on the bottom left Blue Pin.]
unidad [adelante v] para [50] [mm v] ▶
girar [LiftMotor v] [arriba v] por [450] [grados v] ▶
establecer la velocidad de giro a [10] [% v]
obtener [AI Classifications v] datos de [AIVision v]
repetir hasta <([AIVision v] objeto [centroX v]) [math_less_than v] [160]>
[Turn until the robot is centered on the Blue Pin.]
obtener [AI Classifications v] datos de [AIVision v]
turno [derecha v]
fin
unidad [adelante v] para [350] [mm v] ▶
girar [ClawMotor v] [abierto v]
originY#

originY returns the y-coordinate of the top-left corner of the detected object’s bounding box in pixels as an integer from 0 to 240.

The AI Vision object property stack block with its parameter set to originY.#
([AIVision v] objeto [origenY v])

Example

cuando empezó
[Place the Red Pin on the top left Blue Pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
girar [izquierda v] por [38] grado ▶
repetir hasta <([AIVision v] objeto [origenY v]) [math_greater_than v] [180]>
[Move forward until the robot is close to the Pin.]
obtener [AI Classifications v] datos de [AIVision v]
unidad [adelante v]
fin
unidad [adelante v] para [160] [mm v] ▶
girar [ClawMotor v] [abierto v]

AI Classification is#

The AI Vision object is? block returns a Boolean indicating whether a detected object matches a specific classification.

  • True – The item in the dataset is the specific object.

  • False – The item in the dataset is not the specific object.

The AI Vision AI Classification is object Boolean block.#
<[AIVision] object is [Beam v]?>

Parameter

Description

object

Which object to compare the item to:

  • Beam
  • Blue Pin
  • Red Pin
  • Orange Pin

Example

cuando empezó
[Find the object index of the nearest Orange Pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
establecer de [object_counter v] a [1]
obtener [AI Classifications v] datos de [AIVision v]
[Iterate through all detected objects.]
repetir ([AIVision v] recuento de objetos)
Establecer el elemento de objeto [AIVision v] en (object_counter)
si <[AIVision v] object is [Orange Pin v] ?> entonces
imprimir (unirse [Nearest Orange Pin is ] (object_counter)) ▶
demás
cambiar [object_counter v] por [1]

Sensing#

Optical#

Optical found object?#

The Optical found 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.

<[Optical v] Encontraste un objeto?>

Parameters

Description

This block has no parameters.

Example

cuando empezó
[Place a pin atop another pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]
esperar hasta <no <[Optical v] Encontraste un objeto?>>
girar [LiftMotor v] a la posición [0] [grados v] ▶

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.

<[Optical v] detecta [rojo v]?>

Parameters

Description

color

Which color to check for:

  • red
  • green
  • blue
  • yellow
  • orange
  • purple

Example

cuando empezó
[Place a pin atop another pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]
esperar hasta <no <[Optical v] detecta [rojo v]?>>
girar [LiftMotor v] a la posición [0] [grados v] ▶

Optical brightness#

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

([Optical v] brillo en %)

Parameters

Description

This block has no parameters.

Example

cuando empezó
[Place a pin atop another pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]
esperar hasta <[30] [math_greater_than v] ([Optical v] brillo en %)>
girar [LiftMotor v] a la posición [0] [grados v] ▶

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° at the top to 360°.

([Optical v] tono en grados)

Parameters

Description

This block has no parameters.

Example

cuando empezó
[Place a pin atop another pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]
esperar hasta <([Optical v] tono en grados) [math_greater_than v] [0]>
girar [LiftMotor v] a la posición [0] [grados v] ▶

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.

cuando [Optical v] [detects v] un objeto

Parameters

Description

action

Which action to trigger the hat block:

  • detects
  • loses

Example

cuando empezó
[Place a pin atop another pin.]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]
cuando [Optical v] [loses v] un objeto
[Lower the lift when the red pin is not in the claw.]
girar [LiftMotor v] a la posición [0] [grados v] ▶

Touch LED#

set TouchLED color#

The set TouchLED color block sets the color of the Touch LED.

establecer el color [TouchLED v] en [none v]

Parameters

Description

color

Sets the LED’s color to:

  • none – Turns off the Touch LED
  • red
  • green
  • blue
  • white
  • yellow
  • orange
  • purple
  • red violet
  • violet
  • blue violet
  • blue green
  • yellow green
  • yellow orange
  • red orange

Example

cuando empezó
[Place a pin atop another pin.]
establecer el color [TouchLED v] en [rojo v]
girar [LiftMotor v] [arriba v] por [600] [grados v] ▶
unidad [adelante v] para (140) [mm v] ▶
girar [ClawMotor v] [abierto v]
establecer el color [TouchLED v] en [none v]