Motor55#

Para que los comandos Motor55 aparezcan en VEXcode V5, se debe configurar un Controlador de motor 55 en la ventana Dispositivos.

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

Inicializando la clase Motor55#

Un controlador de motor 55, que se utiliza para controlar un motor de corriente continua (CC), se crea utilizando el siguiente constructor:

Motor55(port)

Este constructor utiliza dos parámetros:

Parámetro

Descripción

port

Un Puerto inteligente válido al que está conectado el sensor de distancia.

reverse

Optional. True to reverse the DC Motor’s spin direction. By default, this is False.

# Construct a Motor Controller 55 "m55_1" with the
# Motor55 class.
m55_1 = Motor55(Ports.PORT1)

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

Métodos de clase#

spin()#

The spin(direction, velocity, units) command turns on the Motor and spins it in a specified direction and a specified voltage.

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

Parámetros

Descripción

dirección

La dirección para girar el motor.

velocidad

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

unidades

Optional. A valid VelocityUnits. The default is VOLT.

Devoluciones: Ninguna.

stop()#

The stop() command stops the Motor using the default brake mode.

Devoluciones: Ninguna.

set_reversed#

The set_reversed(value) command sets the Motor mode to “reverse”, which will make Motor commands spin the Motor in the opposite direction.

Parámetros

Descripción

valor

Si se establece como verdadero, los comandos del motor giran el motor en la dirección opuesta.

Devoluciones: Ninguna.

set_velocity()#

The set_velocity(velocity, units) command sets the velocity of the Motor based on the parameters set in the command. This command will not run the Motor. Any subsequent call that does not contain a specified Motor velocity will use this value.

Parámetros

Descripción

velocidad

Establece la nueva velocidad.

unidades

The units for the supplied velocity, the only valid unit is PERCENT.

Devoluciones: Ninguna.

set_stopping()#

The set_stopping(mode) command sets the stopping mode of the Motor by passing a brake mode as a parameter.

Parámetros

Descripción

modo

The stopping mode can be set to coast or brake, hold is not supported on the MC55.

Devoluciones: Ninguna.

set_max_torque()#

The set_max_torque(value, units) command sets the max torque of the Motor.

Parámetros

Descripción

valor

Establece la cantidad de torque.

unidades

The unit for the torque value, only AMP is supported for an MC55.

Devoluciones: Ninguna.

current()#

The current(units) command gets the electrical current of the Motor.

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

Parámetros

Descripción

unidades

Opcional. La unidad de medida de la corriente.

Devuelve: Un doble que representa la corriente eléctrica del motor en las unidades definidas en el parámetro.

get_max_voltage()#

The get_max_voltage() command gets the maximum electrical voltage of the Motor corresponding to 100%.

Parámetros

Descripción

unidades

La unidad de medida del voltaje.

Devuelve: El voltaje máximo del motor en mV.

temperature()#

The temperature(units) command gets the temperature of the Motor.

Parámetros

Descripción

unidades

Optional. A valid TemperatureUnit. The default is CELSIUS.

Devuelve: Un doble que representa la temperatura del motor en las unidades definidas en el parámetro.

get_motor_type()#

The get_motor_type() command gets the type of the Motor, 11W, 5.5W, or MC55.

Devuelve: Un entero que devuelve el tipo de motor, 0 es 11 W, 1 es 5,5 W, 2 es MC55.