6-Axis Arm#

Introduction#

The VEX 6-Axis Robotic Arm allows programs to move an end effector in three-dimensional space and control its orientation using yaw, roll, and pitch rotations. The 6-Axis Arm can also be configured with different end effectors, such as the Magnet Pickup Tool or Pen Holder Tool.

Below is a list of all available methods:

Actions – Move the 6-Axis Arm to positions or orientations in 3D space.

  • move_to – Moves the end effector to an absolute X, Y, Z position.

  • move_inc – Moves the end effector by a relative X, Y, Z distance.

  • move_end_effector_to – Rotates the end effector to an absolute yaw, roll, and pitch orientation.

  • move_end_effector_inc – Rotates the end effector by a relative yaw, roll, and pitch amount.

Mutators – Configure the 6-Axis Arm’s behavior, tools, and motion settings.

Getters – Return 6-Axis Arm motion status, position, orientation, and configuration values.

  • is_done – Returns whether the arm has completed its movement.

  • get_x – Returns the current X position of the end effector.

  • get_y – Returns the current Y position of the end effector.

  • get_z – Returns the current Z position of the end effector.

  • get_pitch – Returns the current pitch orientation of the end effector.

  • get_roll – Returns the current roll orientation of the end effector.

  • get_yaw – Returns the current yaw orientation of the end effector.

  • can_arm_reach_to – Returns whether the arm can reach an absolute position.

  • can_arm_reach_inc – Returns whether the arm can reach a relative position.

  • can_end_effector_reach_to – Returns whether the arm can reach an absolute orientation.

  • can_end_effector_reach_inc – Returns whether the arm can reach a relative orientation.

  • control_stopped – Registers a function to run when the arm enters control stop.

  • get_timeout – Returns the current timeout value used by arm movement methods.

  • is_connected – Returns whether the arm is connected to the Brain.

Constructors – Manually initialize and configure the 6-Axis Arm.

  • Arm – Create a 6-Axis Arm.

Actions#

move_to#

move_to moves the 6-Axis Arm to a specified x, y, and z coordinate.

This method returns a Boolean indicating whether the 6-Axis Arm has reached the requested position:

  • True — The 6-Axis Arm has reached the requested position.

  • False — The 6-Axis Arm cannot reach the requested position.

Usage:
arm.move_to(x, y, z, wait)

Parameter

Descripción

x

The x-coordinate of the target position in millimeters.

y

The y-coordinate of the target position in millimeters.

z

The z-coordinate of the target position in millimeters.

wait

Optional.

  • wait=True (default) – The project waits until move_to is complete before executing the next line of code.
  • wait=False – The project starts the action and moves on to the next line of code immediately without waiting for move_to to finish.

# Move the Arm to (40, 140, 210)
arm.move_to(40, 140, 210)

move_inc#

move_inc moves the 6-Axis Arm by a specified distance along the x, y, and z axes.

This method will return a Boolean indicating whether the 6-Axis Arm has reached the requested position:

  • True — The 6-Axis Arm has reached the requested position.

  • False — The 6-Axis Arm cannot reach the requested position.

Usage:
arm.move_inc(x, y, z, wait)

Parameter

Descripción

x

The distance to move along the x-axis in millimeters.

y

The distance to move along the y-axis in millimeters.

z

The distance to move along the z-axis in millimeters.

wait

Optional.

  • wait=True (default) – The project waits until move_inc is complete before executing the next line of code.
  • wait=False – The project starts the action and moves on to the next line of code right away, without waiting for move_inc to finish.

# Move the Arm +100 millimeters on the y-axis
arm.move_inc(0, 100, 0)

move_end_effector_to#

move_end_effector_to rotates the 6-Axis Arm’s end effector to a specified yaw, roll, and pitch orientation.

This method returns a Boolean indicating whether the end effector has reached the requested orientation:

  • True — The end effector has reached the requested orientation.

  • False — The end effector cannot reach the requested orientation.

Usage:
arm.move_end_effector_to(yaw, roll, pitch, wait)

Parameter

Descripción

yaw

The angle around the z-axis that the end effector should point to, in degrees.

roll

The angle around the x-axis that the end effector should point to, in degrees.

pitch

The angle around the y-axis that the end effector should point to, in degrees.

wait

Optional.

  • wait=True (default) – The project waits until move_end_effector_to is complete before executing the next line of code.
  • wait=False – The project starts the action and moves on to the next line of code right away, without waiting for move_end_effector_to to finish.

