Motor¶
Class Documentation¶
-
class
compLib.Motor.
Motor
¶ Class used to control the motors
-
static
active_break
(port: int)¶ Actively break with a specific motor
- Parameters
port – Port, which the motor is connected to. 1-4
-
static
all_off
()¶ Turns of all motors
-
static
get_motor_curve
()¶ Get the currently active motor curve. Check set_motor_curve() for more info.
- Returns
current motor curve
-
static
power
(port: int, percent: float)¶ Set specified motor to percentage power, percentage is linearized so that it’s roughly proportional to the speed
- Parameters
port – Port, which the motor is connected to. 1-4
percent – Percentage of max speed. between -100 and 100
- Raises
IndexError
-
static
power_raw
(port: int, percent: float, log_metric=True)¶ Set specified motor to percentage power
- Parameters
port – Port, which the motor is connected to. 1-4
percent – Percentage of max speed. between -100 and 100
- Raises
IndexError
-
static
pwm
(port: int, pwm: int, mode: compLib.Motor.MotorMode)¶ Set specified motor to a specific pwm value and motor mode
- Parameters
port – Port, which the motor is connected to. 1-4 allowed
pwm – Raw PWM value which the motor should be set to. From 0 to 2^16 - 1
mode – Motor mode. See enum MotorMode for more info
- Raises
IndexError
-
static
set_motor_curve
(curve)¶ Set the global motor curve, must be a float array with exactly 21 elements. [0] = x ticks/s (0% power) [1] = x ticks/s (5% power) [2] = x ticks/s (10% power) … [20] = x ticks/s (100% power)
- Parameters
curve – float array with 21 elements
- Raises
ValueError
-
static