Motion profile generator.


Closed Thread
Results 1 to 40 of 56

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Motion profile generator.

    Hi Darrel,
    Thank you very much for spending time on this, I appreciate it!
    I guess +/-5 isn't TOO bad, always ending up short of target would be better than overshooting, then I could "creep" the position the last couple of counts but obviously ending up right on the spot was/is the goal.

    Is it supposed to be able to move to any target position? Not just a multiple of V_Max?
    Yes, absolutely. Any arbitrary position.

    Is it supposed to move from any position to any other position?
    Yes, absolutely. From one arbitrary position to another, in both directions. But I guess you can think the profile generator as moving from 0 to any position by simply taking the "output-position" of the profile generator and add that to the actual position variable. Ie the profile generator creates a relative position output which is then added to the real position variable. Hope that makes sense.

    Or is that part handled in your routines? And this is just a "profile" that gets mapped onto the movement?
    Not sure I understand, or perhaps the answer to the previous question covers it (reading it again I think it did)....
    Anyway, the feedback loop moves the motor to whatever position is put in the Position variable. But I need to "move" the target position at a speed that the motor and load can follow in real life. Simply stepping the position variable +/-12345 counts (or whatever) is very hard on the motor and for the PID-loop to handle without overshooting etc. It can be handled by de-tuning the filter to less than optimal response but who wants that.

    The best way to move from one position to another is to "move" the target position at a pace that the motor can actually follow. Ie ramp it up, keep at speed, ramp it down. Or, if the move is short, ramp up and at half the distance ramp down. Ideally it should be done with a 3rd order motion profile to reduce the jerk at the beginning and end of the acceleration phase. Ie you're not only ramping up/down the velocity but your also ramping up/down the acceleration creating an S-curved velocity profile instead of one with linear "sloped". But like I said, the 2nd order one proved hard enough.

    Again, thanks!

    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default Re: Motion profile generator.

    >Thank you very much for spending time on this, I appreciate it!
    You help everyone out too, it's nice to be able to do something for you for a change.

    Thanks for the explanations, now I have a better understanding of what it needs to do.

    Although the idea of just splitting the profile in half and doing the exact same thing in reverse for the second half was interesting ... that's what's causing it to only move to multiples of V_Max. I need to change that.

    And I need to make it go both directions, it only goes forward right now.

    I hope to have something by the time you wake up in the morning.
    Sometimes being on the other side of the planet is helpful.
    DT

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Motion profile generator.

    Thanks Darrel!

    Actually, I don't think you should need to worry about the direction. Perhaps I misunderstood your earlier question and overcomplicated my explaination after all.

    How about this:
    * The "global position variable" is the expected motor position at any given time. The PID loop servos the motor to this position.
    * The "relative position variable" is the output of the profile generator, exactly as you shown earlier, always starting a new move at 0.
    * When a new move is commanded it is easy to calculate if the target position is positive or negative relative to the current "global position".
    * A profile, starting at 0 and ending at ABS(Target Position - Global Position) is then generated.
    * Depending on the direction or "polarity" the output of the profile generator is added or subtracted from the Global Position variable one "tick" at a time.
    * The PID loop makes the motor follow the Global Position variable very smoothly and everyone's happy, especially me :-)

    Does that make sense?

    /Henrik.

    EDIT: Put another way... Acceleration is added to Velocity. Velocity is added to RelativePosition. RelativePosition is added to OR subtracted from GlobalPosition.
    Last edited by HenrikOlsson; - 28th January 2013 at 18:08.

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: Motion profile generator.

    H,
    Ditto on you always helping everyone. If this isn't too elementary relating to where your at.......

    on de-celleration when V_Max reaches to 0...zero, recalculate the ACC (will be de-celerate) val.
    if you want the same amount of iterations to de-cel as used to acelerate, at A=10 then 100/10 for 10 loops or A=15 for 100/15 for 6? or 7? loops..............
    then subtract present pos (@ V_MAX=0) from desired pos. Thats the actual steps to stopping ??
    now use sum of # loops...( sum=loops(loops+1)/2) is new ACC val to loop to 0 (zero) over that many loops (should be +- 1 or 2 from the starting ACC val)
    now there will be either 0 or some amount less than A as a final step to stop.
    should be a few more lines of code to test and calc.
    I think Darrel mentioned re-calc something.
    don
    Last edited by amgen; - 28th January 2013 at 21:06.

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


    Did you find this post helpful? Yes | No

    Default Re: Motion profile generator.

    Maaaannnnn ... This is harder than it looks.

    Well, I have it going to the exact target position with zero error ... as long as it's able to reach the maximum velocity (the flat part of the profile).

    But if the target position isn't far enough away, and it doesn't reach V_Max before it has to decelerate ... it overshoots the center, and with the maximum deceleration (A_Max) ... the velocity can't reach 0 until it's past the target. Arrrrrggg.

    So on the shorter distances, I'll have to stop accelerating before it gets half way there, and calculate a new slope for the second half so that it stays under the maximum deceleration and gets the velocity to 0 before or at the target position. This way will make it decelerate slightly slower than it accelerates. Probably not noticable though.

    Need more time.
    DT

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Motion profile generator.

    Darrel,
    What, you need more time? Unacceptable, I need a working solution NOW ;-)
    Seriously, take all the time you need, I appreciate any and all help!

    I know, I found it quite a bit harder....

    Since I don't know how you're actually aproaching this I'm just thinking out loud:
    On the short moves I'm thinking how it would work out if the distance was simply cut in half and then the actual acceleration value tweaked to fit so we'd hit right on the centermark while accelerating. Then start decelerating at the same slope would make us end up at the target, right? I wonder what the worst case deviation from the set acceleration value would be... Code size and speed is obviosuly of interest as well...

    I'm looking forward to see what you come up with!

    Don,
    Perhaps Darrels aproach is exactly what you're trying to explain but I must I admit I don't quite follow what you're trying to explain.
    If an error at the end of the move of alwas less than A_Max is the best we can get then so be it but it sounds like Darrel is really onto something.

    Thank you both!
    /Henrik.

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: Motion profile generator.

    Henrik,
    While the professional is working up the best scheme.

    Question..... on the last itteration to stopping, can you subtract 'position now' from 'position desired' ?
    and if so, can you move exact steps of the difference with the A value?

    Don

Similar Threads

  1. Motion Capturing
    By koossa in forum Off Topic
    Replies: 0
    Last Post: - 30th June 2009, 11:05
  2. Suggest a motion sensor Please
    By sougata in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 4th March 2007, 13:22
  3. Wireless Motion Sensors.
    By koossa in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 17th October 2006, 21:57
  4. Need low Profile LCDs
    By Foxx373 in forum General
    Replies: 8
    Last Post: - 26th October 2005, 17:33
  5. Motion Tracking
    By JEC in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 5th November 2004, 00:58

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