VEX V5 Python API
|
Public Member Functions | |
def | __init__ (self, motors) |
def | count (self) |
return the number of motors in the motor group More... | |
def | set_velocity (self, velocity, velocityUnits=VelocityUnits.PCT) |
Sets the velocity of the motor group based on the parameters set in the command. More... | |
def | set_stopping (self, brakeType) |
Sets the stopping mode of the motor group by passing a brake mode as a parameter. More... | |
def | reset_rotation (self) |
Resets all motor encoders to the value of zero. More... | |
def | set_rotation (self, value, rotationUnits=RotationUnits.DEG) |
Sets the value of all motor encoders to the value specified in the parameter. More... | |
def | set_timeout (self, time, timeUnits=TimeUnits.SEC) |
Sets the timeout for the motor group. More... | |
def | spin (self, dir, velocity=None, velocityUnits=VelocityUnits.PCT) |
Turn on the motors and spins them in the specified direction and a specified velocity. More... | |
def | spin_with_voltage (self, dir, voltage, voltageUnits=VoltageUnits.VOLT) |
Turns on the motors and spins them in a specified direction and a specified voltage. More... | |
def | spin_to (self, rotation, rotationUnits=RotationUnits.DEG, velocity=None, velocityUnits=VelocityUnits.PCT, waitForCompletion=True) |
Turns on the motors and spin them to an absolute target rotation value at a specified velocity. More... | |
def | spin_to_position (self, rotation, rotationUnits=RotationUnits.DEG, velocity=None, velocityUnits=VelocityUnits.PCT, waitForCompletion=True) |
Turns on the motors and spins them to an absolute target rotation value at a specified velocity. More... | |
def | spin_for (self, dir, rotation, rotationUnits=RotationUnits.DEG, velocity=None, velocityUnits=VelocityUnits.PCT, waitForCompletion=True) |
Turn on the motors and spin them to a relative target rotation value at a specified velocity. More... | |
def | spin_for_time (self, dir, time, timeUnits=TimeUnits.SEC, velocity=None, velocityUnits=VelocityUnits.PCT) |
Turn on the motors and spin them for a given amount of time. More... | |
def | start_spin_to (self, rotation, rotationUnits=RotationUnits.DEG, velocity=None, velocityUnits=VelocityUnits.PCT) |
Starts spinning motors to an absolute target rotation but does not wait for the motors to reach that target. More... | |
def | start_spin_to_position (self, rotation, rotationUnits=RotationUnits.DEG, velocity=None, velocityUnits=VelocityUnits.PCT) |
Starts spinning a motor to an absolute target rotation but does not wait for the motor to reach that target. More... | |
def | start_spin_for (self, dir, rotation, rotationUnits=RotationUnits.DEG, velocity=None, velocityUnits=VelocityUnits.PCT) |
Starts spinning motors to a relative target rotation but does not wait for the motors to reach that target. More... | |
def | is_spinning (self) |
Checks to see if a spin_for/spin_to command is still in process, i.e. More... | |
def | is_done (self) |
Determines if a spin_for/spin_to command has reached its target position. More... | |
def | stop (self, brakeType=None) |
Stops all motors using the default brake mode. More... | |
def | set_max_torque (self, value, torqueUnits=TorqueUnits.NM) |
Sets the max torque of all motors. More... | |
def | set_max_torque_percent (self, value) |
Sets the max torque of all motors as a percentage. More... | |
def | set_max_torque_current (self, value) |
Sets the max torque of all motors. More... | |
def | direction (self) |
Gets which direction the first motor is spinning. More... | |
def | rotation (self, rotationUnits=RotationUnits.DEG) |
Gets the current rotation of the first motor in the group's encoder. More... | |
def | velocity (self, velocityUnits=VelocityUnits.PCT) |
Gets the current velocity of the first motor in the group. More... | |
def | current (self) |
Gets the sum electrical current for all motors in the group. More... | |
def | power (self, powerUnits=PowerUnits.WATT) |
Gets the power of the first motor. More... | |
def | torque (self, torqueUnits=TorqueUnits.NM) |
Gets the torque of the first motor. More... | |
def | efficiency (self, percentUnits=PercentUnits.PCT) |
Gets the efficiency of the first motor. More... | |
def | temperature (self, temperatureUnits=TemperatureUnits.CELSIUS) |
Gets the temperature of the motor. More... | |
Creates a new motor group with specified motors @param motors a list or tuple of motors in the group
def motor_group.MotorGroup.__init__ | ( | self, | |
motors | |||
) |
def motor_group.MotorGroup.count | ( | self | ) |
return the number of motors in the motor group
def motor_group.MotorGroup.set_velocity | ( | self, | |
velocity, | |||
velocityUnits = VelocityUnits.PCT |
|||
) |
Sets the velocity of the motor group 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.
velocity | Sets the amount of velocity. |
velocityUnits | The measurement unit for velocity, a VelocityUnits enum value. |
def motor_group.MotorGroup.set_stopping | ( | self, | |
brakeType | |||
) |
Sets the stopping mode of the motor group by passing a brake mode as a parameter.
brakeType | The stopping mode can be set to BrakeType.COAST , BRAKE , or HOLD . |
def motor_group.MotorGroup.reset_rotation | ( | self | ) |
Resets all motor encoders to the value of zero.
def motor_group.MotorGroup.set_rotation | ( | self, | |
value, | |||
rotationUnits = RotationUnits.DEG |
|||
) |
Sets the value of all motor encoders to the value specified in the parameter.
value | Sets the amount of rotation. |
rotationUnits | The measurement unit for the rotation, a RotationUnits enum value. |
def motor_group.MotorGroup.set_timeout | ( | self, | |
time, | |||
timeUnits = TimeUnits.SEC |
|||
) |
Sets the timeout for the motor group.
If the motor group does not reach its' commanded position prior to the completion of the timeout, the motors will stop.
time | Sets the amount of time. |
timeUnits | The measurement unit for the time, a TimeUnits enum value. |
def motor_group.MotorGroup.spin | ( | self, | |
dir, | |||
velocity = None , |
|||
velocityUnits = VelocityUnits.PCT |
|||
) |
Turn on the motors and spins them in the specified direction and a specified velocity.
dir | The direction to spin the motors, a DirectionType enum value. |
velocity | Sets the amount of velocity. |
velocityUnits | The measurement unit for the velocity, a VelocityUnits enum value. |
def motor_group.MotorGroup.spin_with_voltage | ( | self, | |
dir, | |||
voltage, | |||
voltageUnits = VoltageUnits.VOLT |
|||
) |
Turns on the motors and spins them in a specified direction and a specified voltage.
dir | The direction to spin the motor. |
voltage | Sets the amount of volts. |
voltageUnits | The measurement unit for the voltage value. Optional, default is volts. |
def motor_group.MotorGroup.spin_to | ( | self, | |
rotation, | |||
rotationUnits = RotationUnits.DEG , |
|||
velocity = None , |
|||
velocityUnits = VelocityUnits.PCT , |
|||
waitForCompletion = True |
|||
) |
Turns on the motors and spin them to an absolute target rotation value at a specified velocity.
rotation | Sets the amount of rotation. |
rotationUnits | The measurement unit for the rotation value. |
velocity | Sets the amount of velocity. |
velocityUnits | The measurement unit for the velocity value. |
waitForCompletion | (Optional) If True, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true. |
def motor_group.MotorGroup.spin_to_position | ( | self, | |
rotation, | |||
rotationUnits = RotationUnits.DEG , |
|||
velocity = None , |
|||
velocityUnits = VelocityUnits.PCT , |
|||
waitForCompletion = True |
|||
) |
Turns on the motors and spins them to an absolute target rotation value at a specified velocity.
Same as spinTo
.
rotation | The motor encoder's target rotation value |
rotationUnits | A rotational unit type that defines how the previous value should be treated as. |
velocity | Set the amount of velocity that the motor should use. |
velocityUnits | Set what the motor should treat the previous velocity value as. |
waitForCompletion | (Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true. |
def motor_group.MotorGroup.spin_for | ( | self, | |
dir, | |||
rotation, | |||
rotationUnits = RotationUnits.DEG , |
|||
velocity = None , |
|||
velocityUnits = VelocityUnits.PCT , |
|||
waitForCompletion = True |
|||
) |
Turn on the motors and spin them to a relative target rotation value at a specified velocity.
dir | direction to spin in, a DirectionType enum value or None. |
rotation | Sets the amount of rotation. |
rotationUnits | The measurement unit for the rotation value. |
velocity | Sets the amount of velocity. |
velocityUnits | The measurement unit for the velocity value. |
waitForCompletion | (Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true. |
def motor_group.MotorGroup.spin_for_time | ( | self, | |
dir, | |||
time, | |||
timeUnits = TimeUnits.SEC , |
|||
velocity = None , |
|||
velocityUnits = VelocityUnits.PCT |
|||
) |
Turn on the motors and spin them for a given amount of time.
dir | direction to spin in, a DirectionType enum value or None. |
time | Sets the amount of time. |
timeUnits | The measurement unit for the time value, a TimeUnits enum value. |
velocity | Sets the amount of velocity. |
velocityUnits | The measurement unit for the velocity value, a VelocityUnits enum value. |
def motor_group.MotorGroup.start_spin_to | ( | self, | |
rotation, | |||
rotationUnits = RotationUnits.DEG , |
|||
velocity = None , |
|||
velocityUnits = VelocityUnits.PCT |
|||
) |
Starts spinning motors to an absolute target rotation but does not wait for the motors to reach that target.
rotation | Sets the amount of rotation. |
rotationUnits | The measurement unit for the rotation value. |
velocity | Sets the amount of velocity. |
velocityUnits | The measurement unit for the velocity value. |
def motor_group.MotorGroup.start_spin_to_position | ( | self, | |
rotation, | |||
rotationUnits = RotationUnits.DEG , |
|||
velocity = None , |
|||
velocityUnits = VelocityUnits.PCT |
|||
) |
Starts spinning a motor to an absolute target rotation but does not wait for the motor to reach that target.
Same as startSpinTo
rotation | This is the motor encoder's target rotation value |
rotationUnits | This is a rotational unit type that defines how the previous value should be treated as. |
velocity | Set the amount of velocity that the motor should use. |
velocityUnits | Set what the motor should treat the previous velocity value as. |
def motor_group.MotorGroup.start_spin_for | ( | self, | |
dir, | |||
rotation, | |||
rotationUnits = RotationUnits.DEG , |
|||
velocity = None , |
|||
velocityUnits = VelocityUnits.PCT |
|||
) |
Starts spinning motors to a relative target rotation but does not wait for the motors to reach that target.
dir | direction to spin in, a DirectionType enum value or None. |
rotation | Sets the amount of rotation. |
rotationUnits | The measurement unit for the rotation value. |
velocity | Sets the amount of velocity. |
velocityUnits | The measurement unit for the velocity value. |
def motor_group.MotorGroup.is_spinning | ( | self | ) |
Checks to see if a spin_for/spin_to command is still in process, i.e.
any motor is still rotating and hasn't yet reached its target position.
def motor_group.MotorGroup.is_done | ( | self | ) |
Determines if a spin_for/spin_to command has reached its target position.
def motor_group.MotorGroup.stop | ( | self, | |
brakeType = None |
|||
) |
Stops all motors using the default brake mode.
brakeType | The brake mode can be set to BrakeType.COAST, BRAKE, or HOLD. |
def motor_group.MotorGroup.set_max_torque | ( | self, | |
value, | |||
torqueUnits = TorqueUnits.NM |
|||
) |
Sets the max torque of all motors.
value | Sets the amount of torque (max 0.414 Nm) |
torqueUnits | The measurement unit for the torque value. |
def motor_group.MotorGroup.set_max_torque_percent | ( | self, | |
value | |||
) |
Sets the max torque of all motors as a percentage.
value | Sets the amount of torque (0 to 100%) |
def motor_group.MotorGroup.set_max_torque_current | ( | self, | |
value | |||
) |
Sets the max torque of all motors.
value | Sets the amount of torque in Amps (max 1.2A) |
def motor_group.MotorGroup.direction | ( | self | ) |
Gets which direction the first motor is spinning.
def motor_group.MotorGroup.rotation | ( | self, | |
rotationUnits = RotationUnits.DEG |
|||
) |
Gets the current rotation of the first motor in the group's encoder.
rotationUnits | The measurement unit for the rotation. |
def motor_group.MotorGroup.velocity | ( | self, | |
velocityUnits = VelocityUnits.PCT |
|||
) |
Gets the current velocity of the first motor in the group.
velocityUnits | The measurement unit for the velocity. |
def motor_group.MotorGroup.current | ( | self | ) |
Gets the sum electrical current for all motors in the group.
def motor_group.MotorGroup.power | ( | self, | |
powerUnits = PowerUnits.WATT |
|||
) |
Gets the power of the first motor.
powerUnits |
def motor_group.MotorGroup.torque | ( | self, | |
torqueUnits = TorqueUnits.NM |
|||
) |
Gets the torque of the first motor.
torqueUnits | Defines the unit type of torque to be returned. |
def motor_group.MotorGroup.efficiency | ( | self, | |
percentUnits = PercentUnits.PCT |
|||
) |
Gets the efficiency of the first motor.
percentUnits | Defines the unit type of the efficiency value to be returned. |
def motor_group.MotorGroup.temperature | ( | self, | |
temperatureUnits = TemperatureUnits.CELSIUS |
|||
) |
Gets the temperature of the motor.
temperatureUnits | Defines the unit type of the temperature value to be returned. Default Celsius. |