Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Explain the code


I have 3 servos active on a 17 servo biped, the left and right arms and the head, at positions 2,3 and 7. I created two frames where the arms move back and forth as if the robot is walking, and the head follows the leading arm. All is good.

I have some questions about the script I created and pasted below the questions:
Q1: Do all the zeros in the upper portion of the script represent NON-active servos? The 4 digit numbers (which are correct for positions of active servos when divided by 4) seem to fit into the slots 2,3 and 7.
Q2: Why is there a sub “frame_0…17” when only 3 servos are active. What exactly is this sub routine doing?
Q3: Where are the settings for speed and acceleration?
Q4: When I make a minor change and “Apply Settings”, some default setup pops up and all servos are set to midrange. 6 servos in the middle of the pack are activated and they are not even the ones I’ve been working with.
Q5: What is “delay”? Is this the 1000 uS “Duration” shown in the sequencer frame listings?

[code]# Arms March
1000 0 0 7721 4481 0 0
0 7560 0 0 0 0
0 0 0 0 0 0 frame_0…17 # Right front
1000 4217 7413 4290 frame_2_3_7 # Left front

sub frame_0…17
17 servo
16 servo
15 servo
14 servo
13 servo
12 servo
11 servo
10 servo
9 servo
8 servo
7 servo
6 servo
5 servo
4 servo
3 servo
2 servo
1 servo
0 servo

sub frame_2_3_7
7 servo
3 servo
2 servo


I have the answers.

  1. Yes, I am correct
  2. Okay, I have no idea
  3. Speed and acceleration not stored in the script when made from a sequence. Must add yourself.
  4. The settings are saved in a file (likely registry), then settings default to all servos on since the system doesn’t know what you want to do next. Existing sequences not affected. Select your original sequence and only the servos required will show on the Status page.
  5. Delay is the 1000 uS. Called “duration” in sequencer frame listings.



I am glad you were able to find the answers to most of your questions. Thank you for letting us know.

It looks like only your second question remains unanswered. The reason that subroutine includes all 18 servos has to do with way the sequencer works. This first subroutine created from a sequence is used to initialize all of the channels on the Maestro. Sending a position of 0 to all of the channels that were disabled when you saved your first frame makes sure they will be disabled every time you run that sequence, so they will not be affected by their prior states.



I just noticed that you used units of microseconds for the delay; please note that the Maestro’s delay command is in milliseconds (ms).



Back to question 3.

I have speed set at 40 for the 3 servos to slow down the action. When I make a script from this and run the script, the speeds ARE set to some value other than 0. (If 0, the servos really get hammered). So WHERE are these settings?

To prove it to myself, I removed the speed setting and made another script. It is the SAME as the previous, yet the speed values have changed. They are not to be seen in the script.

Where oh where are they kept?


The sequencer does not save the speed settings for each frame; however, the default speed for each channel will still apply to movements of the servo on that channel.

You can change the default speed setting for each channel in the “Channel Settings” tab of the Maestro Control Center. If you do not need to change the speed of a servo between servo movements (e.g. it will always be the same speed), modifying the default speed will probably be enough. If you need to have a servo move at different speeds throughout a routine, you can use the “SPEED” command in your script and it will apply to all subsequent movements of the servo connected to the specified channel. More information about this command can be found in the “Command Reference” section of the Maestro user’s guide.


Speed and acceleration being lost in frame


I understand how the SPEED parameter works in a written script.

My question is how can a speed setting I made on the Settings page (eg 40) actually WORK in the script when the script has NO SUCH VALUE SHOWING.

Further, I disconnected the USB (and thus the computer host) and powered up the Maestro with external power…and the speed settings were still there because the arms of my robot were moving slow (speed 40) as opposed to fast as possible (default of 0 for speed).

So how does the servo know it has to go slower than default when the script doesn’t indicate how to do so?

Are the values stored in the board memory, for each servo, when I create a sequence?


The Maestro has two speed settings for each channel. One of them (the one adjusted in the “Channel Settings” tab) is non-volatile, so it will persist through power cycles, and it applies automatically when the Maestro is powered on. The other (set using the SPEED command) is volatile, so it can be changed on-the-fly, and takes priority over the default speed set in the “Channel Settings” tab.

In short, the speed setting configured for each channel in the “Channel Settings” tab is saved on the Maestro and is used by default, but the speed for each channel can still be adjusted throughout a script using the SPEED command.



Thank you, that explains it.

Going forward…