Brazo#
Inicializando la clase Arm#
Un brazo de 6 ejes se crea utilizando el siguiente constructor:
Arm(port)
Este constructor utiliza un parámetro:
Parámetro |
Descripción |
---|---|
|
Un Puerto inteligente válido al que está conectado el brazo de 6 ejes. |
# 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.
Métodos de clase#
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.
Parámetros |
Descripción |
---|---|
incógnita |
La coordenada x a la que moverse, en milímetros. |
y |
La coordenada y a la que moverse, en milímetros. |
z |
La coordenada z a la que moverse, en milímetros. |
esperar |
Optional. The wait parameter determines whether the method will block subsequent method ( |
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.
Parámetros |
Descripción |
---|---|
incógnita |
La distancia en el eje x a recorrer, en milímetros. |
y |
La distancia en el eje y a recorrer, en milímetros. |
z |
La distancia en el eje z a recorrer, en milímetros. |
esperar |
Optional. The wait parameter determines whether the method will block subsequent method ( |
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.
Parámetros |
Descripción |
---|---|
guiñada |
El ángulo alrededor del eje z al que debe apuntar el efector final, en grados. |
rollo |
El ángulo alrededor del eje x al que debe apuntar el efector final, en grados. |
paso |
El ángulo alrededor del eje y al que debe apuntar el efector final, en grados. |
esperar |
Optional. The wait parameter determines whether the method will block subsequent method ( |
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.
Parámetros |
Descripción |
---|---|
guiñada |
El ángulo alrededor del eje z en el que debe cambiar el efector final, en grados. |
rollo |
El ángulo alrededor del eje x en el que debe cambiar el efector final, en grados. |
paso |
El ángulo alrededor del eje y en el que debe cambiar el efector final, en grados. |
esperar |
Optional. The wait parameter determines whether the method will block subsequent method ( |
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.
Parámetros |
Descripción |
---|---|
velocidad |
La velocidad a la que debe moverse el brazo de 6 ejes. |
Devoluciones: Ninguna.
set_end_effector_type()#
The set_end_effector_type(type)
method sets the End Effector type to magnet
or pen
.
Parámetros |
Descripción |
---|---|
tipo |
Un [EndEffectorType] válido (https://api.vex.com/exp/home/python/Enums.html#end-effector-types). |
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.
Parámetros |
Descripción |
---|---|
estado |
|
Devoluciones: Ninguna.
# 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.
Parámetros |
Descripción |
---|---|
zOffset |
The new offset in |
Devoluciones: Ninguna.
set_control_stop()#
The set_control_stop(state)
method disables the Arm and places the joint motors in brake mode.
Si la parada de control está habilitada, no se podrá deshabilitar a menos que se reinicie todo el proyecto.
Parámetros |
Descripción |
---|---|
estado |
|
Devoluciones: Ninguna.
control_stopped()#
The control_stopped(callback, arg)
method registers a function to be called when the 6-Axis Arm control stop is enabled.
Parámetros |
Descripción |
---|---|
llamar de vuelta |
Una función que se llamará cuando se detenga el control del brazo de 6 ejes |
arg |
Opcional. Una tupla que se utiliza para pasar argumentos a la función de devolución de llamada |
Devuelve: Una instancia de la clase Event.
# 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.
Parámetros |
Descripción |
---|---|
incógnita |
La coordenada x a la que moverse, en milímetros. |
y |
La coordenada y a la que moverse, en milímetros. |
z |
La coordenada z a la que moverse, en milímetros. |
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.
Parámetros |
Descripción |
---|---|
incógnita |
La distancia en el eje x a recorrer, en milímetros. |
y |
La distancia en el eje y a recorrer, en milímetros. |
z |
La distancia en el eje z a recorrer, en milímetros. |
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.
Parámetros |
Descripción |
---|---|
guiñada |
El ángulo alrededor del eje z al que debe apuntar el efector final, en grados. |
rollo |
El ángulo alrededor del eje x al que debe apuntar el efector final, en grados. |
paso |
El ángulo alrededor del eje y al que debe apuntar el efector final, en grados. |
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.
Parámetros |
Descripción |
---|---|
guiñada |
El ángulo alrededor del eje z en el que debe cambiar el efector final, en grados. |
rollo |
El ángulo alrededor del eje x en el que debe cambiar el efector final, en grados. |
paso |
El ángulo alrededor del eje y en el que debe cambiar el efector final, en grados. |
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.
Devuelve: El tono actual del efector final en grados.
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.
Devuelve: El balance actual del efector final en grados.
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.
Devuelve: La guiñada actual del efector final en grados.
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.
Parámetros |
Descripción |
---|---|
se acabó el tiempo |
El nuevo valor de tiempo de espera. |
unidades |
A valid TimeUnits type. The default unit is |
Devoluciones: Ninguna.
get_timeout()#
The get_timeout()
method gets the current timeout value used by the 6-Axis Arm move methods.
Devuelve: El valor de tiempo de espera en milisegundos.
# 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.
Este es un método sin espera y permite que el siguiente método se ejecute sin demora.
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.
Este es un método sin espera y permite que el siguiente método se ejecute sin demora.
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.
Este es un método sin espera y permite que el siguiente método se ejecute sin demora.
Devuelve: La marca de tiempo del último paquete de estado recibido del Arm en milisegundos.