Robot Specific Blocks#

All standard VEXcode VR Blocks are available for use in the V5RC Virtual Skills - High Stakes Playground.

Motion#

This Playground’s Blocks will have access to the Arm Motor and Pusher Motor parameters for all Motion blocks.

When selecting a direction for Motion blocks, up will spin the Arm forward and down spins the Arm in reverse.

For the Pusher Motor, lower will spin the Pusher Motor forward and raise spins the Pusher Motor in reverse.

Spin#

The Spin block is used to spin a motor indefinitely.

This is a non-waiting block and allows any subsequent blocks to execute without delay.

    spin [ArmMotor v] [up v]

Select which motor to use.

The image shows a block from a visual coding interface where the user is selecting a motor for a "spin" command. The selected motor is "ArmMotor," and the alternative option in the dropdown menu is "PusherMotor." The block is set to spin the "ArmMotor" in the "up" direction.

Select which direction for the motor to move in.

The Arm Motor can spin in the up or down directions.

The image shows a coding block from a visual programming interface, where the user is selecting the direction for a "spin" command. The selected motor is "ArmMotor," and the direction is set to "up," with an option to switch to "down" in the dropdown menu.

The Pusher Motor can spin in the lower or raise directions.

The image displays a visual coding block where the "spin" command is applied to the "PusherMotor." The direction for the spin is currently set to "lower," with an option in the dropdown menu to switch to "raise."

In this example, the Arm Motor will spin up for 1 second to move it in preparation to score.

    when started
    [Lift the Arm before moving to a Mobile Goal.]
    spin [ArmMotor v] [up v]
    wait (1) seconds
    stop [ArmMotor v]

Spin for#

The Spin for block is used to spin a motor for a given distance.

This is can be a non-waiting or waiting block depending on if the and don’t wait option is used.

  spin [ArmMotor v] [up v] for [90] [degrees v] ▶

Select which motor to use.

The image shows a block from a visual coding interface that is used to control a motor. In this specific block, the "ArmMotor" is selected from a dropdown menu and is set to spin "up" for a duration of "90 degrees." The dropdown menu is visible, offering an option to select "PusherMotor" instead of "ArmMotor."

Select which direction for the motor to move in.

The Arm Motor can spin in the up or down directions.

The image shows a visual coding block that is used to control a motor. In this block, the "ArmMotor" is selected, and the direction is set to "up" from a dropdown menu. The block specifies that the motor will spin "up" for "90 degrees." The dropdown menu is visible, offering the option to select "down" instead of "up."

The Pusher Motor can spin in the lower or raise directions.

The image shows a coding block that controls a motor labeled "PusherMotor." The block specifies that the motor should spin in the "lower" direction for 90 degrees. A dropdown menu is visible, allowing the user to select "lower" or "raise" as the direction.

Set how far the motor will spin by entering a value, and choosing the unit of measurement (degrees or turns).

The image shows a coding block used to control the "ArmMotor." The block is set to spin the motor in the "up" direction for 90 units, where the units can be selected from a dropdown menu that offers "degrees" or "turns" as options.

By default, the Spin for block will block any subsequent blocks from executing until it’s finished. By expanding the Spin for block to show and don’t wait, blocks will continue to execute while the motor is moving.

  spin [ArmMotor v] [up v] for [90] [degrees v] ◀ and don't wait

In this example, the Arm Motor will spin up by 350 degrees to not block the AI Vision Sensor.

  when started
  [Lift the Arm to not block the AI Vision Sensor.]
  spin [ArmMotor v] [up v] for [200] [degrees v] ▶

Spin to position#

The Spin to position block is used to spin a motor to a set position.

This is can be a non-waiting or waiting block depending on if the and don’t wait option is used.

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

Select which motor to use.

The image displays a coding block where the "ArmMotor" is selected to spin to a specific position of 90 degrees. There's an option to select between "ArmMotor" and "PusherMotor" for this action.

Set how far the motor will spin by entering a value, and choosing the unit of measurement (degrees or turns).

The image shows a coding block where the "ArmMotor" is set to spin to a position of 90 units. The units can be selected between "degrees" and "turns," with "degrees" currently selected.

By default, the Spin to position block will block any subsequent blocks from executing until it’s finished. By expanding the Spin to position block to show and don’t wait, blocks will continue to execute while the motor is moving.

  spin [ArmMotor v] to position [90] [degrees v] ◀ and don't wait

