I’m attempting to control two servos on a Raspberry Pi using Python but cannot get python to communicate with the Mini Maestro.
I have the Maestro connected to the pi using a USB cable. I installed the requirements listed in the README.md from the Pololu Linux tar download, copied the 99-pololu.rules to /etc/udev/rules.d (I then reboot the pi), and modified the permissions on the USB device /dev/ttyACM0.
I can move both servos using the Linux MaestroControlCenter, but when I run the sample Python script I found on GitHub (https://github.com/FRC4564/Maestro), the python script hangs. Here is a slightly modified version of the sample GitHub python script that I’m running.
import Maestro.maestro as maestro
servo = maestro.Controller("/dev/ttyACM0")
servo.setAccel(0,10) #set servo 0 acceleration to 4
print(“After setAccel”)
servo.setTarget(0,6000) #set servo to move to center position
print(“After setTarget”)
servo.setSpeed(1,10) #set speed of servo 1
print(“After setSpeed”)
x = servo.getPosition(0) #get the current position of servo 1
print("servo 1 position "+str(x))
servo.close()
Here is the output:
After setAccel
After setTarget
After setSpeed
(Neither servo moves. The script hangs waiting for the getPosition to return.)
When I run the script, the green light blinks once rapidly. The yellow light continually blinks twice quickly, then pauses, and then blinks twice again.
I’m also attempting to communicate using a Linux serial port program but have yet to be able to make a connection with the Maestro. I’ve gone through the serial parameter setup validation and I think the settings are correct. I wanted to at least validate the connection, but the terminal hangs.
Any ideas?
Thanks in advance.