Hi, This is my first post, so I hope I am doing this correctly.
After many hours of struggle, I figured out how to move the servos to the a position using the setTarget method.
The issue is, in the Maestro Control Center the position ranges from 992 to 2000, but for some reason those numbers correspond to 3968 to 8000 when I use the python script.
Any ideas why this is the case? How do I set up the firmware, so 0 is on one end and another value that makes sense,. like 100 for example is the other end of the motion? I tried to set the setRange method in the python code, but that just seems to truncate the possible range within the 3968 - 8000 values. Also, the Maestro Control Center says 1500 is center, but it does not react when I enter 1500. (or anything about of the range mentioned)
NOTE: When I add lines to change the acceleration and speed, it works with no issues, but not for the setTarget method.
For example - maestro-test1.py:
servo = maestro.Controller(’/dev/ttyAMC0’)
servo.setTarget(0,3968) # moves it to position 992 in the Maestro Control Center
time.sleep(1.5) # to allow it to move
servo.setTarget(0,8000) # moves it to position 2000 in the Maestro Control Center
I am using the maestro.py library from Pololu and set the tty connection to ttyAMC0.
I have had a similar problem with other servos and control boards (GUI program works, but not python code), so maybe I am doing something wrong or there is a weird OS issue?
I also notice the board does not auto detect baud rate in the GUI program…so many that is an issue? I got a pop up that says the baud rate has not been auto detected, so I changed the serial settings and then the GUI program works perfectly after that.
I have a separate power supply 6V (4 AA) powering just one servo connected to the Maestro 18 through the screw in connections and wall power to the raspberry pi 3b. Then I use the first plug in the upper corner (opposite the power connections at the top of the first set of 6x3 pins for the servos) I have the yellow wire on the inside (signal) and the black on the outside (ground). I currently have the ground from the maestro to the Raspberry Pi, and have Power (pololu) to 3.3V to Raspberry Pi and RX - TX, and TX - RX, but have also tried without these connections and just the USB. I have also tried many permutations of the serial settings. Same behavior no matter what.
Currently, while idle and even during some tests with the GUI program, the green light is flashing quickly at a steady rate and the yellow light seems to flash 2x quickly at a regular interval.
Any advice is appreciated. I tried most of the obvious things and have had this issue with a completely separate Raspberry Pi, separate servos (eMax ES08MAII for this board and also LX-16a on a completely separate system with a separate controller board and had similar issues). In python, I have pyserial and believe i have done everything correctly.
Do others have issues using python? I am best with python, but perhaps I should learn to use C with an Arduino or something else?
I really want to use the Raspberry Pi and Python since it is most familiar to me. Plus I like the idea of being able to connect a monitor and use it as a computer also. That is the goal.
I feel so close, yet so far…