Smoothing out servo motion

Still battling with RobotShop.CA. Despite cancelling my Paypal at about a 5% loss to me due to the poor old AUD, they are still insisting I wire them 2k usd to complete my Robotis kit order. Fat chance!

I’ve also managed to wipe the on-board flash of the 6811 controller on my Robo-11 tank, so I’m awaiting some help and a couple of new chips before that’ll start moving again.

On the less depressing side, I’ve been working on the movement controller for my Joinmax doggie.

As I mentioned a couple days back, I was surprised at how noisy the movement of 15 3-wire servors can be — especially when many move at once to do anything like a 4-legged gait.

So I’ve been investigating. Usually this is code for "Kym is re-inventing the wheel; why doesn’t he read up on these things and save a lot of work?" But I figure if I have to make a fool of myself only 1/2 the time, I’m ahead. :)

Anyway, the "progress" to date is roughly as follows:

Eningineering Approach:

The idea behind any engineering approach is to simply setup some Rube Goldberg device and measure the answer.

To this end I got a couple of kits out and rigged up a servo connected to about a 25 cm balaswood beam with a 10 cm x 10 cm card attached to the end of it. Think of a robo-powered flyswat and you’ll have the idea.

Near the card at the end of the flyswat I put a little controller with an IR ranger setup. The idea was to measure the oscillations in the servo after they’d been amplified by the 25 cm-long flyswat.

Amazingly the ranger could detect the damned oscillations. But they were too damped — by the flyswat itself, apparently — so oscillations quickly damped down below the noise level before anything meaningful could be determined.

No amount of hammer-throwing, window-smashing  or high-level swearing seemed to help. So much for engineering rules-of-thumb.

The Scientific Approach:

If working in reality is no good, we always fall back to the scientific method.  Viz, make a simple model and usually presume it’s good enough to find something out about the real world.

So I made a 10-line C program simulate the relevant forced, damped SHM. And I found something out!

It’s servo folklore (and was mentioned in robo-doggy’s photocopied manual) that smoothing out servo motion entails putting a few intermediate points out to the controller between the positions you want the servo to hit. Usually this appears to only involve putting out a few equally-spaced positions.

But my little model determined there’s (at least) a reasonable "80/20" model that’s 10-20% better (in that amplitude of overshoot and subsequent oscillations about the required final position are that much smaller).

Putting in just one intermediate point and varying the "impulse" and time at which the impulse was sent shows the optium position is 20% into the time interval between start and end, and involves moving 80% of the way between the 2 points.

Example. Suppose I want a servo to start at "0" at t=0 but end up at 1 radian at t=1.

It turns out you send position "1" at t=1, but if you also send a position command for "0.8" at t=0.2 the oscillations about the final "1" position are damned down by about 20%.

The way the intermediate point works is rougly as follows. All is quiet until t=0.2, then the cmd "goto 0.8 radians" is recevied. The servo starts to move toward 0.8, it reaches 0.8 and then starts to oscillate about 0.8, but by that time it receives the command "goto 1.0" and moves onto the new position, with much lower levels of oscillation when it gets there.

You can obviously take this 80/20  rule and apply it recursively. E.g. you can insert another point between t=0 and t=0.2 by again using this 20/80 rule. I.e. at t=0.04 (20% of 20%) send a position command of "0.64" (i.e. 80% of 80%). You can also insert another point between t=0.2 and t=0.8  again based on the same rule. I.e. at t=0.36 (you do the arithmetic :) send a "0.96" position command.

Keep recursing until tolerances fall below the (usually) 1-2 deg range the servo understands.

Being a scientific method means not having to actually measure anything in reality. :) But I will do so today.

Until then I’ve prepared a few jpegs of the graphical output from my simple simulation. Each graph represents the problem of moving from 0 to 1 radian in 1 sec using a pretty powerful but not-very-well-damped servo.

The graphs all show servo position (y axis) over time (x axis), assuming various stategies for  intermediate position commands.  All assume a final "goto 1 radian" at t=1.

The "2" graph shows various combinations of 1 intermediate point before the final "1 radian" command.

The other experiments  used the fractal-like recursive application of the 80/20 rule.

The "3" graph uses 2 intermediate points, while the "4" graph uses 3 intermediate points.

From the "2" graph you can see that strategy xx4 seems to have the smallest oscillations. (I’m not too worried about the actual damping time, since that’s not relevant to the amplitude of rattling noises).

The other graphs show the same 80/20 success, with more points giving smaller and smaller "jitter" and decreasing returns for more points.

As I say, the next step is to add this idea to my primitive Tcl/tk servo control program and see whether it makes a noticable difference on the jerkiness and rattling front.

Plot 2:

Plot 3

Plot 4

5 Comments

  • On 08.31.07 ash said:

    Hey Kym, maybe try these guys for Robotis.

    Not sure what they are like though.

  • On 08.31.07 Anonymous said:

    Thanks for the help, but I didn’t see a link in your message.

    Yes, I am now actively hunting.

    There’s a place “crustcrawlers” that looks promising, but my my small test transaction has not resulted in any email from them for 3 weeks and I’m assuming it’s a 1-man operation. :)

    Another small drawback to getting ditched by RobotShop.CA (not to be confused with RobotStore.COM :) is Paypal says it will take upto 4 weeks to review the case and return the money to my Paypal account.

    Whew! Wire transfers in the electronic age! :{

  • On 09.01.07 ash said:

    Ah crap. I was in a rush to get out the door and must have forgotten to embed the link, grrr :\

    Here you go:

    TriBotix

  • On 09.01.07 ash said:

    The other thing about Tribotix is that they are based in Aus so at least you can phone them and have a chat if anything goes pear shaped.

  • On 09.01.07 kymhorsell said:

    I’ve given the web-page a look and they look pretty good. I’ll place a "trial" order with them and see how they go. :)