电机55#
要使 Motor55 命令出现在 VEXcode V5 中,必须在设备窗口中配置电机控制器 55。
有关详细信息,请参阅以下文章:
初始化Motor55类#
使用以下构造函数创建用于控制直流(DC)电机的电机控制器 55:
Motor55(port)
该构造函数使用两个参数:
范围 |
描述 |
---|---|
|
距离传感器连接到的有效 智能端口。 |
|
Optional. |
# 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.
类方法#
spin()#
The spin(direction, velocity, units)
command turns on the Motor and spins it in a specified direction and a specified voltage.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
---|---|
方向 |
电机旋转的方向。 |
速度 |
Optional. Spin the Motor using this velocity, the default velocity set by the |
单位 |
Optional. A valid VelocityUnits. The default is |
**返回:**无。
stop()#
The stop()
command stops the Motor using the default brake mode.
**返回:**无。
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.
参数 |
描述 |
---|---|
价值 |
如果设置为 true,电机命令会使电机以相反方向旋转。 |
**返回:**无。
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.
参数 |
描述 |
---|---|
速度 |
设置新的速度。 |
单位 |
The units for the supplied velocity, the only valid unit is |
**返回:**无。
set_stopping()#
The set_stopping(mode)
command sets the stopping mode of the Motor by passing a brake mode as a parameter.
参数 |
描述 |
---|---|
模式 |
The stopping mode can be set to |
**返回:**无。
set_max_torque()#
The set_max_torque(value, units)
command sets the max torque of the Motor.
参数 |
描述 |
---|---|
价值 |
设定扭矩量。 |
单位 |
The unit for the torque value, only |
**返回:**无。
current()#
The current(units)
command gets the electrical current of the Motor.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
---|---|
单位 |
可选。 电流的测量单位。 |
**返回:**一个双精度数,以参数中定义的单位表示电机的电流。
get_max_voltage()#
The get_max_voltage()
command gets the maximum electrical voltage of the Motor corresponding to 100%.
参数 |
描述 |
---|---|
单位 |
电压的测量单位。 |
**返回:**电机的最大电压(mV)。
temperature()#
The temperature(units)
command gets the temperature of the Motor.
参数 |
描述 |
---|---|
单位 |
Optional. A valid TemperatureUnit. The default is |
**返回:**一个双精度数,以参数中定义的单位表示电机的温度。
get_motor_type()#
The get_motor_type()
command gets the type of the Motor, 11W, 5.5W, or MC55.
**返回:**一个整数,返回电机的类型,0 为 11W,1 为 5.5W,2 为 MC55。