Files
motorDriverTests/example_custom_script.py
2025-07-23 16:23:30 +02:00

27 lines
590 B
Python
Executable File

#!/usr/bin/env python3
# This script instructs the "lin1" motor (first axis of the sinqtest Turbo PMAC
# controller) to drive to -20 mm. Once it arrives, it then drives to -30 mm.
# Afterwards, the motor is disabled and then reenabled
import time
from common import TurboPMAC
motor = TurboPMAC('turboPmac1', 'lin1')
# Drive to position -20 mm
motor.move_and_wait(-20)
# Drive to position -30 mm
motor.move_and_wait(-30)
# Disable the motor
motor.write_field('enable', 0)
# Wait a bit so the motor has been disabled
time.sleep(2)
# Reenable the motor
motor.write_field('enable', 1)