Macro#

Introduction#

The VEX AIM Coding Robot includes prebuilt actions, or macros, that combine multiple behaviors into a single block. These macros allow the robot to perform complex tasks such as moving toward objects, detecting objects, and acting out emotions. Below is a list of all available blocks:

  • act – Makes the robot display a specific emotion such as happy, sad, or excited.

  • turn until object – Rotates the robot until the AI Vision Sensor detects a specified object.

  • move to object – Moves the robot toward a detected object.

  • get object – Moves the robot to collect a detected object.

act#

The Act block makes the robot act out a specific emotion.

act stack block#
    act [happy v]

Parameters

Description

emotions

Makes the robot act in one of the following ways:

  • happy
  • sad
  • silly
  • angry
  • excited

Example

When started, act happy#
    when started :: hat events
    [React to kicking a sports ball.]
    kick object [medium v]
    act [happy v]

turn until object#

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

Note: If the robot appears to be having difficulties with detecting objects, try lowering the robot’s turn velocity with the set turn velocity block.

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

Parameters

Description

direction

Turn the robot:

  • left
  • right

objects

Turn until this object is found:

  • 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, turn left until ball is detected#
    when started :: hat events
    [Turn left until orange barrel is detected.]
    turn [left v] until [orange barrel v] found

get object#

The get object block makes the robot move to collect an object using AI Vision Sensor.

Note: If the robot appears to be having difficulties with detecting objects, try lowering the robot’s move and turn velocities with the set move velocity and set turn velocity blocks.

get ball stack block#
    get [sports ball v]

Parameters

Description

objects

Move to this object:

  • sports ball
  • orange barrel
  • blue barrel

Example

When started, get ball#
    when started :: hat events
    [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 block makes the robot move towards an object using AI Vision Sensor.

Note: If the robot appears to be having difficulties with detecting objects, try lowering the robot’s move and turn velocities with the set move velocity and set turn velocity blocks.

move to block#
    move to [AIM robot v]

Parameters

Description

objects

Move to this object:

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

Example

When started, move to sports ball#
    when started :: hat events
    [Approach the closest AIM Robot.]
    turn [right v] until [AIM robot v] found
    move to [AIM robot v]