Author Topic: Servo timings  (Read 876 times)

0 Members and 1 Guest are viewing this topic.

Offline WebbotTopic starter

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,132
  • Helpful? 109
Servo timings
« on: February 17, 2011, 05:15:20 PM »
We are all familiar with the statement that a servo expects a signal every 20ms and it should be 1500uS +- 500uS.

May be old news to some: but after a bit of digging then it turns out that this originates from when a circular servo was used to create a linear motion for controlling, say, the steering for an R/C car etc. In this setup then a rotation of +-90 degrees is the max of what can be achieved mechanically.

So +- 500us really means +-90 degrees. If you are using WebbotLib, and keep the defaults for each servo, then you may have already seen that the servo range is limited to this region.

We all know that modern servos are aimed at further uses and may be much more capable - say +- 120 degrees. Interpolating from above then this would mean a range of (500*120)/90 ie +- 666uS around the centre point.

In WebbotLib you can change the servo setup to cope with this range.

But my point is: if the above is true of all servos then I can make WebbotLib define servos with a range in degrees (that the servo can honour) and add a command to set a servo to a given position in degrees.

Would be interested to know of any exceptions you may have to the above logic (to prove me wrong!).

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 KurtEck

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 12
Re: Servo timings
« Reply #1 on: February 18, 2011, 08:52:56 AM »
Hi,

I believe that you can probably do interpolation, but as you implied it may be different for different servos.  There is a posting up on Lynxmotion (http://www.lynxmotion.net/viewtopic.php?f=31&t=3172) that shows some of the different ranges of pulses that different servos expect and the ranges they support.

Awhile ago when I converted my Lynxmotion Brat (with Hitec analog servos) to run with an Axon2, I used a simple define to do the conversions from tenths of a degree to webbotlib units:
Code: [Select]
#define ANGLE1_TO_DRIVESPEED(ang) ((long)(ang) *127)/900

I do something similar with my standard C version that I run on my C libraries for running on the Basic Atom Pro28.  For this my unit are in us. 
Code: [Select]
#define ANGLE1_TO_SERVO_PW(ang1) ((((long)(ang1) * 1666) / 1600)+1500)
This was based off previous code that ran on a Basic Atom Pro 28.
That code converted the angles to HSERVO units which are clock units (16mhz), with 0 as the center point...

Good Luck
Kurt

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,941
  • Helpful? 98
Re: Servo timings
« Reply #2 on: February 18, 2011, 10:18:31 AM »
I'm also thinking that different servos may be different and that some servos may not even be linear.

Additionally thinking on how to measure the angle to pulse width relationship. One way is to mount the servo with its output shaft horizontal and use an Accelerometer chip to measure the angle of the servo arm.

Offline Crunchy Theory

  • Full Member
  • ***
  • Posts: 80
  • Helpful? 0
  • "Well great is ok, but amazing would be great."
Re: Servo timings
« Reply #3 on: February 18, 2011, 11:15:51 AM »
It seems like different pulse widths may be required to achieve the same degree for different servo models. ex (from Servo City):

HS-5084MG range is 900usec - 2100usec to achieve -45 to 45 degree rotation.
HS-425BB range is 1050usec - 1950usec to achieve -45 to 45 degree rotation

Unless I'm missing something here, how would you generalize mapping degree of rotation to pulse from just the user input's range and center position?
The only way to top an upright screen, keyboard, and mouse is to eliminate the need for humans to touch a PC at all. Oh, hello there Mr. Robot... what would I like you to do, you ask?

Offline WebbotTopic starter

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,132
  • Helpful? 109
Re: Servo timings
« Reply #4 on: February 18, 2011, 11:28:00 AM »
ok so that answers my question. There is no mapping between angle and pulse width.
And the last thing I want to do is to add every available servo make/model to WebbotLib !
It was just a punt.
Thanks for your comments.
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 Crunchy Theory

  • Full Member
  • ***
  • Posts: 80
  • Helpful? 0
  • "Well great is ok, but amazing would be great."
Re: Servo timings
« Reply #5 on: February 18, 2011, 01:22:18 PM »
And the last thing I want to do is to add every available servo make/model to WebbotLib !

Yeah, didn't think so :P

It would have been a convenient addition, though, if it were easy enough to implement.
The only way to top an upright screen, keyboard, and mouse is to eliminate the need for humans to touch a PC at all. Oh, hello there Mr. Robot... what would I like you to do, you ask?

 


Get Your Ad Here

data_list