汽车集团#
要使 MotorGroup 命令出现在 VEXcode V5 中,必须在设备窗口中配置电机。
有关详细信息,请参阅以下文章:
电机组.旋转()#
The motor_group.spin(direction, velocity, units) command spins all motors in the group using the provided arguments.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
A valid |
|
Optional. Spin the motor using this velocity, the default velocity set by |
|
Optional. A valid |
**返回:**无。
# Spin the motor group forward for 2 seconds.
motor_group_1.spin(FORWARD)
wait(2, SECOND)
# Stop spinning the motor group.
motor_group_1.stop()
电机组.旋转到位置()#
The motor_group.spin_to_position(rotation, units, velocity, units_v, wait) command spins all motors in the group to an absolute position using the provided arguments.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
电机旋转的位置。 |
|
Optional. A valid |
|
**可选。**使用此速度旋转电机,如果未提供,则将使用 set_velocity 设置的默认速度。 |
|
Optional. A valid |
|
Optional. Determines whether the command will block subsequent commands ( |
**返回:**无。
电机组.spin_for()#
The motor_group.spin_for(direction, value, units, velocity, units_v, wait) command spins all motors in the group to a relative position using the provided arguments.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
A valid |
|
电机组旋转的值。 |
|
Optional. A valid |
|
**可选。**使用此速度旋转电机,如果未提供,则将使用 set_velocity 设置的默认速度。 |
|
Optional. A valid |
|
Optional. Determines whether the command will block subsequent commands ( |
**返回:**无。
# Spin 180 degrees from the current position.
motor_group_1.spin_for(FORWARD, 180)
电机组.停止()#
The motor_group.stop() command is used to stop a motor group.
这是一个非等待命令,允许下一个命令无延迟运行。
**返回:**无。
# Spin the motor group forward for 2 seconds.
motor_group_1.spin(FORWARD)
wait(2, SECOND)
# Stop spinning the motor group.
motor_group_1.stop()
电机组.count()#
The motor_group.count() command returns the number of motors in the group.
这是一个非等待命令,允许下一个命令无延迟运行。
**返回:**组中的电机数量。
电机组.设置速度()#
The motor_group.set_velocity(velocity, units) command sets the default velocity for all motors in the group. This will be the velocity used for subsequent calls to spin if a velocity is not provided to that function.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
为电机组设置的新速度。 |
|
Optional. A valid |
**返回:**无。
电机组.设置停止()#
The motor_group.set_stopping(mode) command sets the stopping mode for all motors in the group. Setting the action for the motor when stopped.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
A valid |
**返回:**无。
电机组.重置位置()#
The motor_group.reset_position() command resets the motor group position to 0.
这是一个非等待命令,允许下一个命令无延迟运行。
**返回:**无。
电机组.设置位置()#
The motor_group.set_position(value, units) command sets the current position for all motors in the group. The position returned by the motor_group.position() function is set to this value.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
新的职位。 |
|
Optional. A valid |
**返回:**无。
电机组.设置超时()#
The motor_group.set_timeout(timeout, units) command sets the timeout value used for all motors in the group.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
新的超时。 |
|
Optional. A valid |
**返回:**无。
电机组正在旋转()#
The motor_group.is_spinning() command returns if the motor group is currently spinning.
这是一个非等待命令,允许下一个命令无延迟运行。
Returns: True if the motor group is currently spinning. False if it is not.
电机组.is_done()#
The motor_group.is_done() command returns if the motor group has completed its movement.
这是一个非等待命令,允许下一个命令无延迟运行。
Returns: True if the motor group has completed its movement. False if it has not.
电机组.设置最大扭矩()#
The motor_group.set_max_torque(value, units) command sets the maximum torque all motors in the group will use. The torque can be set as torque, current, or percent of maximum.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
新的最大使用扭矩。 |
|
Optional. A valid |
**返回:**无。
电机组.方向()#
The motor_group.direction() command returns the current direction the motor group is spinning in.
这是一个非等待命令,允许下一个命令无延迟运行。
Returns: The current DirectionType the motor group is spinning in.
电机组.位置()#
The motor_group.position(units) command returns the position of the first motor.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
Optional. A valid |
返回: 以指定单位表示的电机组的当前位置。
电机组.速度()#
The motor_group.velocity(units) command returns the current velocity of the motor group.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
Optional. A valid |
**返回:**以指定单位表示的电机组当前速度。
电机组.电流()#
The motor_group.current(units) command returns the current being used by the motor group.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
Optional. The only valid unit for current is |
返回: 电机组以指定单位吸收的电流。
电机组.功率()#
The motor_group.power(units) command returns the power being consumed by the motor group.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
Optional. The only valid unit for power is |
**返回:**电机组以指定单位消耗的功率。
电机组.扭矩()#
The motor_group.torque(units) command returns the torque the first motor is providing.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
Optional. A valid |
**返回:**电机组以指定单位产生的扭矩。
电机组.效率()#
The motor_group.efficiency(units) command returns the efficiency of the motor group.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
Optional. The only valid unit for efficiency is |
**返回:**电机组的效率百分比。
电机组.温度()#
The motor_group.temperature(units) command returns the temperature of the motor group.
这是一个非等待命令,允许下一个命令无延迟运行。
参数 |
描述 |
|---|---|
|
Optional. A valid |
**返回:**以指定单位表示的电机组温度。