In this example, the Arm Motor will spin to the 350 degrees position to not block the AI Vision Sensor.

  when started
  [Lift the Arm to not block the AI Vision Sensor]
  spin [ArmMotor v] to position [350] [degrees v] ▶

Stop Motor#

The Stop Motor block is used to stop the motor from moving.

This is a non-waiting block and allows any subsequent blocks to execute without delay.

  stop [ArmMotor v]

Select which motor to use.

The image shows a coding block where the user can select between "ArmMotor" and "PusherMotor" to stop the selected motor.

In this example, the Arm Motor will spin up for 1 second to move it in preparation to score.

  when started
  [Lift the Arm before moving to a Mobile Goal.]
  spin [ArmMotor v] [up v]
  wait (1) seconds
  stop [ArmMotor v]

Set Motor position#

The Set Motor position block is used to set a motor’s encoder position(s) to the entered value.

This is a non-waiting block and allows any subsequent blocks to execute without delay.

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

Select which motor to use.

The image shows a coding block that sets the position of the "ArmMotor" to 0 degrees. The dropdown menu is expanded, displaying two options: "ArmMotor" and "PusherMotor." The "ArmMotor" is currently selected, indicating that the position command will apply to this specific motor.

Set the unit of measurement to use, degrees or turns.

The image shows a coding block where the position of the "ArmMotor" is set to 0, with the unit of measurement being selected from a dropdown menu. The dropdown menu is currently expanded, showing two options: "degrees" and "turns." The "degrees" option is selected, indicating that the position command will be executed in degrees.

In this example, the Arm is raised to the 350 degrees position, and sets that as its new 0 degrees position.

  when started
  [Make the raised Arm position the new 0 degrees position.]
  spin [ArmMotor v] to position [350] [degrees v] ▶
  set [ArmMotor v] position to [0] [degrees v]

Set Motor velocity#

The Set Motor velocity block is used to set the speed of a motor.

This is a non-waiting block and allows any subsequent blocks to execute without delay.

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

Select which motor to use.

The image shows a coding block that sets the velocity of the "ArmMotor" to 50%. The dropdown menu is open, showing options to select either "ArmMotor" or "PusherMotor" for the velocity setting. The "ArmMotor" is currently selected.

The Set Motor velocity block will accept a range of -100% to 100%.

In this example, the Motor’s velocity is set to 100% before the Arm raises.

  when started
  [Raise Arm to not block the AI Vision Sensor.]
  set [ArmMotor v] velocity to [100] [% v]
  spin [ArmMotor v] [up v] for [350] [degrees v] ▶

Set Motor timeout#

The Set Motor timeout block is used to set a time limit for Motor movement blocks.

This prevents Motion blocks that do not reach their intended position from preventing subsequent blocks from running.

This is a non-waiting command and allows any subsequent commands to execute without delay.

  set [ArmMotor v] timeout to [1] seconds

Select which motor to use.

The image shows a coding block where the user can set the timeout for a motor. In this case, the "ArmMotor" is selected from a dropdown menu, with an option to switch to "PusherMotor" if desired. The timeout is set to 1 second, meaning the selected motor will stop running after 1 second, regardless of its current task.

In this example, the motor timeout is set to 1 second before the Arm raises.

  when started
  [Raise Arm to not block the AI Vision Sensor.]
  set [ArmMotor v] timeout to [1] seconds
  spin [ArmMotor v] [up v] for [5] [turns v] ▶

Sensing#

Axel has access to the standard Brain, Drivetrain, Bumper, Distance Sensing Blocks.

Eye Sensing has been renamed to Optical Sensing to match the Front Optical Sensor.

Motor Sensing#

Motor is done#

The Motor is done block is used to report if the selected Motor or Motor Group has completed its movement.

  <[ArmMotor v] is done?>

Select which Motor or Motor Group to use.

The image shows a block labeled "ArmMotor is done?" with a dropdown menu selecting the motor. The dropdown currently shows "ArmMotor" selected, but it also allows the user to choose "PusherMotor." This block is used to check if the selected motor, either the "ArmMotor" or "PusherMotor," has completed its action, such as reaching a specified position or finishing a rotation.

