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

Pololu Forum

Need help with script language

hopefully this is in the right forum as the forum layout here is a bit strange.
I have a Micro Maestro 6 channel.
I am new to this type of device.
I am going to be using it to control a servo based on the voltage input from a sensor.
I am having trouble with the script language.
I need help with command structure. I have been reading the controller users guide.
I have some programming knowledge but have not done any in more than 20 years. mostly in quick basic and batch file scripts.

Does anyone have a comprehensive guide to the commands in the scripts something with more information than the users guide? There seems to be a lack of information on how commands are passed to and from subroutines, or I do not understand exactly how it works. Are there variables?

Hello.

I moved your post to the Servo controllers and servos section of the forum since it is specific to the Maestro.

The Maestro scripting language is based on a programming language called Forth, so you might find it helpful to get some understanding of that first if it is new to you; it uses a stack mechanism to keep track of values, and does not support stored variables like you are probably used to. In my experience, the best way to learn it is to try it out. You can look through the “Command Reference” section of the guide to get an idea of the available commands. Then, I recommend running some of the scripts in the “Example Scripts” section. The “Step script” button in the “Script” tab of the Maestro Control Center can be very helpful for slowing down the execution of the script and figuring out how each command is working. You can see the values on the stack on the right-hand side of the window. Additionally, note that you can run the examples that use servos without servos actually attached and use the “Status” tab to see what the outputs are doing.

As far as your question about subroutines, commands are not passed to and from subroutines, but the subroutine will execute any commands it contains when it is called. The values on the stack will still be there when a subroutine is called, so for example, if your subroutine contains a command like 0 servo (which is missing a target position that should come before the 0), it will use the next value on the stack as its target. You can see this done in the first example script under the “Compressing the sequence” heading of the same “Example Scripts” section of the user’s guide.

If you have any specific questions or examples that you are having problems figuring out, I would be happy to try to help explain them in more detail.

Brandon