controllables.MotorBase

class controllables.MotorBase(port: Optional[int] = None, sub_class: Optional[type] = None)

Base class for motor references.

spin(power: float = 1)

Sends a signal to spin the motor. power should be set to a float from -1 to 1 representing the proportion of max velocity at which the motor will run. Negative values run the motor backwards.

from controllables import MotorBase
import time

motor = MotorBase(0)

motor.spin()
time.sleep(1)
motor.stop()
stop()

Stops running the motor.

Note

If a transmitter is running the motor, this will not stop it.

from controllables import MotorBase
import time

motor = MotorBase(0)

motor.spin()
time.sleep(1)
motor.stop()
velocity() → float

Returns the angular velocity of the motor in radians per second.

rpm() → float

Returns the angular velocity of the motor in rotations per minute.

angle() → float

Returns the angle of the motor in radians.

degrees() → float

Returns the angle of the motor in degrees.

property flipped: bool

The flip property of the motor avaliable in the properties tab.

property max_velocity: float

The maximum angular velocity of the motor in radians per second.

property max_rpm: float

The max rpm property of the motor avaliable in the properties tab.

property max_torque: float

The max torque (in newton meters) property of the motor avaliable in the properties tab.

property acceleration_time: float

The acceleration time (in seconds) property of the motor avaliable in the properties tab.

name() → str

Returns the user editable name of the controllable as found in the properties tab of the game.

from ports import PortReference

print(PortReference(0).name())