kuukar-rpi/kuukar_motion.py

29 lines
920 B
Python

from kuukar_config import MOTOR_FL_F, MOTOR_FL_R, MOTOR_FR_F, MOTOR_FR_R, MOTOR_R_F, MOTOR_R_R
from kuukar_leds import leds
from kuukar_sensors import sensors
from telemetrix import telemetrix
class motion:
def __init__(self, driver: telemetrix.Telemetrix, led: leds, sensors: sensors) -> None:
self.driver = driver
self.leds = leds
self.sensors = sensors
drive_pins = [MOTOR_FL_F,MOTOR_FL_R,MOTOR_FR_F,MOTOR_FR_R,MOTOR_R_F,MOTOR_R_R]
for drive_pin in drive_pins:
self.driver.set_pin_mode_digital_output(drive_pin)
def forward(self, speed: int):
self.driver.digital_write(MOTOR_FL_F,1)
def turn(self, speed: int, angle: float):
pass
def backward(self, speed: int):
pass
def stop(self):
pass
def roam_start(self):
pass
def roam_stop(self):
pass
def roam_loop(self):
pass