Saturday math quiz. OkiePC wants so talk about s-curves.

Peter,

How do you get the 7th order coefficient to be zero? I got a different answer which meets all the boundary conditions but does not match yours. I came up with:

position:
s(t):2.5e7 * t^7 - 6.5e6 * t^6 + 4.5e5 * t^5

The acceleration looks like this:

7thaccel.JPG
 
I didn't do the jerk initial condisions, I has used one of the higher order terms for an initial condition...

I attached a pdf of what I came up with. I believe it matches yours.
 
You got it.

ndzied1 said:
I didn't do the jerk initial condisions, I has used one of the higher order terms for an initial condition...

I attached a pdf of what I came up with. I believe it matches yours.
Yes, it looks like one of my worksheets right down to the A,B,C,D,E,F,G,H and Coef variable names. Now the whole world knows how to compute 5th, 7th, 9th,..... order polynomials.

You should also notice that you can now generate a motion profile from any current PVAJ ( position, velocity, acceleration and jerk state ) to the next PVAJ in a time period t. If you desire you can use your new 7th order motion profile generator to solve Russmartin's problem of a few days ago. Russ really just needed to move 21.5 in 4.77777 seconds. If you specify the initial PVAJ(0)=(0,0,0,0) and the PVAJ(4.7777)=(21.5,0,0,0) you can calculate one polynomial that will be smooth and yet you didn't have to specify an acceleration or speed. Just the end results, not the means. One could even put this formula in a compute block and generate a smooth profile in PLC. The derivatives can be used to generate velocity, acceleration and jerk feed forward contributions to the control output.

Did you notice the coefficient for the H parameter is not 0? It should be. Mathcad can't be completely trusted. This is a pretty flagrant round of error. I find the symbolic solutions for the polynomials and then use proper numerical method to rearrange the formulas to calculate the coefficients with little or no round of error. The order in which you do your calculations is very important. Mathcad's internal calculations are that smart yet. Scilab will generate the same error.

No one has tackled the 3 segment ramps yet but I think we are getting close to the end here. I bet that no one will look at a thread on ramping quite the same way again.
 
Yea, I got it too. Although, it was very strange in the begining. For me, since there were six initial conditions at start PVA(0) and PVA(t), it was natural to use 5th order polynomial. I was confused when you suggested 7th order, but then I saw you used two more conditions for jerk. Now everything make sense.
What I'll probably never uderstand is how Keith drew those conclusions in post number 2.
 
I need to brush up om my linear algebra. The more I go along the more I find it would be nice to be able to solve systems of equations. I could use a program to do it but it would be nice to have a nuts and bolts handle on how to do it.


Originally posted by Pandiani:

What I'll probably never uderstand is how Keith drew those conclusions in post number 2.

I'm assuming you are referring to the initial two conclusions about the accel and jerk relationships. As Peter always says, it comes down to your toolbox. I have a pretty sparce toolbox so I tends to get a bit myopic with my solutions.

My solution is post #2 is a simple 3rd order solution. I don't ramp the jerk, I use a constant and change the sign half way through. Since the jerk isn't a continuois value or function I can't use the standard position equation or it's derivatives.

The basic idea is that the whole acceleration will occur in jerk. There is no constant acceleration section. Also, the jerk value is a constant that changes sign half way through. I also know that my acceleration value needs to ramp up until I reach 1/2 my target velocity so that it will reach zero again as I ramp the acceleration down as I approach the target velocity. So whatever my jerk and peak acceleration values end up being I know that I need to reach my peak acceleration at that jerk value half way through the velocity profile. Since Peter stated that the acceleration occurs in 0.1 sec we have:

a/j = 0.05

The other equation is just a re-arranging of V=1/2*j*t2 knowing that t = a/j. This yields:

V = a2 / (2 * j)

Th V value in this case is half the target velocity since this is the range that the acceleration value will be increasing to.

What it comes down to is available tools. The way I did it is not the best but it's the only way I knew at that time. Tools, people. Tools.

Keith
 
kamenges said:
I need to brush up om my linear algebra. The more I go along the more I find it would be nice to be able to solve systems of equations. I could use a program to do it but it would be nice to have a nuts and bolts handle on how to do it.

No promises, but if I have time I'll run it out by hand. I had meant to do that but ran out of time last night so I threw it into MathCAD which, as Peter pointed out, seems a bit lacking in it's solve capability. By hand it's not complicated but just tedious and you have to make sure you don't make any mistakes in the beginning becuase they propigate so well šŸ™ƒ

Peter Nachtwey said:
Now the whole world knows how to compute 5th, 7th, 9th,..... order polynomials.
I'd like to think the whole world is watching but it's probably more like, "The few, the proud..." I hope you aren't saying I'm giving away any big secrets. This is pretty basic college math stuff if you were in the Engineering curriculum. šŸ““ I borrowed the notation from your post #6 and the PDF file you posted.
 
You should also notice that you can now generate a motion profile from any current PVAJ ( position, velocity, acceleration and jerk state ) to the next PVAJ in a time period t.

Necromancing an old thread here. I was looking at some of the different ways that S-Curves get generated, and stumbled across this thread in my searches. Fantastic little gem here.

One thing I noted as I played with the maths, is that this method works great as long as the relationship between the change in Time, Position, and Velocity are proportional to each other using the formula below.

(P2-P1)=((V2-V1)*(t2-t1))/2

In other words, in the velocity(t) plot, if a straight line is drawn from t1,V1 to t2,V2, it results in a right triangle. The S shape generated by this method will straddle the hypotenuse proportionally, crossing at the midpoint.

However, if you start arbitrarily throwing P,V, and t values in, the curves generated by this method start getting nutty real fast if they break the above relationship, so it doesn't appear to be as completely general purpose as simply picking (PVAJ)1 and (PVAJ)2, and the time you want to take from 1 to 2.

You still have to sanity check some of these relationships as they are all related.
 
However, if you start arbitrarily throwing P,V, and t values in, the curves generated by this method start getting nutty real fast if they break the above relationship,
You should give an example. You must realize that your trajectory formula is just a simple ramp.


so it doesn't appear to be as completely general purpose as simply picking (PVAJ)1 and (PVAJ)2, and the time you want to take from 1 to 2.
But you can. I believe it was done above but you can get some bizarre answers. A common error is not specify a good value for the time between the points.

You still have to sanity check some of these relationships as they are all related.
Yes they are related. To make sure the relationships hold you need to calculate the equation for position, velocity, acceleration and jerk at the same time using simultaneous equations. Then the formulas will keep the right relationship between position, velocity, acceleration and jerk.

Here is an example of how to generate the formulas for a point to point move using a series of third order motion segments.
http://deltamotion.com/peter/Maxima/Seg1234567.html
You can see there are a lot of equations that must be solved simultaneously so all the proper relationships are maintained.
 
Last edited:

Similar Topics

I've wanted to experiment with this for a while, and this morning was the perfect time with the cold, heavy rain. I have a 1756-DNB in my test...
Replies
6
Views
2,693
As some may know from a previous post I was tossed into completing a little programming because our normal programmer is on vacation. Well Iā€™ve...
Replies
10
Views
2,567
I am in need of some help this weekend. I sadly have to work on a AB 1336 VFD. I have it set up in a PI control mode. It works fine but, I can't...
Replies
17
Views
10,809
I have an expression in a structured text routine of a Logix controller that looks more or less like the following: ResultInteger := Integer1 *...
Replies
13
Views
359
This application has a motor with encoder feedback that drives a linear actuator that moves in/out, and is at roughly 45 degs from horiz. As the...
Replies
19
Views
1,353
Back
Top Bottom