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

Join Date
Apr 2002
Location
No income tax, no capital gains tax. Freedom!
Posts
8,391
The goal is to generate a s-curve to go from a position, velocity and acceleration ( PVA ) of 0,0,0, to a PVA of (0.5,10,0) in 0.1 seconds. There are many ways this can be done but since the motion profile must be a s-curve, the simple linear option is out. What is the peak acceleration for your motion profile?
 
This isn't elegant but I think it's correct.

The two important relationships I pulled from the information given are:
1) The jerk vaule needs to get me whatever acceleration I need within half the move time.
2) My velocity needs to be half my target speed when I reach that acceleration level.

In equation form this is:

1) a/j = 0.05
2) a2 / (2 * j) = 5

I can get j in terms of a by manipulating Equ 1:

j = a/0.05

Substituting this into Equ 2 we have:

a2 / (2 * (a/0.05)) = 5
a2 / (40 * a) =5
a/40 = 5
a = 200

Substitute that into equation 1 and you have:

200/j =0.05
200/0.05 = j
j = 4000

So one way to accomplish a PVA move from (0,0,0) to (0.5,10,0) in 0.1 seconds is to make a jerk only move with a jerk rate of 4000 and a peak accel of 200.

Keith
 
One of the first stops for all things curvy is the sinusoidal functions.

position:
s(t) = 5t - sin(10*pi*t)/2*pi

velocity:
v(t) = 5 * (1 + cos(10*pi*t + pi))

acceleration:
a(t) = 50*pi*sin(10*pi*t)

Max acceleration is at 0.05 sec and is 157.8 units/s^2
 
Originally posted by Peter Nachtwey:

OK but what are the equation(s)

I thought the motion controller was supposed to do that ??o_O


I couldn't come up with a way to do this as a continuous equation since the basis of the whole thing isn't a continuous function. Jerk makes a step change in the middle. So I do pairs of conditioned equations:


Given:
j is jerk setpoint (4000)
a maximum is acceleration (200)
V is target velocity (10)
tm is half the total time (0.05)
t is current time





Acceleration:

t <= tm
j * t

t > tm
(j * tm) - (j * (t - tm))

Velocity:

t <= tm
0.5 * j * t2

t > tm
(0.5 * j * tm2) + (a * (t - tm)) - (0.5 * j * (t - tm)2)


Position:

t <= tm
0.166667 * j * t3

t > tm
(0.166667 * j * tm3) - (0.33333 * j * (t - tm)3)




Well that's all I have for a Saturday night. I hope it's in the ballpark.

Keith
 
Last edited:
Not him again!!!!

kamenges said:
I thought the motion controller was supposed to do that ??o_O


I couldn't come up with a way to do this as a continuous equation since the basis of the whole thing isn't a continuous function. Jerk makes a step change in the middle. So I do pairs of conditioned equations:
Your solution is correct. Two 3rd order polynomials a required to ramp up and ramp down. Only one 5th order polynomial is required. OkiePC, are you up to the challenge? Anybody?

The 5th order polynomial requires that 6 coefficients must be found. pos(t)=A+B*t+C*t^2+D*t^3+E*t^4+F*t^5. There are 6 unkowns but there are also 6 knowns. The PVA at 0 and 0.5 seconds.










Given:
j is jerk setpoint (4000)
a maximum is acceleration (200)
V is target velocity (10)
tm is half the total time (0.05)
t is current time





Acceleration:

t <= tm
j * t

t > tm
(j * tm) - (j * (t - tm))

Velocity:

t <= tm
0.5 * j * t2

t > tm
(0.5 * j * tm2) + (a * (t - tm)) - (0.5 * j * (t - tm)2)


Position:

t <= tm
0.166667 * j * t3

t > tm
(0.166667 * j * tm3) + (v * (t - tm)) - (0.166667 * j * (t - tm)3)




Well that's all I have for a Saturday night. I hope it's in the ballpark.

Keith[/QUOTE]
 
L D[AR2,P#0.0], I got same result. When I first read this I was thinking about polynomial of 5th order, because I had lectures from robotics on colledge (trajectory planning).
However, I was confused when I read that profile must be s-curve. S-curve (generally speaking) can be obtained also with two quadratic equations (one with coefficient next to t^2 positive and other with negative coefficient).
Don't really know what you mean Peter, because solution that can be obtained using 5th order polynomial is not "s-curve" shape.

http://www.plctalk.net/qanda/uploads/Profile.jpg
 
Last edited:
Pandiani's graph looks like pos(t). Taking the derivative of that fucntion, which is 3000x2 - 20000x3, and it should give you the s-curve shape you are looking for.


Pandiani, for reasons I'm not sure of, the curve shapes are refering to the velocity not the position. I'm sure someone out there knows the history on that but I don't.


Keith
 
Last edited:
Keith is correct - here is the v(t) curve:

s001.JPG
 
The answer for a 5th order is right

I got a PM the asked why I haven't mentioned using trig functions. Our second generation product used trig functions to ramp from one point to another. The reason why we don't use trig functions anymore is that it is too difficult to match the derivatives when changing changing the motion profile during the ramp. A 5th order motion profiles allows one to go from any initial PVA to any desired PVA in a specified time period. All the user must specify is the final PVA and the time to get there. One still must be make sure no limits are exceeded.

Notice that the peak acceleration for the 5th order polynomial is 150 whereas the peak acceleration for the 3rd order polynomial is 200. If the motor/drive is acceleration limited this could make a big difference. S-curves are often required but there is a price to be paid. I often have customers and distributors do simple calculations assuming linear ramps and are surprized when I tell them the peak acceleration is 1.5 times higher.

A 7th order motion profile's peak acceleration is 187.5. Does anybody want to prove that for a Sunday afternoon math quiz? I have 9th order polynomials worked out too but there isn't any point.

A more commonly use method of ramping is to use what is called a 7 segment motion profile. 3 segments are used to ramp up and 3 are need to ramp down. 3 segments are need to ramp when the jerk is relatively high and there is limit on how high the acceleration rate can be.

For instance, in Keith's solution there are two motion segments ( equations ). What if the peak acceleration is limited to 150 and the jerk is limited to 10000. Now a 3rd equation is required. One where the jerk is positive, one where the jerk is zero and the acceleration is at its peak, finally one more where the jerk is negative. This can be the Sunday evening math quiz.

OkiePC, are you following this?
 
kamenges said:
Pandiani, for reasons I'm not sure of, the curve shapes are refering to the velocity not the position. I'm sure someone out there knows the history on that but I don't.
Keith

Thanks Keith, I didn't know that. I wasn't really familiar with the term "s-curves".

Peter, I must admit I don't follow this story about peak acceleration. What do you mean by that? Is peak acceleation defined as max(d2p(t)/dt^2), where p(t) is position or what?
 
Last edited:
Pandiani - here's the accel(t) curve. Yes, peak means maximum in this case.


a001.JPG

Here's jerk(t) as well:

j001.JPG
 
Last edited:
Note

The first is that accelerations can not change instantly. Motors can't change acceleration instantly because the inductance doesn't allow instantaneous current changes. Hydraulic systems can change acceleration instantaneously either because the pressure can't change instantly. It takes oil flow to change the pressure. Therefore a motion system cannot follow a linear ramp, it can only come close and how close it comes depends a lot on how fast the system can change the acceleration. This is where the jerk comes in.

Seventh Order Motion Profile
ftp://ftp.deltacompsys.com/public/NG/Mathcad%20-%20tg7-PVAJ-PVAJ.pdf
 

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,716
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,583
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,825
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
403
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,380
Back
Top Bottom