Movimiento#
Introducción#
El motor GO puede girar, mantener la posición y controlar la velocidad y el torque con precisión.
For the examples below, the configured motor will be named motor_1
. They will be used in all subsequent examples throughout this API documentation when referring to Motor
class methods.
A continuación se muestra una lista de todos los métodos:
Acciones – Controlar el movimiento de los motores.
spin – Hace girar un motor en una dirección específica indefinidamente.
spin_for – Hace girar un motor durante una distancia especificada.
spin_to_position – Gira un motor a una posición absoluta.
stop – Detiene un motor.
Mutadores: cambian los diferentes atributos del motor.
set_velocity – Establece la velocidad predeterminada para el motor.
set_max_torque – Establece el torque máximo para un motor.
set_position – Establece la posición del motor en un valor específico.
set_stopping – Establece el comportamiento de detención (frenado, inercia o retención).
set_timeout – Limita el tiempo que una función motora espera antes de darse por vencida si el movimiento está bloqueado.
Obtenedores: devuelven datos de los motores.
posición – Devuelve la posición actual de un motor.
velocidad – Devuelve la velocidad actual de un motor.
actual – Devuelve la corriente utilizada por un motor.
is_stopped – Devuelve si un motor no está girando actualmente.
is_moving – Devuelve si un motor está girando actualmente.
Comportamiento#
spin#
spin
spins the motor in a specified direction indefinitely.
Usage:
motor_1.spin(direction)
Parámetros |
Descripción |
---|---|
|
The direction in which to spin the motor:
|
# Example coming soon
spin_for#
spin_for
spins the motor in a specified direction for a specific angle.
Usage:
motor_1.spin_for(direction, angle, wait)
Parámetros |
Descripción |
---|---|
|
The direction in which to spin the motor:
|
|
La cantidad de grados que girará el motor como un flotante o un entero en grados. |
|
Optional.
|
# Example coming soon
spin_to_position#
spin_to_position
spins the motor to an absolute position.
Usage:
motor_1.spin_to_position(angle, wait)
Parámetros |
Descripción |
---|---|
|
La posición en la que debe girar el motor como un flotante o un número entero. |
|
Optional.
|
# Example coming soon
stop#
stop
stops a motor from spinning.
Usage:
motor_1.stop()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon
Mutadores#
set_velocity#
set_velocity
sets the default velocity for a motor. This velocity setting will be used for subsequent calls to any Motor functions.
Usage:
motor_1.set_velocity(velocity)
Parámetros |
Descripción |
---|---|
|
La velocidad a la que girará el motor expresada como porcentaje. |
# Example coming soon
set_max_torque#
set_max_torque
sets the maximum torque for a motor.
Usage:
motor_1.set_max_torque(value)
Parámetros |
Descripción |
---|---|
|
El nuevo par máximo para un motor en forma de flotante o entero. |
# Example coming soon
set_position#
set_position
sets the position of a motor.
Usage:
motor_1.set_position(position)
Parámetros |
Descripción |
---|---|
|
La nueva posición como un entero en grados. |
# Example coming soon
set_stopping#
set_stopping
sets the stopping mode for a motor.
Usage:
motor_1.set_stopping(mode)
Parámetros |
Descripción |
---|---|
|
How the motor will stop:
|
set_timeout#
set_timeout
sets a time limit for how long a motor function will wait to reach its target. If the motor cannot complete the movement within the set time, it will stop automatically and continue with the next function.
Nota: El límite de tiempo del motor se utiliza para evitar que las funciones del motor que no alcanzan su posición objetivo detengan la ejecución del resto del proyecto.
Usage:
motor_1.set_timeout(value, units)
Parámetros |
Descripción |
---|---|
|
El número máximo de segundos que una función de motor se ejecutará antes de detenerse y pasar a la siguiente función como un entero o un punto flotante. |
|
Opcional. Unidad que representa el tiempo:
|
# Example coming soon
Captadores#
position#
position
returns the current position of a motor as an integer or as a float in degrees.
Usage:
motor_1.position()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon
velocity#
velocity
returns the current velocity of a motor as an integer or as a float in percent.
Usage:
motor_1.velocity()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon
current#
current
returns the current of the motor in amps.
Usage:
motor_1.current()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon
is_stopped#
is_stopped
returns a Boolean indicating whether the motor is stopped.
True
– The motor is stopped.False
– The motor is spinning.
Usage:
motor_1.is_stopped()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon
is_moving#
is_moving
returns a Boolean indicating whether the motor is spinning.
True
– The motor is spinning.False
– The motor is stopped.
Usage:
motor_1.is_moving()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon