blimputils.motor
Minimal Motor module for the blimp-utils library, specifically for the Texas Instruments DRV8212p Motor Driver, tailored to run test_motor_functionality.py on a Raspberry Pi Zero 2W.
- class blimputils.motor.Motor(in1_pin: int, in2_pin: int, pi_instance: pigpio.pi)
Bases:
object
Motor class for controlling a single motor connected via DRV8212p. Assumes pigpio daemon is running (sudo pigpiod). After calling Motor.init(), initialized motor instances are available via Motor.instances dict.
- PREDEFINED_MOTORS_PINS = {'motor1': {'pin1': 21, 'pin2': 13}, 'motor2': {'pin1': 20, 'pin2': 6}, 'motor3': {'pin1': 16, 'pin2': 5}, 'motor4': {'pin1': 19, 'pin2': 26}}
- VALID_RAMPS = ['linear', 'quadratic', 'log', 'bezier']
- instances = {}
- spin(target_speed: int, ramp_type: str = None, ramp_duration: float = 0)
- stop()
Stops the motor immediately and updates current_speed.
- static init()
- static cleanup()