Linear to S Curve conversion


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Silly me, I was going for a 3rd order polynomial. Doh!

    But you're right mat! Add a negative sine.



    luminas,

    Now I assume there's more information to it.
    Obviously you don't want the integer results from 0-10. I'm sure you want some decimals or something.

    Can you elaborate a little?

    Best regards,
    DT

  2. #2
    Join Date
    May 2007
    Location
    Area 71
    Posts
    52


    Did you find this post helpful? Yes | No

    Thumbs up Calculation

    Hi Darrel & Mat,


    Thanks for your great information

    I want to compensate result of an ADC input ( 0 - 1024 )
    what is the formula to do this ?


    Jon

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by luminas View Post
    Hi Darrel & Mat,
    Thanks for your great information
    I want to compensate result of an ADC input ( 0 - 1024 )
    what is the formula to do this ?
    Jon
    Look at D_T's last post...the formula is RIGHT THERE.
    D_T has already done the hard work for you.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    ...the formula is RIGHT THERE ...
    Yeah, well, except that the range is from 0-1023 now, and PBP's SIN function takes a "Binary Radian" input (0-255), giving a result of -127 to 127. Sure, it's all there.

    But now we need to line it all up.

    Got any idea's?
    <br>
    DT

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Yeah, well, except that the range is from 0-1023 now, and PBP's SIN function takes a "Binary Radian" input (0-255), giving a result of -127 to 127. Sure, it's all there.
    But now we need to line it all up.
    Got any idea's?
    <br>
    We don't know how 'hard' he needs his compensation curve...for that matter, we don't know a lot about this 'function'...

    'Divide down' the SIN result to make it less agressive, multiply it up for more compensation, add in some linear interpolation to 'fill in the blanks'...
    We just don't know what's 'REALLY' needed here.

    If this was some sort of R/C controller for a model airplane or something, I'd think he was trying to add a bit of double sided 'exponential throw' into his programming...

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    We don't know how 'hard' he needs his compensation curve...for that matter, we don't know a lot about this 'function'...
    OK, so let's stick with what we DO know.

    The original Data spanned from 0-10.
    If we expand that to 10-bit, we can make it 0-1000, plus 23. Just multiply by 100.

    And, since the PBP SIN function takes an 8-bit input, we can divide the A/D value (X) by 4 to get the Angle in "Binary Radians". (I assume this is the 'Divide down' method)
    Then running it through a short PBP program I got the SIN(A) values. (shown in the odd gray color)



    Here you can see "Less than Optimal" results.
    It's quite a large error.

    So I guess the question now is ....
    What's the "multiply it up for more compensation" method?
    <br>
    DT

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post

    Got any idea's?

    <br>
    YES ...

    IF our friend would dare to tell us what's the FINAL use ot this curve ...

    Alain

    PS: Tools for you, Darrel ...

    http://curveexpert.webhop.net/
    Attached Files Attached Files
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  8. #8
    Join Date
    May 2007
    Location
    Area 71
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    Wow, this is more than what I expected from the forum. Great !

    Darrel: You are right, first problem is solved with the negative sine things,

    now the question is" how to adjust the " hardness " of the curve


    Alain: The purpose of this curve is to compensate the output of a joystick to suit players response in a game.

    Some player like "agrresive" joystick response while some other like "standard,linear" response.

    Jon

  9. #9
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    Gain!
    x-aSIN(B)
    a is the gain.

  10. #10
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Post

    Quote Originally Posted by luminas View Post
    The purpose of this curve is to compensate the output of a joystick to suit players response in a game. Some player like "agrresive" joystick response while some other like "standard,linear" response.
    I'm a bit puzzled by that - wondering if you could explain further?

Similar Threads

  1. A/D conversion with PIC18F67J50
    By ScaleRobotics in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th May 2009, 01:48
  2. A/D conversion problem in 18F2520, 2523, 2550 etc.
    By selimkara in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 10th March 2008, 16:26
  3. Conversion problem
    By eva in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th March 2007, 18:21
  4. Help for decimal conversion
    By eva in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th March 2007, 18:20
  5. Strange A/D conversion...
    By Christos_K in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th June 2005, 01:35

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts