kuukar-rpi/test_motion.py

29 lines
1.0 KiB
Python
Raw Permalink Normal View History

2022-10-30 08:57:00 +00:00
import time
from telemetrix_rpi_pico import telemetrix_rpi_pico
import kuukar.kuukar_motion as kuukar_motion
import kuukar.kuukar_sensors as kuukar_sensors
2022-11-04 04:58:20 +00:00
from kuukar.kuukar_config import SERIAL_MCU
2022-10-30 08:57:00 +00:00
from kuukar.kuukar_config import MOTOR_FL_F, MOTOR_FL_R, MOTOR_FR_F, MOTOR_FR_R, MOTOR_RL_F, MOTOR_RL_R, MOTOR_RR_F, MOTOR_RR_R, TURN_TIME_FS_90DEG_MS
2022-11-04 04:58:20 +00:00
mcu = telemetrix_rpi_pico.TelemetrixRpiPico()
motion = kuukar_motion.motion(mcu, None, None)
2022-10-30 08:57:00 +00:00
motion.drive(30)
def rot_test():
while True:
speed = 30
motion.motor_write(MOTOR_FL_F, MOTOR_FL_R, speed)
motion.motor_write(MOTOR_FR_F, MOTOR_FR_R, -speed)
motion.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
motion.motor_write(MOTOR_RR_F, MOTOR_RR_R, -speed)
time.sleep(0.5)
speed = -speed
motion.motor_write(MOTOR_FL_F, MOTOR_FL_R, speed)
motion.motor_write(MOTOR_FR_F, MOTOR_FR_R, -speed)
motion.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
motion.motor_write(MOTOR_RR_F, MOTOR_RR_R, -speed)
time.sleep(0.5)