Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Motion Profiling (http://www.chiefdelphi.com/forums/showthread.php?t=98358)

Jared Russell 01-02-2013 03:27 PM

Re: Motion Profiling
 
Quote:

Originally Posted by apalrd (Post 1206491)
How would this algorithm deal with changes in Vprog dynamically?

If another algorithm would like to impose velocity limits dynamically, would simply setting Vprog to the imposed velocity limit allow me to impose the limit, and would the trapezoid deal with it? Or do I need something else?

I suspect the short answer is "not well", since Vprog is used both to scale the output velocity, and to determine how long to send the "full speed ahead" input. If you were to also scale T1 and T2 when you change Vprog it may work better (but I'd need to think that through a bit more).

By the way, I found a small error in my spreadsheet. In the Output Velocity column, the equation should read "=E13/$B$8*Vprog" for row 13 (for example). I was erroneously adding the sum of F1 to the result as well, resulting in brief discontinuities during edge conditions. Make the change for the whole column.

winchymatt 01-07-2013 07:10 AM

Re: Motion Profiling
 
Ok, I had allot of posts to catch up on here.. So I have been playing with the spreadsheet, which seems very nice and computationally simple, but for my application the 254 code is better as it allows real time adjustment of max velocity, acceleration etc.

As mentioned in my previous post I ported the ContinuousAccelFilter Class from the 254 code into a Borland Builder app so that I could graph the input output velocity and accel etc in real time. This way I could better understand how things work and make adjustments etc. This is now working very well, and I have a continuous tracked position target that conforms to the acceleration and max velocity, both of which can be changed in real time. However I did notice a small velocity glitch that I eventually tracked down to a negative velocity produced within the "maxAccelTime" function, this I have added an additional condition to the routine to trap this, I have to confess I didn't quite understand why this was occurring, but it was fairly easy to trap the condition and remove it, and it has not effected the operation of the routine other than to remove the glitch. If anyone is using this code and are interested here is the change I made towards the end of the "maxAccelTime" routine in the "**** new ****" comments:

Code:


    //If it is too fast, we now know how long we get to accelerate for and how long to go at constant velocity
    double accel_time = 0;
    if(top_v > max_v)
        {
        accel_time = (max_v - curr_vel) / max_a;
        const_time = (distance_left + (goal_vel * goal_vel - max_v * max_v) / (2.0 * max_a)) / max_v;
        }
    else
        {
        accel_time = (top_v - curr_vel) / start_a;

        //  **** new ****
        //  negative acceleration time caused velocity glitches
        //  when top_v < max_v

        if( accel_time < 0 )
            {
            accel_time = 0;
            }

        // **** new ****
        }

The next issue I have is making this work for three simultaneous axis. I guess I should explain that I intend to use this for a 3DOF arm, and up until now have been using a cubic spline routine to control the end effector X'Y'Z coordinates, however my cubuc spline routine does not have the ability to set acceleration and max velocity, only to move from point to point over a fixed time and thus the end effector although synchronized in all three axis is in a state of constant acceleration or deceleration. Hence my research into trapezoid velocity control.

So now I have a routine working for one axis, any thoughts on how to have three synchronized axis controlled from the same acceleration and max velocity parameters. I'm currently thinking I would have to calculate the three axis separately, then look for the axis that is going to take the longest time to complete the move, and thus reduce the max volocity of the other axis to time stretch them into synchronization.. any thoughts??


All times are GMT -5. The time now is 05:49 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi