Explanation regarding generated script from the maestro servo controller

Hello guys, I am a high school student and i urgently need your help with explanations. I created a small school project. and I need help on how to explain to my teacher the meaning of my generated script from the Pololu maestro controller.

currently i am a novice to using the Pololu maestro center controller, i read through the maestro user guide and did not find any information regarding the explanation of the meaning of generated scripts from the maestro controller and would kindly like if someone will be kind enough to explain to me the meaning of all this numbers that was generated when i moved my servos to several positions. i click on “copy sequence to scrip” and such script was generated.

please i will like to know what is the meaning of this cluster of numbers and what they represent ( 500 5664 6980 6980 0 6000 4964 )
i discovered that first four numbers that makes up the first group are totally different from the first number in the second row

please what is the meaning of ( sub frame_0…2_4_5_8…10_12_14_16_17_20_21 )
what does it represents


***# Sequence 1***

***begin***

***500 5664 6980 6980 0 6000 4964***

***4964 0 6000 6980 6980 0***

***6000 4964 4964 0 6000 6980***

***6980 0 6000 4964 4964 0*** ***frame_0..23*** ***# frame 0.***

***500 3968 3968 3968 8000 3968 3968***

***3968*** ***frame_4_5_8_9_20..22*** ***# frame 1***

***500 8000 4964 6000 6000 3968 8000***

***6000 6000*** ***frame_1_5_9_10_14_17_21_22*** ***# frame 2***

***500 6980 6000 6000 6980 6980 4964***

***6980 6000 4964 4964*** ***frame_1_4_8..10_14_17_20..22*** ***# frame 3***

***repeat***

please what is the meaning of ( ***sub*** ***frame_0…2_4_5_8…10_12_14_16_17_20_21*** )

i discovered that random numbers where repeated and with the ending servo example ( 8 servo) what does 5 servo represent in a layman’s word.

***sub*** ***frame_0..2_4_5_8..10_12_14_16_17_20_21***

***21*** ***servo***

***20*** ***servo***

***17*** ***servo***

***16*** ***servo***

***14*** ***servo***

***12*** ***servo***

***10*** ***servo***

***9*** ***servo***

***8*** ***servo***

***5*** ***servo***

***4*** ***servo***

***2*** ***servo***

***1*** ***servo***

***0*** ***servo***

***delay***

***return***

i discovered that random numbers where repeated and with the ending servo example ( 8 servo) what does 5 servo represent in a layman’s word.

Hello.

I suggest reading through The Maestro Scripting Language section of the user’s guide, which has a description and some walk-through examples of how the scripting language on the Maestro works. In addition, the Maestro’s scripting language is based on a programming language called “Forth”, so reading a bit about how that works might help as well.

Essentially, the Maestro uses a “stack” to store values, and when a command is called (like servo or delay) it uses values off the top of the stack as inputs. As a simplified example, let’s look at the following lines of code:

500 6000		#this puts 500 on the stack first, then 6000 on top
			#the empty space doesn't matter
0 servo			#this adds 0 to the top of the stack, then calls the servo command
			#the servo command uses the top 2 values on the stack, the 0 (top value) specifies the servo channel
			#and the 6000 (which was the second value on the stack) specifies the target position
delay			#The delay command uses the top value on the stack (500) as an input to delay for 500ms

Please note that in this example, when a value is used off the stack it is essentially “consumed”, but there are other commands that add values to the stack instead of remove them, and others that do not affect the stack at all.

The sub term you mentioned is used to declare a “subroutine”, which is basically a way to call multiple lines in a more efficient way (especially if they are going to be used more than once in your script). I suggest reading through the “Compressing the sequence” example in the “Example Scripts” section of the Maestro user’s guide for a better understanding of that. Specifically, the frame_0…2_4_5_8…10_12_14_16_17_20_21 is just the name of the subroutine (which is arbitrary, and you can essentially change it to whatever you want) and that is then used in the main loop to tell the script to run the lines of code declared under sub frame_0…2_4_5_8…10_12_14_16_17_20_21, and the return command at the end tells the script to go back to where it was before entering the subroutine.

Brandon

Thanks a lot for the explanation. I think I kind of understand how the generated script works works

1 Like