VEX EDR Python API
|
Config Encoder motor that tracks distance covered. More...
Public Member Functions | |
def | __init__ (self, motornum, switch_polarity=False) |
def | off (self) |
Turn off. More... | |
def | run (self, power, distance=None) |
Begin running at given power. More... | |
def | run_until (self, power, distance) |
Run at given power until the given distance is reached. More... | |
def | run_raw (self, power_raw, distance=None) |
Begin running at given raw power. More... | |
def | run_raw_until (self, power_raw, distance) |
Run at given raw power until the given distance is reached. More... | |
def | run_sync (self, power, distance, motor_slave=None, motor_slave_rev=None) |
Begin running at given power for given distance, sync with other motors. More... | |
def | run_sync_until (self, power, distance, motor_slave=None, motor_slave_rev=None) |
Run at given power until the given distance is reached, sync with other motors. More... | |
def | run_sync_raw (self, power_raw, distance, motor_slave=None, motor_slave_rev=None) |
Begin running at given power for given distance, sync with other motors. More... | |
def | run_sync_raw_until (self, power_raw, distance, motor_slave=None, motor_slave_rev=None) |
Run at given raw power until the given distance is reached, sync with other motors. More... | |
def | reached_target (self) |
True if the motor reached the target, False otherwise. More... | |
def | stalled (self) |
True if motor has stalled (did not change position) for the duration set in the motor.stall_timeout field. More... | |
def | reached_target_or_stalled (self) |
True if motor reached the target or stalled (did not change position) for the duration in the motor.stall_timeout field. More... | |
def | position (self) |
Get the current encoder position (dinstance) in ticks. More... | |
def | reset_position (self) |
Reset the motor position to zero. More... | |
Public Attributes | |
stall_timeout | |
Config Encoder motor that tracks distance covered.
motornum | motor port the motor is connected to (1-10) |
switch_polarity | if True, switch the polarity (direction) of the motor. Default False. |
def vex.EncoderMotor.__init__ | ( | self, | |
motornum, | |||
switch_polarity = False |
|||
) |
def vex.EncoderMotor.off | ( | self | ) |
Turn off.
def vex.EncoderMotor.run | ( | self, | |
power, | |||
distance = None |
|||
) |
Begin running at given power.
power | -100.0...100.0 (percent power). |
distance | distance in ticks (encoder motors only) |
def vex.EncoderMotor.run_until | ( | self, | |
power, | |||
distance | |||
) |
Run at given power until the given distance is reached.
power | -100.0...100.0 (percent power). |
distance | distance in ticks |
def vex.EncoderMotor.run_raw | ( | self, | |
power_raw, | |||
distance = None |
|||
) |
Begin running at given raw power.
power_raw | -127.0...127.0 (raw power). |
distance | distance in ticks (encoder motors only) |
def vex.EncoderMotor.run_raw_until | ( | self, | |
power_raw, | |||
distance | |||
) |
Run at given raw power until the given distance is reached.
power_raw | -127.0...127.0 (raw power). |
distance | distance in ticks (encoder motors only) |
def vex.EncoderMotor.run_sync | ( | self, | |
power, | |||
distance, | |||
motor_slave = None , |
|||
motor_slave_rev = None |
|||
) |
Begin running at given power for given distance, sync with other motors.
power | -100.0...100.0 (percent power) |
distance | distance in ticks |
motor_slave | motor to run for the same distance. Pass either None, a single motor, or a list of motors. |
motor_slave_rev | motor to run for the same distance in reverse. Pass either None, a single motor, or a list of motors. |
def vex.EncoderMotor.run_sync_until | ( | self, | |
power, | |||
distance, | |||
motor_slave = None , |
|||
motor_slave_rev = None |
|||
) |
Run at given power until the given distance is reached, sync with other motors.
power | -100.0...100.0 (percent power) |
distance | distance in ticks |
motor_slave | motor to run for the same distance. Pass either None, a single motor, or a list of motors. |
motor_slave_rev | motor to run for the same distance in reverse. Pass either None, a single motor, or a list of motors. |
def vex.EncoderMotor.run_sync_raw | ( | self, | |
power_raw, | |||
distance, | |||
motor_slave = None , |
|||
motor_slave_rev = None |
|||
) |
Begin running at given power for given distance, sync with other motors.
power_raw | -127.0...127.0 (raw power). |
distance | distance in ticks |
motor_slave | motor to run for the same distance. Pass either None, a single motor, or a list of motors. |
motor_slave_rev | motor to run for the same distance in reverse. Pass either None, a single motor, or a list of motors. |
def vex.EncoderMotor.run_sync_raw_until | ( | self, | |
power_raw, | |||
distance, | |||
motor_slave = None , |
|||
motor_slave_rev = None |
|||
) |
Run at given raw power until the given distance is reached, sync with other motors.
power_raw | -127.0...127.0 (raw power). |
distance | distance in ticks |
motor_slave | motor to run for the same distance. Pass either None, a single motor, or a list of motors. |
motor_slave_rev | motor to run for the same distance in reverse. Pass either None, a single motor, or a list of motors. |
def vex.EncoderMotor.reached_target | ( | self | ) |
True if the motor reached the target, False otherwise.
def vex.EncoderMotor.stalled | ( | self | ) |
True if motor has stalled (did not change position) for the duration set in the motor.stall_timeout field.
def vex.EncoderMotor.reached_target_or_stalled | ( | self | ) |
True if motor reached the target or stalled (did not change position) for the duration in the motor.stall_timeout field.
def vex.EncoderMotor.position | ( | self | ) |
Get the current encoder position (dinstance) in ticks.
def vex.EncoderMotor.reset_position | ( | self | ) |
Reset the motor position to zero.
vex.EncoderMotor.stall_timeout |