Rotation works correctly, and the servo turns itself off when it reaches its target (where it is then held steady by natural balance and a couple of small magnets acting as latches).
However, it turns way too fast… well above the speed set in the first two commands. I have set the speed and acceleration limits in the Control Center, and I have tried it in this batch file. When I use the batch file, it always goes at top speed. I first had the --speed and --accel commands run directly, but I tried the “start /wait” approach in case they weren’t completing correctly before the movement command went through. The behavior was the same.
Any idea what I am doing wrong?
If the batch file doesn’t work, my next step would be to port it to subroutines in Pololu script…
So then I tried using the command line directly. Status reported that the speed changed; but when I directly moved the servo, it did not respect the speed parameter.
The Maestro needs your servo’s starting position to accurately set speed and acceleration (by breaking the movement between the last position and new position values into multiple smaller divisions). You can find more details about that under the “FAQs” tab on the Maestro product page. It looks like your script just sets the target position for servo channel 0 once before disabling it, meaning the servo’s position will always be unknown at the start of the script with each execution. Servos do not provide any position feedback, so the first position command you send will always move at full speed and acceleration, because the Maestro cannot initially know where the servo is.
Considering you know the position of the servo when you start your script, you should just send a command to set your servo to that position (without speed and acceleration limits) before sending the new position command (with speed and acceleration limits).
Thank you! I had been pointed to that FAQ earlier, but hadn’t understood the implications after following the advice to turn the servo off between rotations.
For those who are in need of a similar script, here’s the entirety of the batch file: