Brazo con CTE#

Introducción#

The arm class provides control for the 6-Axis CTE Arm, allowing precise positioning and movement of the robotic arm in 3D space. This class supports both absolute and relative positioning, end effector control, and various sensor functions for monitoring arm status and capabilities.

Constructores de clases#

arm( 
  int32_t index );

Instructor de clase#

Destroys the arm object and releases associated resources.

~arm();

Parámetros#

Parámetro

Tipo

Descripción

index

int32_t

A valid Smart Port that the 6-Axis Arm is connected to, written as PORTx, where x is the port number (for example, PORT1).

Ejemplo#

// Create the arm instance in Port 1
arm Arm = arm(PORT1);

Funciones de los miembros#

The arm classes includes the following member functions:

  • moveTo - Mueve el efector final a las coordenadas x, y, z solicitadas.

  • moveInc - Mueve el efector final las distancias x, y y z solicitadas en relación con su posición actual.

  • moveEndEffectorTo - Mueve el efector final a la orientación absoluta de guiñada, balanceo y cabeceo solicitada.

  • moveEndEffectorInc - Mueve el efector final a la orientación relativa de guiñada, balanceo y cabeceo solicitada.

  • setEndEffectorType - Establece el tipo de efector final conectado al brazo.

  • setEndEffectorMagnet - Establece el imán del efector final como habilitado o deshabilitado.

  • setPenOffset - Establece el desplazamiento del eje z del efector final del lápiz.

  • setControlStop - Deshabilita el brazo y pone los motores de las articulaciones en modo de freno.

  • controlStopped - Registra una función que se llamará cuando se habilite la parada del control del brazo.

  • canArmReachTo - Devuelve si el efector final puede moverse a las coordenadas x, y, z solicitadas.

  • canArmReachInc - Devuelve si el efector final puede moverse una distancia a lo largo de los ejes x, y y z.

  • canEndEffectorReachTo - Devuelve si el efector final puede moverse a la orientación absoluta de guiñada, balanceo y cabeceo solicitada.

  • canEndEffectorReachInc - Devuelve si el efector final puede moverse una distancia a lo largo de las orientaciones de guiñada, cabeceo o balanceo.

  • isDone – Devuelve el estado del movimiento del brazo.

  • getX – Devuelve la posición X del efector final.

  • getY – Devuelve la posición y del efector final.

  • getZ – Devuelve la posición z del efector final.

  • getYaw – Devuelve la guiñada actual del efector final.

  • getRoll – Devuelve el rollo actual del efector final.

  • getPitch – Devuelve el tono actual del efector final.

  • setTimeout – Establece el valor de tiempo de espera utilizado al mover el brazo.

  • isConnected – Devuelve true si el brazo CTE está conectado.

  • timestamp – Devuelve la marca de tiempo del último paquete de estado recibido del Arm.

  • instalado – Devuelve si el dispositivo está conectado.

moveTo#

Mueve el efector final a las coordenadas x, y, z solicitadas.

Available Functions
bool moveTo( 
  double x, 
  double y, 
  double z, 
  bool   waitForCompletion = true );

Parameters

Parámetro

Tipo

Descripción

x

double

La coordenada X a la que hay que moverse, en milímetros.

y

double

La coordenada Y a la que hay que moverse, en milímetros.

z

double

La coordenada Z a la que hay que desplazarse, en milímetros.

waitForCompletion

bool

  • true (default) — The project waits until the function finishes before executing the next line of code.
  • false — The project starts the action and moves on to the next line of code right away, without waiting for the function to finish.

Return Values

Devuelve un valor booleano que indica si el brazo alcanzó la posición objetivo.

  • true if the arm reached the target position.

  • false if the arm did not reach the target position or if waitForCompletion parameter is set to false.

Examples
// Move the arm to the (200, 0, 100)
Arm.moveTo(200, 0, 100);

moveInc#

Mueve el efector final las distancias x, y, z solicitadas con respecto a su posición actual.

Available Functions
bool moveInc( 
  double x, 
  double y, 
  double z, 
  bool   waitForCompletion = true );

Parameters

Parámetro

Tipo

Descripción

x

double

La distancia que hay que recorrer en el eje X, en milímetros.

y

double

La distancia que hay que recorrer en el eje Y, en milímetros.

z

double

La distancia que hay que recorrer en el eje Z, en milímetros.

waitForCompletion

bool

  • true (default) — The project waits until the function finishes before executing the next line of code.
  • false — The project starts the action and moves on to the next line of code right away, without waiting for the function to finish.

Return Values

