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 [happy v]
Parameters |
Description |
---|---|
emotions |
Makes the robot act in one of the following ways:
|
Example
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 [right v] until [sports ball v] found
Parameters |
Description |
---|---|
direction |
Turn the robot:
|
objects |
Turn until this object is found:
|
Example
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 [sports ball v]
Parameters |
Description |
---|---|
objects |
Move to this object:
|
Example
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 [AIM robot v]
Parameters |
Description |
---|---|
objects |
Move to this object:
|
Example
when started :: hat events
[Approach the closest AIM Robot.]
turn [right v] until [AIM robot v] found
move to [AIM robot v]