Arm#

Initializing the Arm Class#

A 6-Axis Arm is created by using the following constructor:

Arm(port)

This constructor use one parameter:

Parameter

Description

port

A valid Smart Port that the 6-Axis Arm is connected to.

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

This arm object will be used in all subsequent examples throughout this API documentation when referring to Arm class methods.

Class Methods#

move_to()#

The move_to(x, y, z, wait) method moves the End Effector to the requested X, Y, and Z absolute position.

This can be a waiting or non-waiting method depending on if the wait parameter is used.

Parameters

Description

x

The x coordinate to move to, in millimeters.

y

The y coordinate to move to, in millimeters.

z

The z coordinate to move to, in millimeters.

wait

Optional. The wait parameter determines whether the method will block subsequent method (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait==True.

Returns: True if the 6-Axis Arm has moved to the requested position when wait is True. False if it did not.

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

move_inc()#

The move_inc(x, y, z, wait) method moves the End Effector by the requested X, Y, and Z distances.

This can be a waiting or non-waiting method depending on if the wait parameter is used.

Parameters

Description

x

The distance on the x-axis to move for, in millimeters.

y

The distance on the y-axis to move for, in millimeters.

z

The distance on the z-axis to move for, in millimeters.

wait

Optional. The wait parameter determines whether the method will block subsequent method (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait==True.

Returns: True if the 6-Axis Arm has moved to the requested position when wait is True. False if it did not.

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

move_end_effector_to()#

The move_end_effector_to(yaw, roll, pitch, wait) method moves the End Effector to the requested absolute yaw, roll, and pitch orientation.

This can be a waiting or non-waiting method depending on if the wait parameter is used.

Parameters

Description

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. The wait parameter determines whether the method will block subsequent method (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait==True.

Returns: True if the End Effector has moved to the requested orientation when wait is True. False if it has not.

# 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()#

The move_end_effector_inc(yaw, roll, pitch, wait) method moves the End Effector to the requested relative yaw, roll, and pitch orientation.

This can be a waiting or non-waiting method depending on if the wait parameter is used.

Parameters

Description

yaw

The angle around the z-axis that the End Effector should change by, in degrees.

roll

The angle around the x-axis that the End Effector should change by, in degrees.

pitch

The angle around the y-axis that the End Effector should change by, in degrees.

wait

Optional. The wait parameter determines whether the method will block subsequent method (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait==True.

Returns: True if the End Effector has moved to the requested orientation when wait is True. False if it has not.

# Orient the End Effector -50 degrees on the y-axis.
arm.move_end_effector_inc(0, 0, -50)

set_speed()#

The set_speed(speed) method sets the speed for moves.

Parameters

Description

speed

The speed at which the 6-Axis Arm should move.

Returns: None.

set_end_effector_type()#

The set_end_effector_type(type) method sets the End Effector type to magnet or pen.

Parameters

Description

type

A valid EndEffectorType.

Returns: True if the requested type was set. False if it was not.

# Set the End Effector type to the Magnet Pickup Tool.
arm.set_end_effector_type(MAGNET)

set_end_effector_magnet()#

The set_end_effector_magnet(state) method sets the End Effector’s Magnet Pickup Tool to enabled or disabled.

Parameters

Description

state

True to enable the Magnet Pickup Tool. False to disable it.

Returns: None.

# Enable the Magnet Pickup Tool.
arm.set_end_effector_magnet(True)

set_pen_offset()#

The set_pen_offset(zOffset) method sets the pen End Effector z-axis offset.

Parameters

Description

zOffset

The new offset in MM. A positive z value indicates up.

Returns: None.

set_control_stop()#

The set_control_stop(state) method disables the Arm and places the joint motors in brake mode.

If control stop is enabled, it will not be able disabled unless the entire project is restarted.

Parameters

Description

state

True to disable further linear or joint moves.

Returns: None.

control_stopped()#

The control_stopped(callback, arg) method registers a function to be called when the 6-Axis Arm control stop is enabled.

Parameters

Description

callback

A function that will be called when the 6-Axis Arm is control stopped

arg

Optional. A tuple that is used to pass arguments to the callback function

Returns: An instance of the Event class.

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

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

can_arm_reach_to()#

The can_arm_reach_to(x, y, z) method checks if the End Effector can move to the requested X, Y, and Z absolute position.

Parameters

Description

x

The x coordinate to move to, in millimeters.

y

The y coordinate to move to, in millimeters.

z

The z coordinate to move to, in millimeters.

Returns: True if the Arm can move to the requested position. False if it cannot.

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

can_arm_reach_inc()#

The can_arm_reach_inc(x, y, z) method checks if the End Effector can move to the requested X, Y, and Z relative position.

Parameters

Description

x

The distance on the x-axis to move for, in millimeters.

y

The distance on the y-axis to move for, in millimeters.

z

The distance on the z-axis to move for, in millimeters.

Returns: True if the Arm can move to the requested position. False if it cannot.

# Check if the Arm can increment its position 
# +100 mm along the x-axis.
if arm.can_arm_reach_inc(100, 0, 0):
    # Increment the Arm +100 mm along the x-axis.
    arm.move_inc(100, 0, 0)

can_end_effector_reach_to()#

The can_end_effector_reach_to(yaw, roll, pitch) method checks if the End Effector can move to the requested absolute yaw, roll, and pitch orientation.

Parameters

Description

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.

Returns: True if the End Effector can move to the requested orientation. False if it cannot.

# Check If the arm can orient to 90 degrees on the x-axis.
if arm.can_end_effector_reach_to(0, 90, 0):
    # Orient towards 90 degrees on the x-axis.
    arm.move_end_effector_to(0, 90, 0)

can_end_effector_reach_inc()#

The can_end_effector_reach_inc(yaw, roll, pitch) method checks if the End Effector can move to the requested relative yaw, roll, and pitch orientation.

Parameters

Description

yaw

The angle around the z-axis that the End Effector should change by, in degrees.

roll

The angle around the x-axis that the End Effector should change by, in degrees.

pitch

The angle around the y-axis that the End Effector should change by, in degrees.

Returns: True if the End Effector can move to the requested orientation. False if it cannot.

# Check if the End Effector can increment its orientation
# +10 degrees on the y-axis.
if arm.can_end_effector_reach_inc(0, 0, 10):
    # Increment the End Effector by +10 degrees on the y-axis.
    arm.move_end_effector_inc(0, 0, 10)

is_done()#

The is_done() method is used to check if the 6-Axis Arm is currently moving or not.

Returns: True if the 6-Axis Arm is currently performing a movement. False if it is not.

def main():
    # Move the Arm to (-100, 200, 100) and let subsequent 
    # methods execute.
    arm.move_to(-100, 200, 100, False)
    # Repeat the methods until the Arm is done moving.
    while not arm.is_done():
        # Print the Arm's current y position to the Brain's
        # screen every .25 seconds.
        brain.print(arm.get_y())
        brain.next_row()
        wait(0.25, SECONDS)

get_x()#

The get_x() method returns the x position of the End Effector.

Returns: The x position of the End Effector in MM.

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

get_y()#

The get_y() method returns the y position of the End Effector.

Returns: The y position of the End Effector in MM.

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

get_z()#

The get_z() method requests the z position of the End Effector.

Returns: The z position of the End Effector in MM.

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

get_pitch()#

The get_pitch() method requests the current pitch of the End Effector.

Returns: The current pitch of the End Effector in degrees.

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

get_roll()#

The get_roll() method requests the current roll of the End Effector.

Returns: The current roll of the End Effector in degrees.

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

get_yaw()#

The get_yaw() method requests the current yaw of the End Effector.

Returns: The current yaw of the End Effector in degrees.

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

set_timeout()#

The set_timeout(timeout, units) method sets the timeout value used when moving the 6-Axis Arm.

Parameters

Description

timeout

The new timeout value.

units

A valid TimeUnits type. The default unit is MSEC.

Returns: None.

get_timeout()#

The get_timeout() method gets the current timeout value used by the 6-Axis Arm move methods.

Returns: The timeout value in milliseconds.

# Get the current timeout value of the 6-Axis Arm.
value = arm.get_timeout()

is_connected()#

The is_connected() method checks if the CTE Arm is connected. This is a compatibility function that returns the same as the installed() function.

This is a non-waiting method and allows the next method to run without delay.

Returns: True if the Arm is connected to the brain on the associated smartport. False if it is not.

installed()#

The installed() method checks for device connection.

This is a non-waiting method and allows the next method to run without delay.

Returns: True if the device is connected. False if it is not.

timestamp()#

The timestamp() method returns the timestamp of the last received status packet from the Arm.

This is a non-waiting method and allows the next method to run without delay.

Returns: The timestamp of the last received status packet from the Arm in milliseconds.