Servoposition: Script Values vs. Maestro Control Center Values

Hello friends of Pololu,
I have finally started to write a script to retract/extend the landing gear from my C-123 Provider.

First a short introduction: The toggle impulse for the landing gear comes as input via channel 0.

When the Pololu is switched on (initialize), all landing gear doors open and the landing gear extends. All servos take their default (start) position.

When a switching impulse occurs at channel 0, the landing gear retracts and all gear doors close. On the next pulse, the landing gear extends again.

I have manually set all values in the Maestro Control Center "Channel Settings (on Startup or error) and when I switch on the Pololu, the landing gear extends as wanted.

I can see in the Maestro Control Center at which position (numerical value) the landing gear doors or the landing gear are extended or retracted.

The values that are displayed in the Maestro Control Center for the servo positions are between 900 and 2000.

If I look in the script, there are values between 3968 and 8000. I do not understand this.

In the documentation it says: Note that the servo positions are specified in units of 0.25 μs, so a value of 4000 corresponds to 1 ms.

But what does that tell me? … the servos have a range of +/- 45°.

How do I have to convert the values from the Maestro Control Center?

In the Maestro Control Center initial values (start position) of 990, 1010, 1163 or 1980 are displayed for the servos.

How do I convert them to get the value that I then use in the script. What is the value for 990 in the script and how do I have to understand that?

Why does the Maestro Control Center not show the value that is also used in the script.

Probably many here shake their heads at such a stupid question, but I was never a programmer and am probably not the brightest candle on the Christmas tree.

I hope someone can explain this to me anyway. Thank you very much in advance.

Lars

Hello, Lars.

The pulse width position signal displayed in the “Status” tab of the Maestro Control Center are in units of microseconds. This is mostly for readability purposes as servo signals are typically expressed in microseconds (μs) or milliseconds (ms). The Maestro is capable of a pulse width resolution down to a quarter-microsecond. However, instead of using floating point numbers (i.e. 1500.25μs) the Maestro script uses units of quarter-microseconds. So, if you want to set the target pulse width to 990μs, your script would use 3960 quarter-microseconds (4×990). To get 1010μs you would use 4040 in your script, and so on.

If you do not care about the resolution down to a quarter-microsecond, you could write your code in a more readable way by multiplying your target position values by 4, like this:

begin
  990 4 times 1 servo   #set servo channel 1 pulse width to 990μs
  1010 4 times 1 servo   #set servo channel 1 pulse width to 1010μs
  1163 4 times 1 servo   #set servo channel 1 pulse width to 1163μs
  1980 4 times 1 servo   #set servo channel 1 pulse width to 1980μs
repeat

You could also consider writing a simple subroutine that you can used in place of the SERVO command that handles multiplying the target value by 4, which is more efficient and will save programming space:

As far as how those values relate to the servo position in terms of degrees, that is dependent on the servo’s internal electronics and will vary for different servos (even units of the same model could have some unit-to-unit variation sometimes).

Brandon

Hi Brandon,
Thank you for operating such a great forum and for taking the time to answer my rookie question in such detail. I am very pleased with it and my first tests were also successful right away.

I also work as a process analyst in customer support and have to deal with support tickets from our customers on a daily basis when they have problems with our software. So you can imagine, that I am very thankful when there are such dedicated supporters like you, who also answer my questions for which they themselves are basically pretty overqualified :smiley:

Ticket is resolved and can be closed

Regards,
Lars

1 Like