22mc.set_port(
"/dev/serial0")
25 global last_time_motors_init
30 mc.set_max_acceleration(1, 70)
31 mc.set_max_deceleration(1, 150)
34 mc.set_max_acceleration(2, 100)
35 mc.set_max_deceleration(2, 150)
38 mc.set_max_acceleration(3, 40)
39 mc.set_max_deceleration(3, 150)
41 mc.clear_motor_fault_unconditional()
43 except (OSError, RuntimeError)
as e:
44 print(
"Error: motors_init:", e, file=sys.stderr)
46 last_time_motors_init = time.monotonic()
50except (OSError, RuntimeError):
58 if int(time.monotonic() * 1000) & 2048:
64 except (OSError, RuntimeError):
69 if time.monotonic() - last_time_motors_init > 2:
74except KeyboardInterrupt:
Represents a serial connection to a Pololu Motoron Motor Controller.