Devuelve un valor booleano que indica si el brazo alcanzó la posición objetivo.

  • true if the arm reached the target position.

  • false if the arm did not reach the target position or if waitForCompletion parameter is set to false.

Examples
// Move the Arm +100 millimeters on the Y axis
Arm.moveInc(0, 100, 0);

moveEndEffectorTo#

Mueve el efector final a la orientación absoluta de guiñada, balanceo y cabeceo solicitada.

Available Functions
bool moveEndEffectorTo( 
  double yaw, 
  double roll = 0, 
  double pitch = 0, 
  bool   waitForCompletion = true);

Parameters

Parámetro

Tipo

Descripción

yaw

double

El ángulo alrededor del eje Z hacia el que debe apuntar el efector final, en grados.

roll

double

El ángulo alrededor del eje X hacia el que debe apuntar el efector final, en grados. El valor predeterminado es 0.

pitch

double

El ángulo alrededor del eje Y hacia el que debe apuntar el efector final, en grados. El valor predeterminado es 0.

waitForCompletion

bool

  • true (default) — The project waits until the function finishes before executing the next line of code.
  • false — The project starts the action and moves on to the next line of code right away, without waiting for the function to finish.

Return Values

Devuelve un valor booleano que indica si el efector final alcanzó la orientación objetivo.

  • true if the end effector reached the target orientation.

  • false if the end effector did not reach the target orientation or if waitForCompletion parameter is set to false.

Examples
// Orient the end effector to point towards 
// 90 degrees around the X axis
Arm.moveEndEffectorTo(0, 90, 0);

moveEndEffectorInc#

Mueve el efector final a la orientación relativa de guiñada, balanceo y cabeceo solicitada.

Available Functions
bool moveEndEffectorInc( 
  double yaw, 
  double roll = 0, 
  double pitch = 0, 
  bool   waitForCompletion = true );

Parameters

Parámetro

Tipo

Descripción

yaw

double

El ángulo alrededor del eje Z que debe cambiar el efector final, en grados.

roll

double

El ángulo alrededor del eje X que debe cambiar el efector final, en grados. El valor predeterminado es 0.

pitch

double

El ángulo alrededor del eje Y que debe cambiar el efector final, en grados. El valor predeterminado es 0.

waitForCompletion

bool

  • true (default) — The project waits until the function finishes before executing the next line of code.
  • false — The project starts the action and moves on to the next line of code right away, without waiting for the function to finish.

Return Values

Devuelve un valor booleano que indica si el efector final alcanzó la orientación objetivo.

  • true if the end effector reached the target orientation.

  • false if the end effector did not reach the target orientation or if waitForCompletion parameter is set to false.

Examples
// Orient the end effector -50 degrees on the Y axis
Arm.moveEndEffectorInc(0, 0, -50);

setSpeed#

Establece la velocidad de los movimientos del brazo.

Available Functions
void setSpeed( 
  uint32_t speed );

Parameters

Parámetro

Tipo

Descripción

speed

uint32_t

La velocidad a la que debe moverse el brazo en mm/s.

Return Values

Esta función no devuelve ningún valor.

setEndEffectorType#

Establece el tipo de efector final en imán o bolígrafo.

Available Functions
bool setEndEffectorType( 
  endEffectorType type, 
  bool            waitForCompletion = true));

Parameters

Parámetro

Tipo

Descripción

type

endEffectorType

An end effector type:

  • magnet
  • pen

waitForCompletion

bool

  • true (default) — The project waits until the function finishes before executing the next line of code.
  • false — The project starts the action and moves on to the next line of code right away, without waiting for the function to finish.

Return Values

Devuelve un valor booleano que indica si se ha establecido el tipo solicitado.

  • true if the requested type was set.

  • false if the requested type was not set or if waitForCompletion parameter is set to false.

Examples
// Set the end effector to the Magnet Pickup Tool.
Arm.setEndEffectorType(magnet);

setEndEffectorMagnet#

Configura el imán del efector final como habilitado o deshabilitado.

Available Functions
void setEndEffectorMagnet( 
  bool enabled );

Parameters

Parámetro

Tipo

Descripción

enabled

bool

  • true – enable the magnet
  • false – disable the magnet

Return Values

Esta función no devuelve ningún valor.

Examples
// Enable the Magnet Pickup Tool
Arm.setEndEffectorMagnet(true);

setPenOffset#

Establece el desplazamiento del eje Z del efector final del lápiz.

Available Functions
void setPenOffset( 
  double zOffset );

Parameters

Parámetro

Tipo

Descripción

zOffset

double

El nuevo desplazamiento en milímetros. Un valor z positivo indica hacia arriba.

