VEX IQ 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 | timeout (self, timeUnits=TimeUnits.SEC) |
def | did_timeout (self) |
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_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_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_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) |
Determines if any motor in the group is performin a spin_for/spin_to command. 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_percent (self, value) |
Sets the max torque of all motors as a percentage. More... | |
def | set_max_torque (self, value, torqueUnits=TorqueUnits.NM) |
Sets the max torque of all motors. More... | |
def | set_max_torque_current (self, value) |
Sets the max torque of all motors. 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) |
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.timeout | ( | self, | |
timeUnits = TimeUnits.SEC |
|||
) |
def motor_group.MotorGroup.did_timeout | ( | self | ) |
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_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_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_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 | ) |
Determines if any motor in the group is performin a spin_for/spin_to command.
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_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 | ( | 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_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.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 | ) |