motor55#

要使 motor55 命令出现在 VEXcode V5 中,必须在“设备”窗口中配置 Motor Controller 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 位整数。