Return Values

Esta función no devuelve ningún valor.

setControlStop#

Desactiva el brazo y pone los motores de las articulaciones en modo de frenado.

Available Functions
void setControlStop( 
  bool state = true);

Parameters

Parámetro

Tipo

Descripción

state

bool

  • true (default) — Disable further linear or joint moves.
  • false — Enable further linear or joint moves.

Return Values

Esta función no devuelve ningún valor.

controlStopped#

Registra una función que se llamará cuando se habilite la parada de control del brazo.

Available Functions
void controlStopped( 
  void (* callback)(void) );

Parameters

Parámetro

Tipo

Descripción

callback

void (*)(void)

Una función que se llamará cuando se detenga el control del brazo.

Return Values

Esta función no devuelve ningún valor.

Examples
// Define the whenControlStopped function with a void
// return type, showing it doesn't return a value.
void whenControlStopped() {
  // The brain will print that the arm has been control stopped
  // on the Brain's screen.
  Brain.Screen.print("The arm has been control stopped");
}

// Run whenControlStopped when the the arm is control stopped.
Arm.controlStopped(whenControlStopped);

canArmReachTo#

Devuelve un valor booleano si el efector final puede moverse a las coordenadas x, y, z solicitadas.

Available Functions
bool canArmReachTo( double x, double y, double z );

Parameters

Parámetro

Tipo

Descripción

x

double

La coordenada X a la que hay que moverse, en milímetros.

y

double

La coordenada Y a la que hay que moverse, en milímetros.

z

double

La coordenada Z a la que hay que desplazarse, en milímetros.

Return Values

Returns true if the arm can move to the requested position, false if it cannot.

Examples
// Check if the arm can move to the (100, -20, 50).
if (Arm.canArmReachTo(100, -20, 50)){
  // Move the arm to (100, -20, 50).
  Arm.moveTo(100, -20, 50);
}

canArmReachInc#

Devuelve verdadero si el efector final puede moverse una distancia a lo largo de los ejes x, y y z.

Available Functions
bool canArmReachInc( 
  double x, 
  double y, 
  double z );

Parameters

Parámetro

Tipo

Descripción

x

double

La distancia que hay que recorrer en el eje X, en milímetros.

y

double

La distancia que hay que recorrer en el eje Y, en milímetros.

z

double

La distancia que hay que recorrer en el eje Z, en milímetros.

Return Values

Devuelve un valor booleano que indica si el brazo puede moverse a la posición solicitada.

  • true if the arm can move to the requested position.

  • false if the arm cannot move to the requested position.

Examples
// Check if the arm can increment by 100 mm along the x-axis
if (Arm.canArmReachInc(100, 0, 0)){
  // Increment the arm by 100 mm along the x-axis
  Arm.moveInc(100, 0, 0);
}

canEndEffectorReachTo#

Devuelve verdadero si el efector final puede moverse a la orientación absoluta de guiñada, balanceo y cabeceo solicitada.

Available Functions
bool canEndEffectorReachTo( 
  double yaw, 
  double roll = 0, 
  double pitch = 0 );

Parameters

Parámetro

Tipo

Descripción

yaw

double

El ángulo alrededor del eje Z hacia el que debe apuntar el efector final, en grados.

roll

double

El ángulo alrededor del eje X hacia el que debe apuntar el efector final, en grados. El valor predeterminado es 0.

pitch

double

El ángulo alrededor del eje Y hacia el que debe apuntar el efector final, en grados. El valor predeterminado es 0.

Return Values

Devuelve un valor booleano que indica si el efector final puede moverse a la orientación solicitada.

  • true if the end effector can move to the requested orientation.

  • false if the end effector cannot move to the requested orientation.

Examples
// Check if the arm can orient 25 degrees around the z-axis
if (Arm.canEndEffectorReachTo(25, 0, 0)){
  // Orient to 25 degrees around the z-axis
  Arm.moveEndEffectorTo(25, 0, 0);
}

canEndEffectorReachInc#

Devuelve verdadero si el efector final puede moverse una distancia en las direcciones de guiñada, cabeceo o balanceo.

Available Functions
bool canEndEffectorReachInc( 
  double yaw, 
  double roll = 0, 
  double pitch = 0 );

Parameters

Parámetro

Tipo

Descripción

yaw

double

El ángulo alrededor del eje z que abarca el movimiento del efector final, expresado en grados.

roll

double

El ángulo alrededor del eje x que abarca el movimiento del efector final, expresado en grados. El valor predeterminado es 0.

pitch

double

