I am controlling the Mini Maestro 24 with a python script using pySerial. I’ve had no issue with setting speeds and targets in terms of writing to the serial port that the board is using. However I have been unable to get anything back from the Get Moving State command. No 0s no 1s, nothing. When I print the serial.read() I just get a blank line. I am at a loss as to what to troubleshoot. Any advice or ideas would be appreciated.
I am sorry you are having trouble using the Get Moving State command for the Mini Maestros. Have you ever been able to read data from your Maestro (e.g. get position) successfully? Can you post your entire code here?
By the way, someone on the forum shared their Python class for the Maestro, which supports the Get Moving State command, called maestro.py. It might be easier to use that class instead of writing code from scratch. You can find a link to it under the “Related Resources” section of the Maestro user’s guide.
Thank you for getting back to me. I am familiar with maestro.py and my code is a modified version of it. Since I am running a total of 98 servos across 5 boards I am using the Set Multiple Targets command, which required that I write additional code beyond what the library supports. I have not gotten any reads from a board yet. I have been setting the speeds to a very low value just to make sure that the servos are still moving by the time the read executes. I have been running the python file attached in the interactive Python interpreter that comes with my Python 2.7 install. This is running on a Windows 10 machine. Any thoughts on why I might not be getting any data from the reads would be greaty appreciated!
controlServosSTANDALONE.py (9.2 KB)
I looked at your getMovingState function and did not notice anything wrong. (I briefly glanced over the rest of your code, since it sounds like those functions are working based on your description.) Do any of the Maestro units indicate an error (have their red LED on)?
Do you have each Maestro’s TX line, starting from the last board in the chain, connected to the TXIN pin of the next Maestro in the chain? Can you post pictures showing how you have everything connected in your setup?
Considering there is a lot going on in your setup, can you try testing one of your Maestro units by removing it from the system before plugging it into your computer and sending it the Get Position command using the Pololu Serial Transmitter Utility? Do you receive either a 0 or 1 after sending that command?
There were no errors and all the connections were as specified in the manual. After a bunch of testing I did find the issue. It was with the Python script. I did as you suggested and first tried to get a response back from within the Pololu Serial Transmitter Utility. When that worked I then implemented the basic maestro.py library with one board. Once that was working reliably, I was able to implement it in my 5-board set up. Thank you for your feedback and suggestions. The current working version of the script is attached.
controlServosSTANDALONE.py (10.4 KB)