Shop OBEX P1 Docs P2 Docs Learn Events
Servo speed weirdness — Parallax Forums

Servo speed weirdness

MightorMightor Posts: 338
edited 2007-07-16 05:46 in Robotics
Hey everyone,

I wrote a little program to check what the difference was between the speeds of my servos at different pulse lengths. The results were quite interesting and a little disturbing, to be honest. My servos seem to be quite off. I created a small graph with these values:

attachment.php?attachmentid=48179

You can see a two dips around the 750 value. Is this due to the servos not being centered properly? When they're at 750, they're totally motionless. Could it be a little "play" in the servo calibrations?

Gr,
Mightor

This is the raw data (also attached in xls file)
650,255,254
660,255,254
670,255,255
680,254,255
690,253,255
700,251,255
710,248,255
720,241,255
730,232,255
740,203,255
760,255,192
770,255,230
780,255,242
790,255,246
800,255,249
810,255,248
820,255,247
830,255,247
840,255,247
850,255,247


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
| What the world needs is more geniuses with humility, there are so few of us left.

Post Edited (Mightor) : 7/14/2007 8:06:23 PM GMT

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-07-14 21:40
    Servos were never designed to be precision devices but to have final adjustment done real time by the human controling them from the transmitter. Their use in robots is just a fortunate side effect. ( and a hack at that )

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • OSOKOSOK Posts: 35
    edited 2007-07-15 20:42
    Can you explain how the Encoder Pulses numbers relate to the actual rotation?

    What pulses did you use?

    For some reason the graph doesn't seem right...


    EDIT: I noticed that you skipped pulse 750. any idea why?
  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-15 20:58
    A standard R/C servo responds to logic level pulses usually in the range of 1ms to 2ms with neutral or center position being 1.5ms. Some servos will respond to a wider range, perhaps 0.5ms to 2.5ms. Because the granularity of the PULSOUT command of the BS2 is 2us, a value of 750 will result in an output pulse of 1.5ms. A continuous motion servo has part of the servo mechanism disabled. For those, a pulse shorter than 1.5ms will cause rotation in one direction while a pulse longer than 1.5ms will cause rotation in the other direction with its speed proportional to the time difference between the pulse width and 1.5ms. Neither the servo mechanism nor the motor of the servo is designed for any accurate relationship between the servo pulse width and the speed of the servo.
  • MightorMightor Posts: 338
    edited 2007-07-16 04:03
    OSOK,

    I used PULSOUT values varying from 650 to 850. I skipped 750 because that wouldn't have resulted in any EPs at all and I would've been waiting until the cows came home for the program to be finished counting the 255 EPs.

    There are 16 EPs in each rotation. They're related to the number of spokes in my Boe-Bot's wheels. I am using these: http://www.parallax.com/detail.asp?product_id=28107 .

    The program counts until either the left or left encoder has counted 255 EPs then it prints out the number of EPs each side has seen for that particular PULSOUT value. That is why you always see a 255 value in either one or two columns in my data. If there are two values of 255 for a given servo pulse length that means both servos were running at the same speed. If there are fewer than 255 in one columns, it means that servo was slower than the other.

    Mike,

    As for accuracy, I am now playing with an auto-calibration tool for the servos where I take a speed I want the right servo to rotate at and find a matching left servo speed to go with it. I am still using the encoders for this. I only really need 4 speeds for the bot to go at; backwards slow and fast and forwards slow and fast. Turning is easy with the compass module and accurate enough for my purposes.

    If nothing else, this is a fun little project to do. I guess if I really needed accuracy, I should use a stepper motor [noparse]:)[/noparse]

    Gr,
    Mightor

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | What the world needs is more geniuses with humility, there are so few of us left.
  • FranklinFranklin Posts: 4,747
    edited 2007-07-16 04:30
    One way to match the speeds is to use the encoders while the motors are running to adjust one wheel to slow down or speed up to match the other.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • MightorMightor Posts: 338
    edited 2007-07-16 05:46
    It's a very nice way to do it and I was planning on incorporating that in my code, however, I want to establish 4 baseline speeds for both servos first, in order to minimise corrective actions while the bot runs. I can't guarantee encoders will be aligned nicely like they are when I start my tests which may also lead to inaccurate encoder counts, which will inevitably lead to incorrect speed corrections.

    Gr,
    Mightor

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | What the world needs is more geniuses with humility, there are so few of us left.
Sign In or Register to comment.