The Motor is done block reports True when the selected Motor or Motor Group has completed its movement.

The Motor is done block reports False when the selected Motor or Motor Group has not completed its movement.

The Motor is done block is used in blocks with hexagonal (six-sided) spaces.

Motor is spinning#

The Motor is spinning block is used to report if the selected Motor or Motor Group is moving.

  <[ArmMotor v] is spinning?>

Select which Motor or Motor Group to use.

The image shows a block labeled "ArmMotor is spinning?" with a dropdown menu currently expanded. The dropdown menu allows you to choose between "ArmMotor" and "PusherMotor," with "ArmMotor" currently selected. This block is used to check whether the selected motor, in this case, the "ArmMotor," is currently spinning.

The Motor is spinning block reports True when the selected Motor or Motor Group is moving.

The Motor is spinning block reports False when the selected Motor or Motor Group is not moving.

The Motor is spinning block is used in blocks with hexagonal (six-sided) spaces.

Position of motor#

The Position of motor block is used to report the position of a Motor or the first motor in a Motor Group.

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

Select which Motor or Motor Group to use.

The image shows the "ArmMotor position in degrees" block with a dropdown menu that allows you to select between different motors. The "ArmMotor" is currently selected, with "PusherMotor" as another available option.

Select when unit to use, degrees or turns.

The image displays the "ArmMotor position in degrees" block, with a dropdown menu currently showing "degrees" as the selected unit. The dropdown offers an additional option to measure the position in "turns."

The Position of motor block is used in blocks with circular spaces.

In this example, the Arm will raise until its position is greater than 300 degrees.

  when started
  [Raise Arm to not block the AI Vision Sensor.]
  spin [ArmMotor v] [up v]
  wait until <([ArmMotor v] position in [degrees v]) [math_greater_than v] [300]>
  stop [ArmMotor v]

Velocity of motor#

The Velocity of motor block is used to report the current velocity of a Motor or the first motor in a Motor Group.

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

Select which Motor or Motor Group to use.

The image displays a block from a block-based coding interface where the user can select a motor to retrieve its velocity in percentage. The dropdown menu is currently expanded, showing the options to select either "ArmMotor" or "PusherMotor." The "ArmMotor" is selected, and the unit of velocity is set to percentage ("%").

The Velocity of motor block is used in blocks with circular spaces.

Rotation Sensing#

Set Rotation Position#

The Set Rotation Position block is used to set the Pusher Motor’s current rotation position to a new value.

  set [PusherRotation v] position to [0] degrees

In this example, the rotation that will pushes the Ring off the Arm will be set to 0 degrees.

  when started
  [Make lower Pusher position the new 0 degrees rotation position.]
  spin [PusherMotor v] [lower v] for [270] [degrees v] ▶
  set [PusherRotation v] position to [0] degrees

Rotation Angle#

The Rotation Angle block is used to report the Pusher Motor’s current rotation angle in degrees.

  ([PusherRotation v] angle in degrees)

In this example, the Pusher will push the Ring off the Arm, and then report the rotation angle of the motors.

  when started
  [Make lower Pusher position the new 0 degrees rotation position.]
  spin [PusherMotor v] [lower v] for [270] [degrees v] ▶
  print ([PusherRotation v] angle in degrees) ▶

Rotation Position#

The Rotation Position block is used to report the Pusher Motor’s current position.

  ([PusherRotation v] position in [degrees v] :: custom-sensing)

Select which unit to report in, degrees or turns.

The image displays a coding block where the "PusherRotation" component's position can be checked in either "degrees" or "turns." The dropdown menu is currently set to "degrees," but it also offers the option to switch to "turns" as a unit of measurement.

In this example, the Pusher will push the Ring off the Arm, and then report the position of the motors in degrees.

  when started
  [Make lower Pusher position the new 0 degrees rotation position.]
  spin [PusherMotor v] [lower v] for [270] [degrees v] ▶
  print ([PusherRotation v] position in [degrees v] :: custom-sensing) ▶

GPS Sensing#

GPS position#

The GPS position block uses the GPS (Game Positioning System™) Sensor to report the positional offset of the robot’s turning reference point from the center of a field.

  ([PusherRotation v] position [X v] in [mm v])

Select either the X or Y axis to report.

