电机控制器 55#
介绍#
电机控制器 55 (MC55) 用于控制标准直流电机。

本页面使用 mc_55 作为示例电机控制器 55 的名称。请根据需要将其替换为您自己配置的名称。
以下是可用方法列表:
spin– 使直流电机正转或反转,直到停止。stop– 立即停止直流电机。set_velocity– 告诉直流电机旋转的速度。set_stopping– 设置直流电机停止时的行为。set_max_torque– 设置直流电机允许使用的最大扭矩。set_reversed– 设置直流电机反转其旋转方向。current– 返回直流电机正在使用的电流大小。temperature– 返回直流电机的温度。
构造函数 - 手动初始化电机控制器 55。
Motor55– 创建电机控制器 55。
旋转#
spin 使用 当前电机速度 使连接的直流电机沿指定方向旋转。
Usage:
mc_55.spin(direction, velocity, units)
参数 |
描述 |
|---|---|
|
电机旋转方向:
|
|
Optional. The velocity to spin with from 0% to 100% when using |
|
Optional. The velocity unit:
|
# Spin the motor at -2 volts
mc_55.spin(FORWARD, -2)
停止#
stop 立即停止连接的直流电机,使用电流停止模式。
Usage:
mc_55.stop(mode)
范围 |
描述 |
|---|---|
模式 |
Optional. The stopping behavior to use when the motor stops:
If the stopping mode is not specified or previously set, the default behavior is |
设置速度#
set_velocity 决定直流电机的转速。百分比越高,直流电机转速越快;百分比越低,直流电机转速越慢。
每个项目开始时,每个连接的直流电机默认以 50% 的速度旋转。
Usage:
mc_55.set_velocity(value, units)
范围 |
描述 |
|---|---|
|
The velocity to spin with from 0% to 100% when using |
|
可选。速度单位: |
设置停止#
set_stopping 设置直流电机停止时的行为。
Usage:
mc_55.set_stopping(mode)
参数 |
描述 |
|---|---|
|
How the motor will stop:
|
设置最大扭矩#
扭矩表示直流电机在旋转时能够产生的推力或拉力的大小。
set_max_torque 设置直流电机允许使用的最大扭矩。
Usage:
mc_55.set_max_torque(value, units)
参数 |
描述 |
|---|---|
|
The maximum torque the DC motor is allowed to use. This can be an |
|
可选。扭矩单位: |
设置反转#
set_reversed 将直流电机反转,使 FORWARD 方向顺时针旋转。此方法与构造 Motor55 时将 reverse 参数设置为 True 效果相同。
Usage:
mc_55.set_reversed(value)
参数 |
描述 |
|---|---|
|
Whether the DC motor’s direction is reversed:
|
当前的#
current 返回直流电机正在使用的电流大小,以安培为单位,范围从 0.0 到 1.2 A。电流是指流过直流电机的电量。
电流值越高,意味着直流电机消耗的电流越大。这种情况可能发生在直流电机提升重物、推动物体或试图在卡住时移动时。
这可以用来检查直流电机在运动过程中是否运转吃力。如果电流持续过高,电机可能会发热或功率利用率降低。
Usage:
mc_55.current(units)
参数 |
描述 |
|---|---|
|
可选。当前单位: |
温度#
temperature 返回直流电机的温度。
电机温度显示直流电机的温度。温度越高,说明直流电机在工作过程中温度越高。为了保持最佳性能,电机温度应保持在 55°C 以下。
如果直流电机过热,它会降低最大电流以保护自身。当温度达到 70°C 时,电机将停止运转,直到冷却下来。
这可以用来检查直流电机在重复运动、长时间运行或推动物体时是否过热。
Usage:
mc_55.temperature(units)
参数 |
描述 |
|---|---|
|
可选。温度单位:
|
构造函数#
构造函数用于手动创建 Motor55 对象,这是在 VEXcode 之外配置 Motor Controller 55 所必需的。
Motor55#
Motor55 创建电机控制器 55。
Usage:
Motor55(port, reverse)
范围 |
描述 |
|---|---|
|
The 3-Wire Port that the Motor Controller 55 is connected to:
|
|
Optional. Sets whether the motor’s spin should be reversed.
|
# Create a Motor Controller 55 in Port A
mc_55 = Motor55(brain.three_wire_port.a)