Author Topic: WebbotLib for 22+ Servos  (Read 12632 times)

0 Members and 1 Guest are viewing this topic.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: WebbotLib for 22+ Servos
« Reply #60 on: March 13, 2010, 01:28:08 PM »
I won't be implementing the 8 bit timers for now - for a whole number of reasons.

But rather I will try to come up with a new servo driver. Think I know what the problem may be (and it was introduced to stop frying Admins servos when originally testing WebbotLib!). If you PM me with your preferred contact details then I can send you something to test once I've done it - but it won't be quick as I've got a number of other things I'm working on and trying to complete.


Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Problem Solved !
« Reply #61 on: March 14, 2010, 07:34:57 AM »
@Webbot, your updated Library solved the problem !!

All servos holding tight + no Vibrations !

Thanks a lot !

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: WebbotLib for 22+ Servos
« Reply #62 on: March 14, 2010, 11:14:14 AM »
I still stand by my claim for max servos on Axon. And that the problem here is poor power management, not code.

for example, this beast of a robot is controlled by the Axon:
http://www.lynxmotion.net/viewtopic.php?p=52438&sid=9405a421f585a32620e59ac69d4c25a5

It has at least 21 servos on it (rough count).


Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Re: WebbotLib for 22+ Servos
« Reply #63 on: March 14, 2010, 11:34:29 AM »
Yes Admin... it sure does  ;D

Me and Madsci were arguing about maximum num of servos 'while each holding tight' ...

When I used to use the normal AVR library, (since it doesn't use Interupts) I had this problem of "Servos loose and jitter".

Hence, I changed to WebbotLib, but unfortunately, I had the same problem again !.

Now, Webbot has modified his library, (added another servo driver - am not sure what exactly did he do), but all the servos (I tried 22, even 29 would) hold tight with no jitteriness !

PS. Admin, I can't re-modifiy the first post of this thread, can you please change the 'icon' to 'solved'?..thnx

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: WebbotLib for 22+ Servos
« Reply #64 on: March 14, 2010, 12:14:39 PM »
Remember Hasan, you bought a piece of hardware from Admin. That piece of hardware can do many things, but it all depends on how it's programmed. You seemed to approach your questions with a sense of expectation for software to be already written to have the hardware you bought do what you want.

That's not the case.

You should be very grateful (as am I) that someone like Webbot donated his time to write software for your hardware, and that Admin did provide a base library for the hardware he sells.

Admin, if you read through all the pages of this thread, there was a power problem, as well as a code problem. Hasan managed to isolate both issues from each other. I'm assuming now he fixed the power problem with a few extra batteries.

Webbot, I'm curious to hear how you changed your servo drivers. Care to explain? Or i could wait to the next lib release.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: WebbotLib for 22+ Servos
« Reply #65 on: March 14, 2010, 12:19:06 PM »
Oops sorry didn't see page 3 of this thread. I marked it as solved.


Webbot often sends betas off to certain people before making it official. I've been AWOL lately, taking a vacation off from my vacation, but I'm sure we'll see a new WebbotLib version soon.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: WebbotLib for 22+ Servos
« Reply #66 on: March 14, 2010, 02:29:29 PM »
Admin, ....  as well as a code problem.......

Well its not really a bug. The released code copes with a 'certain' number of servos. Hassan pushed this limit and got practical problems. My new code (unreleased as of yet) just increases this 'certain' number to make his problem 'go away'ish. But if anyone believes than they could drive 40, 60 etc servos - then they will get the same problem. There's only so much liquid that goes into a pint glass!!

So I haven't 'fixed' the code - I've just 'improved' it to cope with more.

Quote
Webbot, I'm curious to hear how you changed your servo drivers. Care to explain?

Ok - but its a bit complex. Maybe needs timing diagrams but I dont have time!

Version 1 (prior to release of WebbotLib - but just for the history)
Set the pin for the first servo in the bank.
Set timer callback for 'end of pulse'.
When called it cleared the pin.
Repeat for all servos in the bank.
Add a callback to be (20ms - (sum of all pulses)) - so that it repeats every 20ms.
This fried servos!
Heres why. Think of a bank of 8  servos and thing only about servo#6.
In the 20ms frame then its start time is effected by the length of the pulses for servos #1- #5
So if servos #1 to #5 now have a smaller pulse then the pulse for #6 will start sooner. Compare this to the start time for #6 on the previous frame then it can be less than 20ms.
This technique guarantees servo #1 getting a pulse every 20ms but the further down the bank you go then the pause between frames is effected more and more by the earlier servos.
Hence the later servos could 'fry' - as they may get pulses every 12ms say.

Version 2 - for first release and up until current release
Uses the same technique except that at the end of a bank it would pause for (20ms - the duration of the last servo pulse).
This guarantees a min delay of 20ms for all servos - so no frying!!
But it also means that the length of a frame is no longer '20ms' but is 'sum of all pulses + 20ms - last pulse'.
So as you add more servos then the frame time changes from 20ms upwards.
Hence Hassans problem of servos going floppy.

Version 3 - for next release and what Hassan is using.
For each servo in a bank we know the max pulse time (the center parameter + the range parameter for each servo MAKE) as well as the currently required pulse time.
So we will overcome the problem of Version 1 by making sure that each servo gets the start of its pulse every 20ms.
I do this by using one Timer Compare to start each pulse at which time it adds two callbacks: one clears the pulse after the required duration, and the other is called after the max pulse time to repeat for the next servo.
Once all servos are done then we pause for the rest of the 20ms (if any) since we did the first servo.
So the pulse start for ANY servo always happens every 20ms since it is always made up of a HIGH and a LOW phase where HIGH+LOW is constant.
The number of servos is constant and so the time for one pass is also constant
So the pause (if any) before repeating is always constant.
So I am now using 2 compare units for each servo bank rather than one.

I hope that makes sense (but it's not for newbs!).

And if you are just a user of WebbotLib then 'dont worry' - its just techno garb.







Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

 


Get Your Ad Here