电机55#

要使 motor55 命令出现在 VEXcode V5 中,必须在设备窗口中配置电机控制器 55。

有关详细信息,请参阅以下文章:

初始化 motor55 类#

This motor55 constructor creates an object of the motor55 Class in the specified port.

范围

描述

port

A valid Smart Port that the GPS Sensor is connected to.

// Construct a Motor Controller 55 "MC55_1" with the
// motor55 class.
motor55 MC55_1 = motor55(PORT1);

This motor55 constructor creates an object of the motor55 Class in the specified port and allows the reversing of the Motor Controller 55’s spin direction.

范围

描述

port

A valid Smart Port that the GPS Sensor is connected to.

reverse

true to reverse the Motor Controller 55’s spin direction. false does not reverse the spin direction.

// Construct a Motor Controller 55 "MC55_1" with the
// motor55 class with a reverse spin direction.
motor55 MC55_1 = motor55(PORT1, false);

This motor55 constructor creates an object of the motor55 Class in the specified port and allows the reversing of the Motor Controller 55’s spin direction and sets a maximum drive voltage for the DC Motor.

范围

描述

port

A valid Smart Port that the GPS Sensor is connected to.

maxv

设置直流电机的最大驱动电压(以伏特为单位)。

reverse

true to reverse the Motor Controller 55’s spin direction. false does not reverse the spin direction.

// Construct a Motor Controller 55 "MC55_1" with the
// motor55 class with a reverse spin direction and
// a maximum drive voltage of 50 volts.
motor55 MC55_1 = motor55(PORT1, 50, false);

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

类方法#

setReversed()#

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

参数

描述

value

If set to true, Motor commands spin the Motor in the opposite direction.

**返回:**无。

setVelocity()#

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

参数

描述

velocity

设置速度量。

units

对于 MC55,速度只能以百分比表示。

**返回:**无。

setStopping()#

The Motor55.setStopping(mode) method sets the stopping mode of the Motor by passing a brake mode as a parameter.

参数

描述

mode

停止模式可以设置为滑行或制动,MC55 不支持保持。

**返回:**无。

spin()#

这是一种非等待方法,允许下一个方法无延迟运行。

该方法通过以下方式调用:

The spin(direction) method turns the Motor on and spins it in the specified direction.

参数

描述

direction

电机旋转的方向。

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

参数

描述

direction

电机旋转的方向。

voltage

设置伏特数。

units

电压值的测量单位。

**返回:**无。

stop()#

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

**返回:**无。

setMaxTorque()#

The setMaxTorque(value, units) method sets the max torque of the Motor.

参数

描述

value

设定扭矩量。

units

扭矩值的单位,MC55 仅支持安培。

**返回:**无。

current()#

该方法通过以下方式调用:

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

参数

描述

units

电流的测量单位。

**返回:**一个双精度数,以参数中定义的单位表示电机的电流。

The current(units) method gets the electrical current of the Motor in percentage of maximum.

参数

描述

units

电流的测量单位。

**返回:**表示电机电流占最大电流的百分比的双精度数。

voltage()#

The voltage(units) method gets the electrical voltage of the Motor.

参数

描述

units

电压的测量单位。

**返回:**一个双精度数,以参数中定义的单位表示电机的电压。

temperature()#

该方法通过以下方式调用:

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

参数

描述

units

温度的测量单位。

**返回:**一个双精度数,以参数中定义的单位表示电机的温度。

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

参数

描述

units

温度的测量单位。

getMotorType()#

The getMotorType() method gets the type of the Motor, 11W, 5.5W, or MC55.

**返回:**一个整数,返回电机的类型,0 为 11W,1 为 5.5W,2 为 MC55。

timestamp()#

The timestamp() method requests the timestamp of the last received status packet from the Motor.

**返回:**最后一个状态包的时间戳,以毫秒为单位的无符号 32 位整数。