Macro#

Introduction#

The VEX AIM Coding Robot includes macros, which are prebuilt actions that combine multiple robot behaviors into one block. Macros can make the robot act out emotions, turn until an object is detected, or move toward objects detected by the AI Vision Sensor.

Below is a list of all blocks:

Actions — Run prebuilt robot behaviors.

  • act — Makes the robot act out a selected emotion.

  • turn until object — Turns the robot until the AI Vision Sensor detects a selected object.

  • get object — Moves the robot to collect a selected object.

  • move to object — Moves the robot toward a selected object.

Actions#

act#

The act stack block makes the robot perform a selected emotion using movements, sounds, emojis, and LEDs.

act stack block#
    act [happy v]

Parameter

Description

emotions

The emotion for the robot to act out:

  • happy
  • sad
  • silly
  • angry
  • excited

Example

When started, kicks an object, then acts happy.#
    when started
    [React to kicking a sports ball.]
    kick object [medium v]
    act [happy v]

turn until object#

The turn until object stack block turns the robot until the AI Vision Sensor detects an object.

Note: If the robot has difficulty detecting objects, try lowering the robot’s turn velocity with the set turn velocity block.

turn until object stack block#
    turn [right v] until [sports ball v] found

Parameter

Description

direction

The direction for the robot to turn:

  • left
  • right

objects

The object for the AI Vision Sensor to detect:

  • sports ball
  • orange barrel
  • blue barrel
  • AIM robot
  • AprilTag ID 0
  • AprilTag ID 1
  • AprilTag ID 2
  • AprilTag ID 3
  • AprilTag ID 4

Example

When started, turns left until an orange barrel is detected.#
    when started
    [Turn left until an orange barrel is detected.]
    turn [left v] until [orange barrel v] found

get object#

The get object stack block drives the robot toward a detected object until it attaches to the robot’s magnet.

Note: AprilTag IDs cannot be selected because they do not have magnets.

Note: If the robot has difficulty detecting objects, try lowering the robot’s move and turn velocities with the set move velocity and set turn velocity blocks.

get object stack block#
    get [sports ball v]

Parameter

Description

objects

The object for the robot to collect:

  • sports ball
  • orange barrel
  • blue barrel

Example

When started, finds and kicks a sports ball.#
    when started
    [Find and kick a sports ball.]
    turn [right v] until [sports ball v] found
    get [sports ball v]
    kick object [medium v]

move to object#

The move to object stack block moves the robot toward an object detected by the AI Vision Sensor.

Note: If the robot has difficulty detecting objects, try lowering the robot’s move and turn velocities with the set move velocity and set turn velocity blocks.

move to object stack block#
    move to [AIM robot v]

Parameter

Description

objects

The object for the robot to move toward:

  • AIM robot
  • AprilTag ID 0
  • AprilTag ID 1
  • AprilTag ID 2
  • AprilTag ID 3
  • AprilTag ID 4

Example

When started, approaches the closest AIM Robot.#
    when started
    [Approach the closest AIM Robot.]
    turn [right v] until [AIM robot v] found
    move to [AIM robot v]