Shop OBEX P1 Docs P2 Docs Learn Events
What is servo "ramping"? — Parallax Forums

What is servo "ramping"?

StrelnikovStrelnikov Posts: 18
edited 2012-03-08 12:07 in Propeller 1
I downloaded Servo32v7 from the OBEX and looked at it a bit, noticing the code for "ramping". I loaded it into ViewPort, observing it both with and without "ramping" and didn't really see any difference (unless I missed something subtle). It's not obvious to me from the code what's going on so hopefully someone can enlighten me...

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-03-06 18:35
    Normally a servo will immediately move to the new position specified at its highest possible speed. With continuous motion servos, the equivalent is for the servo to change speed (and/or direction) as quickly as possible when the new speed is specified by a change in servo control pulse width. Ramping simply means that, when a new position or speed is specified, there's also a "time to change" specified or something similar. The servo I/O routines will take that amount of time to change the actual control pulse width sent out step by step from the current value to the newly specified value.
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-03-06 18:49
    As you don't have speed feedback, you just take for granted the stepper obeys.
    But of you jump from zero stepping speed to the max in a instant the stepper probably
    will stutter and don't move.
  • StrelnikovStrelnikov Posts: 18
    edited 2012-03-06 19:40
    Makes sense thanks for the explanation.

    What does the following mean (from the source code)?

    '' Note: It takes aproximately 3100 clocks to process all 32 Channels,
    '' So the resolution is about 38.75us

    '' increment/decrement pulse width every 3100 clocks
    '' So at 2us and a full sweep 500us to 2500us (Delta of 2000us)
    '' the total time travel would be 38.75ms
    ''
    '' 160 = 2us @ 38.750ms
    '' 240 = 3us @ 25.833ms
    '' 320 = 4us @ 19.375ms
    '' 400 = 5us @ 15.500ms
    '' 413 = 5.1625us @ 15.012ms
    '' 480 = 6us @ 12.917ms
    '' 560 = 7us @ 11.071ms
    '' 620 = 7.75us @ 10ms
    '' 640 = 8us @ 9.6875ms
  • Mike GreenMike Green Posts: 23,101
    edited 2012-03-06 19:59
    The ramping routine operates at full speed. It goes through the 32 channels, one at a time. For each channel, it increments or decrements the control pulse width as needed once per pass. The code takes about 3100 system clock cycles (of 12.5ns) to execute to process all 32 channels. That comes out to about 38.75us per increment / decrement cycle. If any servo has to go through its full range, that's 1000 increments with each increment representing 2us and a full range being from 500us to 2500us. The travel time would be 1000 x 38.75us = 38.75ms.
  • JonnyMacJonnyMac Posts: 9,197
    edited 2012-03-07 05:59
    I never understood the "ramping" thing either. While working on my own servo driver I looked at popular devices on the market to emulate. My servo object, which will control up to eight servos (I've never had need for more) provides speed control so that you can set the desired timing for the servo to move from one position to another. Please understand that I did come up with these ideas, I just "liberated" good ideas from a successful product (SSC-32).

    My object: http://obex.parallax.com/objects/445/

    Note that position and speed control happen in a single cog and the code is written in Spin for easy updates.
  • Martin_HMartin_H Posts: 4,051
    edited 2012-03-07 06:30
    I used the Servo32v7 object with my robot arm with and without ramping. Using a modest ramp time (like a second) resulted in much smoother movement and less reaction torque when making large changes in position. For small changes in position it didn't make a difference, but that should be expected.

    For CR servos ramping is definitely useful because if you go max velocity out of the gate your wheels will slip. Wheels slip is death to odometry accuracy. Phil's applying encoders document has some good PBASIC ramping routines which I've used in several projects now.
  • StrelnikovStrelnikov Posts: 18
    edited 2012-03-08 10:50
    Where is Phil's applying encoders document? Did you use the PBASIC ramping routines in place of or in addition to the Servo32v7 ramping?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-08 11:00
    Strelnikov wrote: »
    Where is Phil's applying encoders document? Did you use the PBASIC ramping routines in place of or in addition to the Servo32v7 ramping?

    I think it's here.

    It's completely separate from Servo32v7.

    Phil's paper goes through the theory of using encoders. Page 7 talks about ramping. The paper is not light reading.
  • Martin_HMartin_H Posts: 4,051
    edited 2012-03-08 11:07
    Strelnikov wrote: »
    Did you use the PBASIC ramping routines in place of or in addition to the Servo32v7 ramping?

    Duane gave you the correct URL to the PDF. I still use the BS2 for many projects and use those PBASIC routines instead of the Servo32v7 when my project is BS2 based.
  • StrelnikovStrelnikov Posts: 18
    edited 2012-03-08 11:19
    Thanks very much guys. I haven't been around here very long but I haven't seen anything from Phil that could be classified as "light reading". Definitely something from a higher dimension.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-08 11:28
    Strelnikov wrote: »
    I haven't been around here very long but I haven't seen anything from Phil that could be classified as "light reading".

    This made me laugh out loud. I agree.
  • ZootZoot Posts: 2,227
    edited 2012-03-08 11:36
    I'm with Jon -- ramping without real time functions isn't all that useful. My own SX servo (and motor) controllers allow for real time ramping as Jon's object does -- the servo/motor is given a TIME required to complete the move. It's more intuitive ("move to X in 3.3 seconds") but more importantly it lets you coordinate multiple servos or motors so they all arrive at their final position or speed at the same time, regardless of the length of the move (a servo that has to move farther in the same time moves faster).
  • Martin_HMartin_H Posts: 4,051
    edited 2012-03-08 12:07
    Duane Degn wrote: »
    Phil's paper goes through the theory of using encoders. Page 7 talks about ramping. The paper is not light reading.

    I've read through that paper several times and the code. I mostly understand it, but there's a few bits of the servo ramping routine that are still black magic. I have half a mind to translate them into C to force myself to truly understand them.
Sign In or Register to comment.