The image shows a coding block that allows the user to select between the X and Y coordinates for retrieving the position from a GPS sensor. The selected option in the dropdown menu is "X," but "Y" is also available as an alternative.

Select what unit to report the offset value in, millimeters (MM) or inches.

The image displays a coding block that allows the user to select between units of measurement for the GPS position, specifically between millimeters (mm) and inches. The current selection in the dropdown menu is "mm," indicating that the position will be measured in millimeters.

GPS heading#

The GPS heading block uses the GPS (Game Positioning System™) Sensor to report the heading that a robot is currently facing based on a GPS Sensor’s readings from the VEX GPS Field Code.

GPS heading reports a range from 0.00 to 359.99 degrees.

  ([GPS v] heading in degrees)

AI Vision Sensing#

Take Snapshot#

The Take snapshot block will capture the current image from the AI Vision Sensor to be processed and analyzed for AI Classifications.

AI Classifications are Mobile Goals, Red Rings, and Blue Rings.

    take a [AIVision v] snapshot of [AI Classifications v]

All subsequent AI Vision Sensor blocks rely on data from the most recent snapshot taken. To ensure you’re working with the most up-to-date information, it’s important to take new snapshots regularly. Each new snapshot refreshes the data available to all AI Vision Sensor blocks, allowing them to process the latest visual information from the sensor’s environment.

Before attempting to access data stored from the last snapshot, you should always check if AI Classifications were detected. To do this:

  1. Wrap your AI Vision blocks after a Take Snapshot with an If block.

  2. Use the Object exists? block as the condition for the If block.

  3. This will check if an AI Classification was detected before attempting to pull any data from the last taken snapshot.

