VEX IQ Python API
|
Config Motor with power setting and distance encoder More...
Public Member Functions | |
def | __init__ (self, port=None, switch_polarity=False) |
def | off (self) |
Turn off motor. More... | |
def | brake (self) |
Brake motor. More... | |
def | hold (self) |
Hold motor. More... | |
def | run (self, power, distance=None, hold=False) |
Begin running at the given power. More... | |
def | run_until (self, power, distance, hold=False) |
Run at a given power until the given distance is reached. More... | |
def | run_raw (self, power_raw, distance_ticks=None, hold=False) |
Begin running at given raw power, with distance in ticks. More... | |
def | run_raw_until (self, power, distance_ticks, hold=False) |
Run at a given raw power until the given distance is reached. More... | |
def | run_to_position (self, power, position, hold=False) |
Begin running the motor until it reaches an absolute position. More... | |
def | run_until_position (self, power, position, hold=False) |
Run the motor until it reaches an absolute position. More... | |
def | run_time (self, power, time, hold=False) |
Begin running at given power for given time. More... | |
def | run_until_time (self, power, time, hold=False) |
Run at given power until given time is reached. 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 set in the motor.stall_timeout field. More... | |
def | position (self) |
Get the current motor position in degrees. More... | |
def | position_ticks (self) |
Get the current motor position in ticks, 960 per full rotation. More... | |
def | reset_position (self) |
Reset the motor position to zero. More... | |
def | velocity (self) |
Get the current motor velocity. More... | |
def | current (self) |
Get the electrical current. More... | |
def | set_max_current (self, current) |
Set the maximum current setting. More... | |
Public Attributes | |
stall_timeout | |
Config Motor with power setting and distance encoder
port | 1-12, None to autodetect. Default None. |
switch_polarity | True to reverse polarity (direction). Default False. |
def vexiq.Motor.__init__ | ( | self, | |
port = None , |
|||
switch_polarity = False |
|||
) |
def vexiq.Motor.off | ( | self | ) |
Turn off motor.
def vexiq.Motor.brake | ( | self | ) |
Brake motor.
def vexiq.Motor.hold | ( | self | ) |
Hold motor.
def vexiq.Motor.run | ( | self, | |
power, | |||
distance = None , |
|||
hold = False |
|||
) |
Begin running at the given power.
power | -100.0...100.0 (percent power). |
distance | distance in degrees |
hold | if True, hold motor when destination is reached |
def vexiq.Motor.run_until | ( | self, | |
power, | |||
distance, | |||
hold = False |
|||
) |
Run at a given power until the given distance is reached.
power | -100.0...100.0 (percent power). |
distance | distance in degrees |
hold | if True, hold motor when destination is reached |
def vexiq.Motor.run_raw | ( | self, | |
power_raw, | |||
distance_ticks = None , |
|||
hold = False |
|||
) |
Begin running at given raw power, with distance in ticks.
power_raw | -127...127 |
distance_ticks | distance in ticks, 960 per full rotation |
hold | if True, hold motor when destination is reached |
def vexiq.Motor.run_raw_until | ( | self, | |
power, | |||
distance_ticks, | |||
hold = False |
|||
) |
Run at a given raw power until the given distance is reached.
power | -100.0...100.0 (percent power). |
distance_ticks | distance in ticks, 960 per full rotation |
hold | if True, hold motor when destination is reached |
def vexiq.Motor.run_to_position | ( | self, | |
power, | |||
position, | |||
hold = False |
|||
) |
Begin running the motor until it reaches an absolute position.
power | 0...100.0 (percent power). |
position | absolute target position in degrees |
hold | if True, hold motor when destination is reached |
def vexiq.Motor.run_until_position | ( | self, | |
power, | |||
position, | |||
hold = False |
|||
) |
Run the motor until it reaches an absolute position.
power | 0...100.0 (percent power). |
position | absolute target position in degrees |
hold | if True, hold motor when destination is reached |
def vexiq.Motor.run_time | ( | self, | |
power, | |||
time, | |||
hold = False |
|||
) |
Begin running at given power for given time.
power | -100.0...100.0 (percent power). |
time | time to run in seconds |
hold | if True, hold motor when destination is reached |
def vexiq.Motor.run_until_time | ( | self, | |
power, | |||
time, | |||
hold = False |
|||
) |
Run at given power until given time is reached.
power | -100.0...100.0 (percent power). |
time | time to run in seconds |
hold | if True, hold motor when destination is reached |
def vexiq.Motor.reached_target | ( | self | ) |
True if the motor reached the target, False otherwise.
def vexiq.Motor.stalled | ( | self | ) |
True if motor has stalled (did not change position) for the duration set in the motor.stall_timeout field.
def vexiq.Motor.reached_target_or_stalled | ( | self | ) |
True if motor reached the target or stalled (did not change position) for the duration set in the motor.stall_timeout field.
def vexiq.Motor.position | ( | self | ) |
Get the current motor position in degrees.
def vexiq.Motor.position_ticks | ( | self | ) |
Get the current motor position in ticks, 960 per full rotation.
def vexiq.Motor.reset_position | ( | self | ) |
Reset the motor position to zero.
def vexiq.Motor.velocity | ( | self | ) |
Get the current motor velocity.
def vexiq.Motor.current | ( | self | ) |
Get the electrical current.
def vexiq.Motor.set_max_current | ( | self, | |
current | |||
) |
Set the maximum current setting.
current | maximum current |
vexiq.Motor.stall_timeout |