Exponential function for RC servos

I am looking for information on calculating an exponential function for RC servos.

This is a function that is on most RC transmitters, and I would like to incorporate it into my prop projects. I am already able to input servo pulses and then put them back out. What I would like to do is add exponential to the servo pulses before I send it back out. Does anyone know how to calculate this?

Here is a breif explanation of exponential by Hitec.

Per Hitec
It is a radio function that will allow you to change the control response of the control sticks from being a linear response to what is known as an increasing response curve, or exponential. An example of how this feature is commonly used would be the pilot on an extremely responsive aerobatic aircraft using full servo throw travel and does not need much servo input to control the plane in level flight but wants to take full advantage of it's aerobatic capabilities. Therefore, exponential is programmed such that very little servo response is provided when the control sticks are near centered, or neutral. As the sticks are moved farther from the neutral point, more servo response is generated at a rate greater than a straight linear response, allowing for quick and precise maneuvers. Exponential values are available from -100% to +100%.
Tagged:

Comments

  • 9 Comments sorted by Votes Date Added
  • edited August 2011 Posts: 0Vote Up0Vote Down
    Expo just makes the gimbals less responsive or more responsive around center. So (for less responsive) assuming 1500us is center just don't program anything to happen until say 1600us or 1400us more or less. I don't know how you might calculate it. I am sure someone else does though. Expo doesn't change the speed of servos or the throw, just at what position the gimbals are responsive.

    -Ron

    EDIT: See post #4 for a good description by W9GF0 I stand corrected.
    I like Pizza.
  • edited August 2011 Posts: 0Vote Up0Vote Down
    It looks like a gamma function would work: Xout = Pow(Xin , V) where V is the strength of the curve. You'd likely want values of V > 1.

    Have a look at http://en.wikipedia.org/wiki/Gamma_correction for a pretty graph and a better explanation. The In & Out values would need to be normalized for it to work (ie, converted to the range of 0 to 1 as floats, then back again). If you need speed, I'd just generate a look up table whenever the power value changes (which presumably wouldn't be often).
  • edited August 2011 Posts: 0Vote Up0Vote Down
    RonP wrote: »
    Expo just makes the gimbals less responsive or more responsive around center. So (for less responsive) assuming 1500ms is center just don't program anything to happen until say 1600ms or 1400ms more or less. I don't know how you might calculate it. I am sure someone else does though. Expo doesn't change the speed of servos or the throw, just at what position the gimbals are responsive.
    This is not correct. What you have described is like making a deadband around center stick. Expo either increases or decreases the sensitivity of the gimbal. Positive expo will make it so that a small deflection of the stick equals an even smaller deflection of the servo, when the stick is near center. The farther the stick is deflected the greater the response of the servo relative to the stick deflection. Positive expo is used when you want very fine control such as the cyclic control of a helicopter.
  • edited August 2011 Posts: 0Vote Up0Vote Down
    W9GFO wrote: »
    This is not correct. What you have described is like making a deadband around center stick. Expo either increases or decreases the sensitivity of the gimbal. Positive expo will make it so that a small deflection of the stick equals an even smaller deflection of the servo, when the stick is near center. The farther the stick is deflected the greater the response of the servo relative to the stick deflection. Positive expo is used when you want very fine control such as the cyclic control of a helicopter.

    Good description. You are correct.:innocent:

    JR and Spektrum positive + to soften the response. Futaba its negative - to soften response. And I don't know about Hitec and others.

    -Ron
    I like Pizza.
  • edited August 2011 Posts: 49Vote Up0Vote Down
    Thanks for your response. That is what I am looking for.

    Do you know of any spin code that would allow me to setup the response curve?
    I would like to be able to set up a list from 0 to 1000, and have a non-linear response curve result.
  • edited August 2011 Posts: 49Vote Up0Vote Down
    RonP wrote: »
    Good description. You are correct.:innocent:

    JR and Spektrum positive + to soften the response. Futaba its negative - to soften response. And I don't know about Hitec and others.

    -Ron

    I have a couple JR transmitters and I love their exponential curve. I typically set all my surfaces (ailerons, rudder, and elevator) to about 40% exponentials.
  • edited August 2011 Posts: 0Vote Up0Vote Down
    I run 10% in my helicopters cyclic, 20% in my pylon racer aileron and elevator. All other planes just 10%. Works for me.

    -Ron
    I like Pizza.
  • edited August 2011 Posts: 0Vote Up0Vote Down
    This is modified from my living room lamp project. TableCount is a constant defined to be the size of the table. ExpoVal is a float for the amount of exponential you want applied, and the "1000" is the maximum value you want to allow in the table.
    PUB InitTable(ExpoVal) | index, val, gamma
    
      Table[0] := 0
      repeat index from 1 to constant(TableCount-1)
        val := Flt.FMul( constant(1.0/float(TableCount)) , Flt.FFloat(index) )      'inputs to the pow function are from 0.0 to 1.0
        gamma := Flt.Pow(val , ExpoVal )
        Table[index] := Flt.FTrunc( Flt.FMul( gamma , 1000.0 ) ) <# 1000      'results are from 0 to 1000
    

    I have not compiled & tested this, so there may be bugs, but that code should be basically what you want. To use the table, look up the absolute stick value in the table, then change the sign of the result if the input was negative, like this:
      output := -Table[ ||stickValue ]
      if( stickValue < 0 )
        output := -output
    
Sign In or Register to comment.