1. ## Servo - Adjustable movement speed

Hi,

Planing to make some multiple servo controller.

What would be a good approach to implement smooth variable speed movements for a servo?

The only solution I see is not to tell the servo immediatelly what position it should go to, but for slower movements to have a timer that will increase the servo position in small steps (step length depends on desired movement speed and uC speed).

But theoretically that would produce non-smooth movements (yanking) i guess?

any other ideas or is this the way its usually done?

Last edited by nik; 11-19-2008 at 03:25 PM.

2. ## Re: Servo - Adjustable movement speed

I actually have been working on this for about 2 months using a Propeller from Parallax.

I tell it the postion to move to but I compare its current postion. I take the differences between the two and divided it by 100. Then I have a looping program that adds the result to my variable as it increases I send the comand to the servo. This actually moves the servo in steps.(There is no need to go any higher resolution than 100 since the servos smallest value of movement is only .09 degrees)

It s actually pretty smooth and looks very realistic. I also have variable speeds where there is no limit on the slow side but there is a limit on how fast before the Inverse Kinematic equation donsnt have enough time to finish computing. The math engine is on a seperate COG. The spec sheet explanies what a COG is and that can be found at Parallax.com

I can make a small video clip of my current progress.

Paul
Last edited by Quantum; 11-19-2008 at 04:12 PM.

3. ## Re: Servo - Adjustable movement speed

Quantum: Thx, that helped. I was afraid that the step by step motion would produce non-smooth movements. I just didnt understand what you meant about that second var. speed thats associated with IK :|

I can make a small video clip of my current progress.
sure
Last edited by nik; 11-19-2008 at 04:27 PM.

4. ## Re: Servo - Adjustable movement speed

Welcome Aboard, Nik!

If you have a look at Metaform3D's recent posts, you'll see his work on something not unrelated, and some linkage to suggestions for algorithm.

5. ## Re: Servo - Adjustable movement speed

thx for the welcome I read Metaform3D's topic before but I think its another problematic, related to servo electronics and its PID control.

6. ## Re: Servo - Adjustable movement speed

I think the concepts still hold sway. You have a distance, you're estimating that distance, and you're figuring your current position. You have a desired time and you need to cover that distance in that time. You can overshoot or undershoot time, not just distance (as in PID)

You might also poke a bit at the SSC32's firmware source-code, since it does an outstanding job of getting the algorithm correct...

7. ## Re: Servo - Adjustable movement speed

Thx, I wasn't aware that LM published the source code. I'm curretly brainstorming on my solution but sure, will take a quick look at the code too

8. ## Re: Servo - Adjustable movement speed

If you have a look at Metaform3D's recent posts, you'll see his work on something not unrelated, and some linkage to suggestions for algorithm.
For what it's worth, I've also worked on the related problem of making servos move slow. What I did was change the pulse width at a constant rate until it matched the target pulse width (actually, with the code I was using, the target servo angle). The code is straightforward except for the complications of using fixed-point integer math.

I did run into a lot of problems with the step size, however. I'm driving servos using the software servo control class that comes with the Arduino. Delving into their code I found that they had kind of botched some math which resulted in about half the precision that was possible. Fixing that, there was still a limit of 4 microsecond resolution to the pulses due to the scale factor on the pulse-counting register (I don't have the code in front of me so I forget the name). That's about 0.5 degree steps, not the theoretical 0.1 degree. It's basically still kind of quantized when it moves.

I think it may be possible to change the default scale factor on the register, but I'm not sure how to do it, or if it could be done, how it would affect the rest of the Wiring libraries.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•