MotorGroup#

To make MotorGroup commands appear in VEXcode V5, a Motor must be configured in the Devices window.

For more information, refer to these articles:

motor_group.spin()#

The motor_group.spin(direction, velocity, units) command spins all motors in the group using the provided arguments.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

direction

A valid DirectionType.

velocity

Optional. Spin the motor using this velocity, the default velocity set by motor_group.set_velocity will be used if not provided.

units

Optional. A valid VelocityUnit. The default is RPM.

Returns: None.

# 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()

motor_group.spin_to_position()#

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.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

rotation

The position to spin the motor to.

units

Optional. A valid RotationUnit. The default is DEGREES.

velocity

Optional. Spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.

units_v

Optional. A valid VelocityUnit. The default is RPM.

wait

Optional. Determines whether the command will block subsequent commands (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait=True.

Returns: None.

motor_group.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.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

direction

A valid DirectionType.

value

The value for the motor group to spin to.

units

Optional. A valid RotationUnit. The default is DEGREES.

velocity

Optional. Spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.

units_v

Optional. A valid VelocityUnit. The default is RPM.

wait

Optional. Determines whether the command will block subsequent commands (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait=True.

Returns: None.

# Spin 180 degrees from the current position.
motor_group_1.spin_for(FORWARD, 180)

motor_group.stop()#

The motor_group.stop() command is used to stop a motor group.

This is a non-waiting command and allows the next command to run without delay.

Returns: None.

# 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()

motor_group.count()#

The motor_group.count() command returns the number of motors in the group.

This is a non-waiting command and allows the next command to run without delay.

Returns: The number of motors in the group.

motor_group.set_velocity()#

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.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

velocity

The new velocity to set for the motor group.

units

Optional. A valid VelocityUnit. The default is RPM.

Returns: None.

motor_group.set_stopping()#

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.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

mode

A valid BrakeType. The default is COAST.

Returns: None.

motor_group.reset_position()#

The motor_group.reset_position() command resets the motor group position to 0.

This is a non-waiting command and allows the next command to run without delay.

Returns: None.

motor_group.set_position()#

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.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

value

The new position.

units

Optional. A valid RotationUnit. The default is DEGREES.

Returns: None.

motor_group.set_timeout()#

The motor_group.set_timeout(timeout, units) command sets the timeout value used for all motors in the group.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

timeout

The new timeout.

units

Optional. A valid TimeUnit. The default is MSEC.

Returns: None.

motor_group.is_spinning()#

The motor_group.is_spinning() command returns if the motor group is currently spinning.

This is a non-waiting command and allows the next command to run without delay.

Returns: True if the motor group is currently spinning. False if it is not.

motor_group.is_done()#

The motor_group.is_done() command returns if the motor group has completed its movement.

This is a non-waiting command and allows the next command to run without delay.

Returns: True if the motor group has completed its movement. False if it has not.

motor_group.set_max_torque()#

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.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

value

The new maximum torque to use.

units

Optional. A valid TorqueUnit, AMP, or PERCENT.

Returns: None.

motor_group.direction()#

The motor_group.direction() command returns the current direction the motor group is spinning in.

This is a non-waiting command and allows the next command to run without delay.

Returns: The current DirectionType the motor group is spinning in.

motor_group.position()#

The motor_group.position(units) command returns the position of the first motor.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

units

Optional. A valid RotationUnit. The default is DEGREES.

Returns: The current position of the motor group in the specified units.

motor_group.velocity()#

The motor_group.velocity(units) command returns the current velocity of the motor group.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

units

Optional. A valid VelocityUnit. The default is RPM.

Returns: The current velocity of the motor group in the specified units.

motor_group.current()#

The motor_group.current(units) command returns the current being used by the motor group.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

units

Optional. The only valid unit for current is AMP.

Returns: The current being drawn by the motor group in the specified units.

motor_group.power()#

The motor_group.power(units) command returns the power being consumed by the motor group.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

units

Optional. The only valid unit for power is WATT.

Returns: The power being consumed by the motor group in the specified units.

motor_group.torque()#

The motor_group.torque(units) command returns the torque the first motor is providing.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

units

Optional. A valid TorqueUnit. The default is NM.

Returns: The torque being generated by the motor group in the specified units.

motor_group.efficiency()#

The motor_group.efficiency(units) command returns the efficiency of the motor group.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

units

Optional. The only valid unit for efficiency is PERCENT.

Returns: The efficiency of the motor group as a percent.

motor_group.temperature()#

The motor_group.temperature(units) command returns the temperature of the motor group.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

units

Optional. A valid TemperatureUnit. The default is CELSIUS.

Returns: The temperature of the motor group in the specified units.