维克多汽车#
介绍#
VEX Victor 电机控制器 是一款传统的电机控制器,它接收来自主机的 3 线 PWM 信号来控制无法直接插入智能端口的 VEXpro/EDR 直流电机。
This page uses victor_motor as the example Victor Motor Controller name. Replace it with your own configured name as needed.
以下是可用方法列表:
spin– Spins a motor forward or reverse until stopped.stop– Stops a motor immediately.set_velocity– Sets a motor’s speed as a percentage.set_reversed– Sets a motor to have its direction be reversed.
构造函数 – 手动初始化 Victor 电机控制器。
MotorVictor– Creates a Victor Motor Controller.
旋转#
spin rotates a connected motor in a specified direction using the current motor velocity.
Usage:
victor_motor.spin(direction, velocity, units)
参数 |
描述 |
|---|---|
|
The direction in which to spin the motor:
|
|
可选参数。电机旋转速度,可以是浮点数或整数。如果未指定速度或速度之前设置为#set-velocity,则默认速度为 50%。 |
|
Optional. The unit that represents the velocity:
|
停止#
stop stops the connected motor immediately.
Usage:
victor_motor.stop()
参数 |
描述 |
|---|---|
此方法没有参数。 |
设置速度#
set_velocity sets the default spinning speed of a motor for all subsequent Victor Motor methods in the project.
Usage:
victor_motor.set_velocity(value, units)
范围 |
描述 |
|---|---|
|
电机旋转的速度,以浮点数或整数表示。 |
|
Optional. The unit that represents the velocity:
|
set_reversed#
set_reversed sets the motor to be reversed so that the FORWARD direction will spin clockwise. This method works the same as setting the reverse parameter to True when constructing a Motor29.
Usage:
victor_motor.set_reversed(value)
参数 |
描述 |
|---|---|
|
Boolean value to set the direction reversed or not:
|
构造函数#
Constructors are used to create Motor29 objects, which are necessary for configuring a Victor Motor Controller.
MotorVictor#
MotorVictor creates a Victor Motor Controller.
Usage:
MotorVictor(port, gears, reverse)
范围 |
描述 |
|---|---|
|
The 3-Wire Port that the V5 Pneumatic Solenoid is connected to:
|
|
Optional. Sets whether the motor’s spin should be reversed.
|
# Create a Victor Motor Controller in Port A
victor_motor = MotorVictor(brain.three_wire_port.a)