|
VEX IQ Python API
|
Creates a new drivetrain object. More...
Public Member Functions | |
| def | __init__ (self, left_motor, right_motor, wheel_travel=200, track_width=176, distanceUnits=DistanceUnits.MM, gear_ratio=1.0) |
| def | drive (self, directionType, velocity=None, velocityUnits=VelocityUnits.PCT) |
| Turns the motors on and drives in the specified direction. More... | |
| def | drive_for (self, directionType, distance, distanceUnits=DistanceUnits.MM, velocity=None, velocityUnits=VelocityUnits.PCT, waitForCompletion=True) |
| Drives for a specified distance. More... | |
| def | start_drive_for (self, directionType, distance, distanceUnits=DistanceUnits.MM, velocity=None, velocityUnits=VelocityUnits.PCT) |
| Start driving for a specified distance. More... | |
| def | turn (self, turnType, velocity=None, velocityUnits=VelocityUnits.PCT) |
| Turn the drivetrain left or right. More... | |
| def | turn_for (self, turnType, angle, rotationUnits=RotationUnits.DEG, velocity=None, velocityUnits=VelocityUnits.PCT, waitForCompletion=True) |
| Turn the drivetrain left or right until the specified angle is reached. More... | |
| def | start_turn_for (self, turnType, angle, angleUnits=RotationUnits.DEG, velocity=None, velocityUnits=VelocityUnits.PCT) |
| Start turning the drivetrain left or right unitl the specified angle is reached. More... | |
| def | arcade (self, drivePower, turnPower) |
| Drive in arcade mode, normally corresponding to two controller joystick axis values. More... | |
| def | stop (self, brakeType=None) |
| Stops the drive using a specified brake mode. More... | |
| def | set_gear_ratio (self, gear_ratio) |
| Sets the external gear ratio of the drivetrain. More... | |
| def | set_drive_velocity (self, velocity, velocityUnits=VelocityUnits.PCT) |
| Sets the velocity of the drive. More... | |
| def | set_turn_velocity (self, velocity, velocityUnits=VelocityUnits.PCT) |
| Sets the velocity of the turn. More... | |
| def | set_timeout (self, time, timeUnits=TimeUnits.SEC) |
| Sets the timeout for the drivetrain. More... | |
| def | timeout (self, timeUnits=TimeUnits.SEC) |
| Returns a timeout in given time units. More... | |
| def | did_timeout (self) |
| True if the last drivetrain operation timed out, False otherwise. More... | |
| def | is_done (self) |
| True if drivetrain is done driving/turning to a specified target, False otherwise. More... | |
| def | set_stopping (self, brakeType) |
| Sets the stopping mode of the motor group by passing a brake mode as a parameter. More... | |
| def | velocity (self, velocityUnits=VelocityUnits.PCT) |
| Gets the average current velocity of all motors. More... | |
| def | current (self) |
| Gets the electrical current of all motors. More... | |
Creates a new drivetrain object.
| left_motor | the motor, motor group or a list/tuple of motors driving the left side of the drivetrain |
| right_motor | the motor, motor group or a list/tuple of motors driving the right side of the drivetrain |
| wheel_travel | circumference of the wheel type used |
| track_width | distance between the wheels on opposite sides |
| distanceUnits | unit for wheel_travel and track_with, a DistanceUnits enum value |
| gear_ratio | external gear ratio, usually 1.0 |
| def drivetrain.Drivetrain.__init__ | ( | self, | |
| left_motor, | |||
| right_motor, | |||
wheel_travel = 200, |
|||
track_width = 176, |
|||
distanceUnits = DistanceUnits.MM, |
|||
gear_ratio = 1.0 |
|||
| ) |
| def drivetrain.Drivetrain.drive | ( | self, | |
| directionType, | |||
velocity = None, |
|||
velocityUnits = VelocityUnits.PCT |
|||
| ) |
Turns the motors on and drives in the specified direction.
| directionType | direction to drive in, forward or reverse, a DirectionType enum value |
| velocity | set velocity of the motors |
| velocityUnits | unit for the velocity parameter, a VelocityUnits enum value |
| def drivetrain.Drivetrain.drive_for | ( | self, | |
| directionType, | |||
| distance, | |||
distanceUnits = DistanceUnits.MM, |
|||
velocity = None, |
|||
velocityUnits = VelocityUnits.PCT, |
|||
waitForCompletion = True |
|||
| ) |
Drives for a specified distance.
| directionType | direction to drive in, forward or reverse, a DirectionType enum value |
| distance | distance to drive in |
| distanceUnits | unit for the distance parameter, a DistanceUnits enum value |
| velocity | set velocity of the motors |
| velocityUnits | unit for the velocity parameter, a VelocityUnits enum value |
| waitForCompletion | if True, your program will wait until the motor reaches the target rotational value, otherwise it will continue immediately. |
| def drivetrain.Drivetrain.start_drive_for | ( | self, | |
| directionType, | |||
| distance, | |||
distanceUnits = DistanceUnits.MM, |
|||
velocity = None, |
|||
velocityUnits = VelocityUnits.PCT |
|||
| ) |
Start driving for a specified distance.
| directionType | direction to drive in, forward or reverse, a DirectionType enum value |
| distance | distance to drive in |
| distanceUnits | unit for the distance parameter, a DistanceUnits enum value |
| velocity | set velocity of the motors |
| velocityUnits | unit for the velocity parameter, a VelocityUnits enum value |
| def drivetrain.Drivetrain.turn | ( | self, | |
| turnType, | |||
velocity = None, |
|||
velocityUnits = VelocityUnits.PCT |
|||
| ) |
Turn the drivetrain left or right.
| turnType | direction to turn in, left or right, a TurnType enum value |
| velocity | set velocity of the motors |
| velocityUnits | unit for the velocity parameter, a VelocityUnits enum value |
| def drivetrain.Drivetrain.turn_for | ( | self, | |
| turnType, | |||
| angle, | |||
rotationUnits = RotationUnits.DEG, |
|||
velocity = None, |
|||
velocityUnits = VelocityUnits.PCT, |
|||
waitForCompletion = True |
|||
| ) |
Turn the drivetrain left or right until the specified angle is reached.
| turnType | direction to turn in, left or right, a TurnType enum value |
| angle | sets the angle to turn |
| rotationUnits | units for the angle parameter, a RotationUnits enum value |
| velocity | set velocity of the motors |
| velocityUnits | unit for the velocity parameter, a VelocityUnits enum value |
| waitForCompletion | if True, your program will wait until the motor reaches the target rotational value, otherwise it will continue immediately. |
Reimplemented in smartdrive.Smartdrive.
| def drivetrain.Drivetrain.start_turn_for | ( | self, | |
| turnType, | |||
| angle, | |||
angleUnits = RotationUnits.DEG, |
|||
velocity = None, |
|||
velocityUnits = VelocityUnits.PCT |
|||
| ) |
Start turning the drivetrain left or right unitl the specified angle is reached.
| turnType | direction to turn in, left or right, a TurnType enum value |
| angle | sets the angle to turn |
| angleUnits | units for the angle parameter, a RotationUnits enum value |
| velocity | set velocity of the motors |
| velocityUnits | unit for the velocity parameter, a VelocityUnits enum value |
Reimplemented in smartdrive.Smartdrive.
| def drivetrain.Drivetrain.arcade | ( | self, | |
| drivePower, | |||
| turnPower | |||
| ) |
Drive in arcade mode, normally corresponding to two controller joystick axis values.
| drivePower | percent power to apply to driving, -100..100 |
| turnPower | percent power to apply to turning, -100..100 |
| def drivetrain.Drivetrain.stop | ( | self, | |
brakeType = None |
|||
| ) |
Stops the drive using a specified brake mode.
| brakeType | brake mode, an BrakeType enum value. If omitted, the value set in set_stopping is used. |
| def drivetrain.Drivetrain.set_gear_ratio | ( | self, | |
| gear_ratio | |||
| ) |
Sets the external gear ratio of the drivetrain.
| gear_ratio | gear ratio value, usually 1.0 |
| def drivetrain.Drivetrain.set_drive_velocity | ( | self, | |
| velocity, | |||
velocityUnits = VelocityUnits.PCT |
|||
| ) |
Sets the velocity of the drive.
Will not run the motors. Any subsequent call that does not contain a specified velocity will use this value.
| velocity | Sets the amount of velocity. |
| velocityUnits | unit for the velocity parameter, a VelocityUnits enum value |
| def drivetrain.Drivetrain.set_turn_velocity | ( | self, | |
| velocity, | |||
velocityUnits = VelocityUnits.PCT |
|||
| ) |
Sets the velocity of the turn.
Will not run the motors.
| velocity | Sets the amount of velocity. |
| velocityUnits | unit for the velocity parameter, a VelocityUnits enum value |
| def drivetrain.Drivetrain.set_timeout | ( | self, | |
| time, | |||
timeUnits = TimeUnits.SEC |
|||
| ) |
Sets the timeout for the drivetrain.
If the drivetrain does not reach its' commanded position prior to the completion of the timeout, the motors will stop.
| time | the amount of time. |
| timeUnits | unit for the time parameter, a TimeUnits enum value |
| def drivetrain.Drivetrain.timeout | ( | self, | |
timeUnits = TimeUnits.SEC |
|||
| ) |
Returns a timeout in given time units.
| def drivetrain.Drivetrain.did_timeout | ( | self | ) |
True if the last drivetrain operation timed out, False otherwise.
| def drivetrain.Drivetrain.is_done | ( | self | ) |
True if drivetrain is done driving/turning to a specified target, False otherwise.
Reimplemented in smartdrive.Smartdrive.
| def drivetrain.Drivetrain.set_stopping | ( | self, | |
| brakeType | |||
| ) |
Sets the stopping mode of the motor group by passing a brake mode as a parameter.
| brakeType | the stopping mode, a BrakeType enum value (coast, brake, or hold). |
| def drivetrain.Drivetrain.velocity | ( | self, | |
velocityUnits = VelocityUnits.PCT |
|||
| ) |
Gets the average current velocity of all motors.
| velocityUnits | The measurement unit for the velocity. |
| def drivetrain.Drivetrain.current | ( | self | ) |
Gets the electrical current of all motors.
1.8.15