Grupo Motor#

Para que los comandos MotorGroup aparezcan en VEXcode V5, se debe configurar un motor en la ventana Dispositivos.

Para obtener más información, consulte estos artículos:

grupo_motor.spin()#

The motor_group.spin(direction, velocity, units) command spins all motors in the group using the provided arguments.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

dirección

Un DirectionType válido.

velocidad

Optional. Spin the motor using this velocity, the default velocity set by motor_group.set_velocity will be used if not provided.

unidades

Optional. A valid VelocityUnit. The default is RPM.

Devoluciones: Ninguna.

# Spin the motor group forward for 2 seconds.
motor_group_1.spin(FORWARD)
wait(2, SECOND)

# Stop spinning the motor group.
motor_group_1.stop()

grupo_motor.girar_a_posición()#

The motor_group.spin_to_position(rotation, units, velocity, units_v, wait) command spins all motors in the group to an absolute position using the provided arguments.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

rotación

La posición a la que debe girar el motor.

unidades

Optional. A valid RotationUnit. The default is DEGREES.

velocidad

Opcional. Gire el motor usando esta velocidad, se utilizará la velocidad predeterminada establecida por set_velocity si no se proporciona.

unidades_v

Optional. A valid VelocityUnit. The default is RPM.

esperar

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

Devoluciones: Ninguna.

grupo_motor.spin_for()#

The motor_group.spin_for(direction, value, units, velocity, units_v, wait) command spins all motors in the group to a relative position using the provided arguments.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

dirección

Un DirectionType válido.

valor

El valor al que debe girar el grupo motor.

unidades

Optional. A valid RotationUnit. The default is DEGREES.

velocidad

Opcional. Gire el motor usando esta velocidad, se utilizará la velocidad predeterminada establecida por set_velocity si no se proporciona.

unidades_v

Optional. A valid VelocityUnit. The default is RPM.

esperar

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

Devoluciones: Ninguna.

# Spin 180 degrees from the current position.
motor_group_1.spin_for(FORWARD, 180)

grupo_motor.stop()#

The motor_group.stop() command is used to stop a motor group.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Devoluciones: Ninguna.

# Spin the motor group forward for 2 seconds.
motor_group_1.spin(FORWARD)
wait(2, SECOND)

# Stop spinning the motor group.
motor_group_1.stop()

grupo_motor.count()#

The motor_group.count() command returns the number of motors in the group.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Devuelve: El número de motores en el grupo.

grupo_motor.establecer_velocidad()#

The motor_group.set_velocity(velocity, units) command sets the default velocity for all motors in the group. This will be the velocity used for subsequent calls to spin if a velocity is not provided to that function.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

velocidad

La nueva velocidad a establecer para el grupo motor.

unidades

Optional. A valid VelocityUnit. The default is RPM.

Devoluciones: Ninguna.

grupo_motor.set_stopping()#

The motor_group.set_stopping(mode) command sets the stopping mode for all motors in the group. Setting the action for the motor when stopped.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

modo

A valid BrakeType. The default is COAST.

Devoluciones: Ninguna.

grupo_motor.reset_position()#

The motor_group.reset_position() command resets the motor group position to 0.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Devoluciones: Ninguna.

grupo_motor.establecer_posición()#

The motor_group.set_position(value, units) command sets the current position for all motors in the group. The position returned by the motor_group.position() function is set to this value.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

valor

La nueva posición.

unidades

Optional. A valid RotationUnit. The default is DEGREES.

Devoluciones: Ninguna.

grupo_motor.establecer_tiempo_de_espera()#

The motor_group.set_timeout(timeout, units) command sets the timeout value used for all motors in the group.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

se acabó el tiempo

El nuevo tiempo de espera.

unidades

Optional. A valid TimeUnit. The default is MSEC.

Devoluciones: Ninguna.

grupo_motor.está_girando()#

The motor_group.is_spinning() command returns if the motor group is currently spinning.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Returns: True if the motor group is currently spinning. False if it is not.

grupo_motor.está_hecho()#

The motor_group.is_done() command returns if the motor group has completed its movement.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Returns: True if the motor group has completed its movement. False if it has not.

grupo_motor.establecer_par_máximo()#

The motor_group.set_max_torque(value, units) command sets the maximum torque all motors in the group will use. The torque can be set as torque, current, or percent of maximum.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

valor

El nuevo par máximo a utilizar.

unidades

Optional. A valid TorqueUnit, AMP, or PERCENT.

Devoluciones: Ninguna.

grupo_motor.dirección()#

The motor_group.direction() command returns the current direction the motor group is spinning in.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Devuelve: El DirectionType actual en el que está girando el grupo de motores.

grupo_motor.posición()#

The motor_group.position(units) command returns the position of the first motor.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

unidades

Optional. A valid RotationUnit. The default is DEGREES.

Devuelve: La posición actual del grupo de motores en las unidades especificadas.

grupo_motor.velocidad()#

The motor_group.velocity(units) command returns the current velocity of the motor group.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

unidades

Optional. A valid VelocityUnit. The default is RPM.

Devuelve: La velocidad actual del grupo de motores en las unidades especificadas.

grupo_motor.actual()#

The motor_group.current(units) command returns the current being used by the motor group.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

unidades

Optional. The only valid unit for current is AMP.

Devuelve: La corriente consumida por el grupo de motores en las unidades especificadas.

grupo_motor.potencia()#

The motor_group.power(units) command returns the power being consumed by the motor group.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

unidades

Optional. The only valid unit for power is WATT.

Devuelve: La potencia consumida por el grupo de motores en las unidades especificadas.

grupo_motor.torque()#

The motor_group.torque(units) command returns the torque the first motor is providing.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

unidades

Optional. A valid TorqueUnit. The default is NM.

Devuelve: El torque generado por el grupo de motores en las unidades especificadas.

grupo_motor.eficiencia()#

The motor_group.efficiency(units) command returns the efficiency of the motor group.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

unidades

Optional. The only valid unit for efficiency is PERCENT.

Devuelve: La eficiencia del grupo motor como porcentaje.

motor_group.temperature()#

The motor_group.temperature(units) command returns the temperature of the motor group.

Este es un comando sin espera y permite que el siguiente comando se ejecute sin demora.

Parámetros

Descripción

unidades

Optional. A valid TemperatureUnit. The default is CELSIUS.

Devuelve: La temperatura del grupo de motores en las unidades especificadas.