El ángulo alrededor del eje Y que el efector final recorrerá, expresado en grados. El valor predeterminado es 0.

Return Values

Devuelve un valor booleano que indica si el efector final puede moverse a la orientación solicitada.

  • true if the end effector can move to the requested orientation.

  • false if the end effector cannot move to the requested orientation.

Examples
// Check If the arm can increment its orientation 
// by 10 degrees on the X axis.
if (Arm.canEndEffectorReachInc(0, 10, 0)){
  // Move +10 degrees around the x-axis
  Arm.moveEndEffectorInc(0, 10, 0);
}

isDone#

Devuelve el estado del movimiento del brazo.

Available Functions
bool isDone();

Parameters

Esta función no tiene parámetros.

Return Values

Devuelve un valor booleano que indica si el brazo ha completado su movimiento.

  • true if the arm has completed its movement.

  • false if the arm is still moving.

Examples
// Move Arm to (-100, 200, 100) and let subsequent methods execute
Arm.moveTo(-100, 200, 100, false);
// Keep repeating the methods until the Arm is done moving
while (!Arm.isDone()) {
  // Print the Arm's current Y coordinate on the Brain every .25 seconds
  Brain.Screen.print(Arm.getY());
  Brain.Screen.newLine();
  wait(0.25, seconds);
}

getX#

Devuelve la posición X del efector final.

Available Functions
float getX();

Parameters

Esta función no tiene parámetros.

Return Values

Returns a float representing the X position of the end effector in millimeters.

Examples
// Print the current x-position of the arm in degrees
Brain.Screen.print(Arm.getX());

getY#

Devuelve la posición Y del efector final.

Available Functions
float getY();

Parameters

Esta función no tiene parámetros.

Return Values

Returns a float representing the y-position of the end effector in millimeters.

Examples
// Print the current y-position of the Arm in degrees
Brain.Screen.print(Arm.getY());

getZ#

Devuelve la posición z del efector final.

Available Functions
float getZ();

Parameters

Esta función no tiene parámetros.

Return Values

Returns a float representing the z-position of the end effector in millimeters.

Examples
// Print the current z-position of the Arm in degrees
Brain.Screen.print(Arm.getZ());

getYaw#

Devuelve el ángulo de guiñada actual del efector final.

Available Functions
float getYaw();

Parameters

Esta función no tiene parámetros.

Return Values

Returns a float representing the current yaw of the end effector in degrees.

Examples
// Print the current yaw of the Arm in degrees
Brain.Screen.print(Arm.getYaw());

getRoll#

Devuelve el valor actual del efector final.

Available Functions
float getRoll();

Parameters

Esta función no tiene parámetros.

Return Values

Returns a float representing the current roll of the end effector in degrees.

Examples
// Print the current roll of the Arm in degrees
Brain.Screen.print(Arm.getRoll());

getPitch#

Devuelve el tono actual del efector final.

Available Functions
float getPitch();

Parameters

Esta función no tiene parámetros.

Return Values

Returns a float representing the current pitch of the end effector in degrees.

Examples
// Print the current pitch of the Arm in degrees
Brain.Screen.print(Arm.getPitch());

setTimeout#

Establece el valor de tiempo de espera que se utiliza al mover el brazo.

Available Functions
void setTimeout( 
  int32_t   timeout, 
  timeUnits units );

Parameters

Parámetro

Tipo

Descripción

timeout

int32_t

El nuevo valor de tiempo de espera.

units

timeUnits

The unit that represents the time:

  • sec
  • – seconds
  • msec
  • – milliseconds

Return Values

Esta función no devuelve ningún valor.

isConnected#

Devuelve un valor si el brazo CTE está conectado. Esta es una función de compatibilidad que devuelve el mismo valor que la función installed().

Available Functions
bool isConnected();

Parameters

Esta función no tiene parámetros.

Return Values

Devuelve un valor booleano que indica si el brazo está conectado al cerebro a través del puerto inteligente asociado.

  • true if the arm is connected to the brain on the associated smartport.

  • false if the arm is not connected to the brain on the associated smartport.

timestamp#

Devuelve la marca de tiempo del último paquete de estado recibido del Arm.

Available Functions
uint32_t timestamp();

Parameters

Esta función no tiene parámetros.

Return Values

Returns the timestamp of the last status packet as a uint32_t in milliseconds.

installed#

Devuelve un valor si el dispositivo está conectado.

Available Functions
bool installed();

Parameters

Esta función no tiene parámetros.

Return Values

Devuelve un valor booleano que indica si el dispositivo está conectado.

  • true if the device is connected.

  • false if the device is not connected.