# Orient the end effector to point towards
# 90 degrees around the x-axis
arm.move_end_effector_to(0, 90, 0)

move_end_effector_inc#

move_end_effector_inc rotates the 6-Axis Arm’s end effector by a specified relative yaw, roll, and pitch amount.

This method returns a Boolean indicating whether the end effector has reached the requested orientation:

  • True — The end effector has reached the requested orientation.

  • False — The end effector cannot reach the requested orientation.

Usage:
arm.move_end_effector_inc(yaw, roll, pitch, wait)

Parameter

Descripción

yaw

The change in angle around the z-axis, in degrees.

roll

The change in angle around the x-axis, in degrees.

pitch

The change in angle around the y-axis, in degrees.

wait

Optional.

  • wait=True (default) – The project waits until move_end_effector_inc is complete before executing the next line of code.
  • wait=False – The project starts the action and moves on to the next line of code right away, without waiting for move_end_effector_inc to finish.

# Rotate the end effector -50 degrees around the y-axis
arm.move_end_effector_inc(0, 0, -50)

Mutators#

set_speed#

set_speed sets the movement speed used by the 6-Axis Arm for motion commands.

Usage:
arm.set_speed(speed)

Parameter

Descripción

speed

The speed at which the 6-Axis Arm should move, expressed as a percentage from 1 to 100.

# Set the Arm speed to 30%
arm.set_speed(30)

set_end_effector_type#

set_end_effector_type sets the type of end effector attached to the 6-Axis Arm.

Usage:
arm.set_end_effector_type(type)

Parameter

Descripción

type

A valid end effector type:

  • MAGNET — Magnet Pickup Tool
  • PEN — Pen Holder Tool

# Set the end effector type to the Magnet Pickup Tool
arm.set_end_effector_type(MAGNET)

set_end_effector_magnet#

set_end_effector_magnet sets the state of the Magnet Pickup Tool on the 6-Axis Arm.

Usage:
arm.set_end_effector_magnet(state)

Parameter

Descripción

estado

The state of the Magnet Pickup Tool:

  • True — The magnet will pick up and hold objects.
  • False — The magnet will drop and no longer pick up objects.

# Pick up objects and then drop them
arm.set_end_effector_type(MAGNET)
arm.set_end_effector_magnet(True)
arm.move_inc(0, 0, 100)
arm.set_end_effector_magnet(False)

set_pen_offset#

set_pen_offset sets the z-axis offset used when the Pen Holder Tool is attached to the 6-Axis Arm.

Usage:
arm.set_pen_offset(zOffset)

Parameter

Descripción

zOffset

The pen offset value in millimeters. A positive value moves the offset upward from the tool mount point.

set_control_stop#

set_control_stop enables the control stop for the 6-Axis Arm.

Usage:
arm.set_control_stop(state)

Parameter

Descripción

estado

Optional.

  • True (default) – Enables control stop and prevents further linear or joint movements.
  • False – Does not enable control stop.

set_timeout#

set_timeout sets the timeout value used when moving the 6-Axis Arm.

Usage:
arm.set_timeout(timeout, units)

Parameter

Descripción

timeout

The new timeout value.

units

The unit to represent the time:

  • MSEC (default) — milliseconds
  • SECONDS / SEC — seconds

Getters#

is_done#

is_done returns a Boolean indicating whether the 6-Axis Arm is currently moving.

  • True — The 6-Axis Arm is not moving.

  • False — The 6-Axis Arm is still moving.

Usage:
arm.is_done()

def main():
    # Display the arm's position while it moves
    arm.move_to(-100, 200, 100, False)
    while not arm.is_done():
        brain.print(arm.get_y())
        brain.next_line()
        wait(0.25, SECONDS)

get_x#

get_x returns the x position of the end effector in millimeters.

Usage:
arm.get_x()

def main():
    # Print the current x position of the Arm in millimeters
    brain.print(arm.get_x())

get_y#

get_y returns the y position of the end effector in millimeters.

Usage:
arm.get_y()

def main():
    # Print the current y position of the Arm in millimeters
    brain.print(arm.get_y())

get_z#

get_z returns the z position of the end effector in in millimeters.

Usage:
arm.get_z()

def main():
    # Print the current z position of the Arm in millimeters
    brain.print(arm.get_z())

get_pitch#

get_pitch returns the current pitch of the end effector in degrees.

Usage:
arm.get_pitch()

def main():
    # Print the current pitch of the Arm in degrees.
    brain.print(arm.get_pitch())

get_roll#