In this example a snapshot is taken and the largest detected AI Classification’s width and height are printed to the Print Console.

  • By default, objects are indexed by size, with the largest object at index 1.

  • The AI Vision Sensor automatically selects the largest object (index 1) after a snapshot.

    when started
    [Spin the Arm Motor up so that the AI Vision Sensor is not blocked.]
    spin [ArmMotor v] [up v] for [270] [degrees v] ▶
    take a [AIVision v] snapshot of [AI Classifications v]
    [Check if any AI Classifications were detected in the last snapshot.]
    if <[AIVision v] object exists?> then
    [Only if an AI Classification is detected, then print data from the largest AI Classification.]
    print [Largest object's width:] ▶
    print ([AIVision v] object [width v]) ◀ and set cursor to next row
    end

AI Classification is#

The AI Classification is block will report if the specified AI Classification has been detected.

  <[AIVision v] AI Classification is [MobileGoal v]?>

Choose what AI Classification to detect in the last snapshot.

The block in the image reads: "AI Vision AI Classification is MobileGoal?" The dropdown menu next to "MobileGoal" is open, showing options to select "MobileGoal," "RedRing," or "BlueRing."

Before attempting to access data stored from the last snapshot, you should always check if AI Classifications were detected. To do this:

  1. Wrap your AI Vision blocks after a Take Snapshot with an If block.

  2. Use the Object exists? block as the condition for the If block.

  3. This will check if an AI Classification was detected before attempting to pull any data from the last taken snapshot.

In this example, after a snapshot is taken, the code will check if any Mobile Goals were detected.

    when started
    [Spin the Arm Motor up so that the AI Vision Sensor is not blocked.]
    spin [ArmMotor v] [up v] for [270] [degrees v] ▶
    take a [AIVision v] snapshot of [AI Classifications v]
    [Check if any AI Classifications were detected in the last snapshot.]
    if <[AIVision v] object exists?> then
    [If any AI Classification is detected, check if any of them are a Mobile Goal.]
    if <[AIVision v] AI Classification is [MobileGoal v]?> then
    print [Mobile Goal is detected.] ▶
    else
    print [Mobile Goal is not detected.] ▶
    end
    end

Set Object Item#

The Set Object Item block will set the object item (of the object you want to learn more information about) from the objects detected. By default, the Object item is set to 1 at the start of a project.

  set [AIVision v] object item to [1]

Before attempting to access data stored from the last snapshot, you should always check if AI Classifications were detected. To do this:

  1. Wrap your AI Vision blocks after a Take Snapshot with an If block.

  2. Use the Object exists? block as the condition for the If block.

  3. This will check if an AI Classification was detected before attempting to pull any data from the last taken snapshot.

In this example, after a snapshot is taken, the current object index is set to the second-largest detected object and its height is printed to the Print Console.

    when started
    [Spin the Arm Motor up so that the AI Vision Sensor is not blocked.]
    spin [ArmMotor v] [up v] for [270] [degrees v] ▶
    take a [AIVision v] snapshot of [AI Classifications v]
    [Check if any AI Classifications were detected in the last snapshot.]
    if <[AIVision v] object exists?> then
    [Print the second-largest object's height.]
    set [AIVision v] object item to [2]
    print ([AIVision v] object [height v]) ◀ and set cursor to next row
    end

Object Count#

The Object Count block will set the object item (of the object you want to learn more information about) from the objects detected. By default, the Object item is set to 1 at the start of a project.

  ([AIVision v] object count)

Before attempting to access data stored from the last snapshot, you should always check if AI Classifications were detected. To do this:

  1. Wrap your AI Vision blocks after a Take Snapshot with an If block.

  2. Use the Object exists? block as the condition for the If block.

  3. This will check if an AI Classification was detected before attempting to pull any data from the last taken snapshot.

In this example, the code will check if an AI Classification is detected after a snapshot, and if any are detected, will print how many AI Classifications were detected.

    when started
    [Spin the Arm Motor up so that the AI Vision Sensor is not blocked.]
    spin [ArmMotor v] [up v] for [270] [degrees v] ▶
    take a [AIVision v] snapshot of [AI Classifications v]
    [Check if any AI Classifications were detected in the last snapshot.]
    if <[AIVision v] object exists?> then
    print ([AIVision v] object count) ◀ and set cursor to next row
    end

Object Exists#

The Object Exists block will report if the AI Vision Sensor detects an AI Classification.

  <[AIVision v] object exists?>

Before attempting to access data stored from the last snapshot, you should always check if AI Classifications were detected. To do this:

  1. Wrap your AI Vision blocks after a Take Snapshot with an If block.

  2. Use the Object exists? block as the condition for the If block.

  3. This will check if an AI Classification was detected before attempting to pull any data from the last taken snapshot.

In this example, the code will check if an AI Classification is detected after a snapshot, and if any are detected, will print how many AI Classifications were detected.

    when started
    [Spin the Arm Motor up so that the AI Vision Sensor is not blocked.]
    spin [ArmMotor v] [up v] for [270] [degrees v] ▶
    take a [AIVision v] snapshot of [AI Classifications v]
    [Check if any AI Classifications were detected in the last snapshot.]
    if <[AIVision v] object exists?> then
    print ([AIVision v] object count) ◀ and set cursor to next row
    end

AI Vision Object#

The AI Vision Object block will report information about an AI Classification from the last use of the Take Snapshot block.

  ([AIVision v] object [width v])

Choose what property to report about the AI Classification:

  • width: How wide the AI Classification is in pixels.

  • height: How tall the AI Classification is in pixels.

  • centerX: The X coordinate at the exact center of the AI Classification.

  • centerY: The Y coordinate at the exact center of the AI Classification.

  • originX: The X coordinate at the top-left corner of the AI Classification.

  • originY: The Y coordinate at the top-left corner of the AI Classification.

The image shows a set of rounded blue buttons labeled "AIVision," "object," and "width" aligned horizontally at the top. Below the "width" button, a dropdown menu is expanded, displaying a list of options that includes "width" (which is selected), "height," "centerX," "centerY," "originX," and "originY."

Before attempting to access data stored from the last snapshot, you should always check if AI Classifications were detected. To do this:

  1. Wrap your AI Vision blocks after a Take Snapshot with an If block.

  2. Use the Object exists? block as the condition for the If block.

  3. This will check if an AI Classification was detected before attempting to pull any data from the last taken snapshot.

    when started
    [Spin the Arm Motor up so that the AI Vision Sensor is not blocked.]
    spin [ArmMotor v] [up v] for [270] [degrees v] ▶
    take a [AIVision v] snapshot of [AI Classifications v]
    [Check if any AI Classifications were detected in the last snapshot.]
    if <[AIVision v] object exists?> then
    [Only if an AI Classification is detected, then print data from the largest AI Classification.]
    print [Largest object's width:] ▶
    print ([AIVision v] object [width v]) ◀ and set cursor to next row
    end