Controlling speed

I have a maestro 6 and I am trying to set up a simple sequence. I need to move a servo one direction at full speed to an endpoint. Then at maybe 50% speed back 90 degrees to another endpoint. And repeat. Fast one direction and slow the other direction. Can someone help me figure this out? Thanks.

Joe

Hello, Joe.

You can set the speed for a channel under either the “Status” or “Channel Settings” tabs. However, that will not allow changes between frames in a sequence. If you write a script that moves the servos between two positions, you can use the SPEED command in between position commands to do what you want. You can see the SPEED command (and other script commands) in the “Command Reference” section of the Pololu Maestro Servo Controller User’s Guide located under the “Resources” tab on the "Maestro product page.

If you try writing a script and run into problems, you can post the script you have so far, and I would be glad to help you.

-Derrill

Thank you. I do not fully understand how to make a script. Can you make one for me? Just one servo. Move 45degrees one direction(forward) at full speed. Then back 90 degrees at 50% speed. Then forward at full speed 90 degrees. If you can that would be great. Once I see it then Im sure I can tweak it from there. Thanks.

Joe

Anyone?

begin
500 delay
5000 0 servo  
500 delay
50 speed
7000 0 servo  
500 delay
repeat

So, I can get the servo to run back and fourth but Im not sure it is full speed or not. Then once I added the “SPEED” line it will not work. What am I doing wrong?

Joe
Servo Program.txt (1.81 KB)

Can you help with this?

Hi, Joe.

Your SPEED command was missing the channel parameter, so I rewrote your script to include that. In the command 50 0 SPEED below, the 50 is the speed setting and the 0 is the channel setting.

I also noticed that you did not use a very long delay between servo movements in your script, so at low SPEED settings, the servo might not have enough time to complete the movement before the next position command. If you notice that is happening, you might increase the delay to allow the servo to complete the movement or use a get_moving_state subroutine like the one in the “Making smooth sequences with GET_MOVING_STATE” example in the “Example Scripts” section of the Maestro User’s Guide.

By the way, if you want to post more short pieces of code in the future, please use code blocks to display it rather than attaching it as a text file. That will make it easier for everyone on the forum to look at. You can use code blocks by adding “[ code ] your code here [ /code ]” without the spaces to your post.

begin
  500 delay  # This is the delay between loops
  0 0 speed
  5000 0 servo  
  500 delay  # If your servo is not completing the movement you might make this delay longer
  50 0 speed # first parameter is the speed(0 is Max speed) the second is the channel
  7000 0 servo  
  500 delay  # If your servo is not completing the movement you might make this delay longer
repeat

-Derrill