get_roll returns the current roll of the end effector in degrees.

Usage:
arm.get_roll()

def main():
    # Print the current roll of the Arm in degrees.
    brain.print(arm.get_roll())

get_yaw#

get_yaw returns the current yaw of the end effector in degrees.

Usage:
arm.get_yaw()

def main():
    # Print the current yaw of the Arm in degrees.
    brain.print(arm.get_yaw())

can_arm_reach_to#

can_arm_reach_to returns a Boolean indicating whether the 6-Axis Arm can move the end effector to a specified x, y, and z coordinate.

  • True — The 6-Axis Arm can reach the requested position.

  • False — The 6-Axis Arm cannot reach the requested position.

Usage:
arm.can_arm_reach_to(x, y, z)

Parameter

Descripción

x

The x-coordinate of the target position in millimeters.

y

The y-coordinate of the target position in millimeters.

z

The z-coordinate of the target position in millimeters.

# Move the Arm to (100, -20, 50) if it can reach
if arm.can_arm_reach_to(100, -20, 50):
    arm.move_to(100, -20, 50)

can_arm_reach_inc#

can_arm_reach_inc returns a Boolean indicating whether the 6-Axis Arm can move the end effector by a specified relative x, y, and z distance.

  • True — The 6-Axis Arm can reach the requested position.

  • False — The 6-Axis Arm cannot reach the requested position.

Usage:
arm.can_arm_reach_inc(x, y, z)

Parameter

Descripción

x

The distance to move along the x-axis in millimeters.

y

The distance to move along the y-axis in millimeters.

z

The distance to move along the z-axis in millimeters.

# Increment the Arm +100 mm along the x-axis if possible
if arm.can_arm_reach_inc(100, 0, 0):
    arm.move_inc(100, 0, 0)

can_end_effector_reach_to#

can_end_effector_reach_to returns a Boolean indicating whether the 6-Axis Arm can move the end effector to a specified yaw, roll, and pitch orientation.

  • True — The end effector can reach the requested orientation.

  • False — The end effector cannot reach the requested orientation.

Usage:
arm.can_end_effector_reach_to(yaw, roll, pitch)

Parameter

Descripción

yaw

The angle around the z-axis that the end effector should point to, in degrees.

roll

The angle around the x-axis that the end effector should point to, in degrees.

pitch

The angle around the y-axis that the end effector should point to, in degrees.

# Orient towards 90 degrees on the x-axis if possible
if arm.can_end_effector_reach_to(0, 90, 0):
    arm.move_end_effector_to(0, 90, 0)

can_end_effector_reach_inc#

can_end_effector_reach_inc returns a Boolean indicating whether the 6-Axis Arm can move the end effector by a specified relative yaw, roll, and pitch amount.

  • True — The end effector can reach the requested orientation.

  • False — The end effector cannot reach the requested orientation.

Usage:
arm.can_end_effector_reach_inc(yaw, roll, pitch)

Parameter

Descripción

yaw

The change in angle around the z-axis, in degrees.

roll

The change in angle around the x-axis, in degrees.

pitch

The change in angle around the y-axis, in degrees.

# Increment the end effector by 
# +10 degrees on the y-axis if possible
if arm.can_end_effector_reach_inc(0, 0, 10):
    arm.move_end_effector_inc(0, 0, 10)

control_stopped#

control_stopped registers a function that will be called when the control stop is enabled.

This method returns an instance of the Event class.

Usage:
arm.control_stopped(callback, arg)

Parámetros

Descripción

callback

A previously defined function that executes when the control stop is enabled.

arg

Optional. A tuple containing arguments to pass to the callback function. See Using Functions with Parameters for more information.

# Define a function when_control_stopped
def when_control_stopped():
    # Print to the Brain's screen that the Arm has been
    # control stopped.
    brain.print("The arm has been control stopped")

# Run when_control_stopped when the Arm is control stopped.
arm.control_stopped(when_control_stopped)

get_timeout#

get_timeout returns the timeout value used by the 6-Axis Arm move methods in milliseconds.

Usage:
arm.get_timeout()

is_connected#

is_connected returns a Boolean indicating whether the 6-Axis Arm is connected to the Brain.

  • True — The Arm is connected to the Brain.

  • False — The Arm is not connected to the Brain.

Usage:
arm.is_connected()

Constructors#

Arm#

Arm create a 6-Axis Arm.

Arm()

Parameter

Descripción

This constructor has no parameters.

# Construct a 6-Axis Arm "arm" with the
# Arm class
arm = Arm()