S-Curve Equations: Modeling 7 Segment Motion Profile

  • Thread starter JayD
  • Start date
In summary, JayD is trying to model a 7-segment S-Curve Motion Profile with VBA. He is using the following equations: A = A + J * t, V = V + (A * t) + (0.5 * J * t ^ 2), X = X + (V * t) + ((A / 2) * (t ^ 2)), and x = displacement. He is struggling with the final change over from segment 6 to 7 (constant negative acc to non constant negative acceleration). The constraints he has are: current velocity (V), final velocity (V_f =0), current acceleration (A), final acceleration (A_f =0), current displacement (X
  • #1
JayD
1
0
S-Curve Equations??

Hi All,

Am new to this but here goes.

I am trying to model a 7 segement S-Curve Motion Profile (see http://en.wikipedia.org/wiki/File:Third-order_motion_profile.svg" ) with VBA. I am wanting to use a linear encoder value to determine the switching points between the segments.

I am using the following equations:

A = A + J * t
V = V + (A * t) + (0.5 * J * t ^ 2)
X = X + (V * t) + ((A / 2) * (t ^ 2)) + ((J / 6) * (t ^ 3))

x = displacement
v = velocity
a = acceleration
j = jerk
t = time interval

I am struggling with the final change over from segment 6 to 7 (constant negative acc to non constant negative acceleration) as I want to use distance to Target (X_Target - X) as a trigger.


The constraints I have are:
  • current velocity (V)
  • final velocity (V_f =0)
  • current acceleration (A)
  • final acceleration (A_f =0)
  • current displacement (X)
  • final displacement (X_f =X_Target)

The variables are:
  • Time (t)
  • Jerk (J)

Hope this makes sense.

Any suggestions/help would be appreciated.

Cheers
JD
 
Last edited by a moderator:
Physics news on Phys.org
  • #2


It’s highly probable JayD that I do not operate at your level. I am not an academic, I’m just an engineer who has worked with servo applications. My first impression is that your problem really ought not to be so difficult to solve. The particularities you wish to operate within shouldn’t really present too much difficulty to anyone who is comfortable with a little algebra. There is a fairly generic set of base formulae for specifying an ‘s-curve’ motion profile. Somewhere, I have an Excel spreadsheet I made that allowed me to generate motion profiles from a small number of input parameters. Mine was generating an ‘x-y’ look-up table of master axis position against slave axis position, but again, I think you’ll see quite easily that adapting it to your requirements is not so much of a challenge. The first problem is that, if I remember correctly, I can’t attach an Excel spreadsheet to a post. I may just have to post the base formulae and then, if necessary, work with you to produce the result you need. My second problem is that I don’t have the spreadsheet or the formulae to hand. The information you want is almost certainly out there in motion control textbooks, and I dare say even on-line somewhere. If you find them, or someone else posts with what you need, then all well and good. If you are interested in what I have, I should be able to supply it later on today.
 
  • #3


Right JayD, I have found all of my old data on S-curves, and inevitably, it’s all a bit more involved than I had remembered – it is nearly ten years since I was actively working on this lot! I not only have spreadsheets, I also have some word documents explaining it all, but as far as I understand, I can’t attach them to a post. Detailing all the formulae using Latex would take a while. I suppose that the first thing I need is some feedback from you on whether you think what I have is of any use to you. Let me just try to explain it as best I can.

The input parameters are acceleration time, starting velocity, velocity change and smoothing. Now in my case, smoothing was specified as a proportion. A value of zero gave you pure linear acceleration. A value of 1 meant that the increasing acceleration phase would blend directly into the decreasing acceleration phase, with no linear phase at all. A value of 0.5 would mean that the first quarter of the acceleration phase was increasing acceleration, the middle half was linear acceleration and the final quarter was decreasing acceleration. A value of 0.333 would give three phases of equal time. The formulae do allow for a non-zero starting velocity, and do also cope with a profile that begins with deceleration. The acceleration and deceleration phases are purely symmetrical in these profiles, but again adapting it to specify different acceleration and deceleration parameters should not be too hard. From the input parameters the formulae calculate velocity against time and also distance traveled against time.

Does this sound like it might be useful to you? If so, I’ll try to figure out the most efficient way to communicate it to you.
 
Last edited:
  • #4
S-Curve Equations??

I am also beginner in S-Motion curve. I do know velocity, accl, jerk. i want to know the time t for a particular displacement S. can anyone tell me the formula for 7-segment and 5-segment curve.
 
  • #5


hello Ken Natton this is devendra jain. i am beginner in s-motion curve. I just start study on that but finding the proper way to start. i am just referring some website and some ebook. will you pls suggest me a proper way to start the study and can you send me some other document which you have on my mail id
<< e-mail address deleted by Mentors >>

Thanks in advance and regarda
devendra jain
<< e-mail address deleted by Mentors >>
india
 
Last edited by a moderator:
  • #6


Hi Devendra,

I have sent some documents to the e-mail address you supplied. I hope they are useful for you! Anything further you wish to discuss, I am happy to do so. And perhaps, in the spirit of the forum we should conduct that discussion here on the forum, in case what we discuss is of interest to anyone else.

Ken
 
  • #7


JayD,

I did not understand fully your question.
"S-Curve motion" means nothing to me.

However, I have the feeling that you might be interrested by cubic splines.
Have a look at these Googlies:

And specially this extract from NR (http://www.nr.com/" ):

If cubic splines is what you need, then you will have no difficulty to find code for that in almost any language, including VBA.
NR is not available in VBA edition.
However, the cubic spline routine in NR is very short, and it would not be a big job to translate it.
(less than 30 lines)

As an NR fan, I have not used http://www.alglib.net/" yet.
You light enjoy, since a lot is available in various languages including VB6.
 
Last edited by a moderator:
  • #8


Not exactly certain of your degree of interest, lalbatros, but here is a paragraph from my document that explains exactly what an 's-curve' is in the context of motion profiling:

‘S’ curve is the term used for a velocity profile using smoothed acceleration and deceleration. When no smoothing is applied, wherever the profile changes from constant speed to linear acceleration or deceleration represents a sudden shock application of force. Equally, wherever the profile changes from acceleration or deceleration to constant speed represents a sudden removal of force. If, wherever force is to be applied or removed, it is fed in gradually and pulled back gradually, the velocity profile will form a curve where the force is being applied and removed. This is called smoothing. The resulting curve tends to resemble an approximate ‘S’ shape, hence the term ‘S’ curve.

Another perspective that perhaps helps to understand it is that, if velocity is rate of change of position in metres per second, and acceleration is rate of change of velocity in metres per second squared, then jerk or smoothing is rate of change of acceleration in metres per second cubed. I think you will see it is something quite different from what you are talking about.
 
  • #9


Thanks for the clarification, Ken.
If I understand correctly, the discontinuities are shifted from the acceleration to the jerk.
I think there might be other good reasons to go for cubic splines, specially because of the boundary conditions that they allow.
Note that I still can't understand what the "trigger" means in the original question.
I also don't understand what the "linear encoder" is and why it is mentioned, as well as if the "switching points" are those points defining the constant-jerk segments.

My guess, however, is that the segments (with constant jerk) are not pre-defined and would be determined according to some objectives.
These hypothetical objectives are unknown to me, and I can't help a lot to solve them.
Maybe it is about minimizing the time spend on a trajectory, I don't know.
This reminds me of another https://www.physicsforums.com/showthread.php?t=462501".

I reacted because I saw a cubic equation for x as well as "7 segments".
I thought that it was maybe about a piece wise cubic smooth curve,
and that would be the splines that I used often in the past.

In addition, I saw that JayD had a problem on a boundary.
This could be related to solving the boundary conditions for the splines, which is explained in NR (3.3 p 115) .
If JayD tries that sort of thing for the first time, this may be not totally obvious.
The algorithm is rather simple and fast, but it might not be so obvious to derive it.

If a layer of optimization needs to be put on top if the specific problem submitted by JayD, then it might be useful to delay to solution and to see how the whole formulation fits for an optimization.
 
Last edited by a moderator:
  • #10


1. Could you please share the source for these equations? I am looking for some literature which discusses these equations.

2. Also, I am wondering why a 7 segment curve is needed. Wouldn't a sinusoidal curve suffice?
JayD said:
Hi All,

Am new to this but here goes.

I am trying to model a 7 segement S-Curve Motion Profile (see http://en.wikipedia.org/wiki/File:Third-order_motion_profile.svg" ) with VBA. I am wanting to use a linear encoder value to determine the switching points between the segments.

I am using the following equations:

A = A + J * t
V = V + (A * t) + (0.5 * J * t ^ 2)
X = X + (V * t) + ((A / 2) * (t ^ 2)) + ((J / 6) * (t ^ 3))

x = displacement
v = velocity
a = acceleration
j = jerk
t = time interval

I am struggling with the final change over from segment 6 to 7 (constant negative acc to non constant negative acceleration) as I want to use distance to Target (X_Target - X) as a trigger. The constraints I have are:
  • current velocity (V)
  • final velocity (V_f =0)
  • current acceleration (A)
  • final acceleration (A_f =0)
  • current displacement (X)
  • final displacement (X_f =X_Target)

The variables are:
  • Time (t)
  • Jerk (J)

Hope this makes sense.

Any suggestions/help would be appreciated.

Cheers
JD
 
Last edited by a moderator:
  • #11


Well, pfuser01, I suppose the ultimate source is the standard speed / time diagram formulae well known to many a high school physics student:

[tex]v = u + at[/tex]

[tex]v^2 = u^2 + 2as[/tex]

[tex]s = ut + \frac{at^2}{2}[/tex]

Where:
v = final velocity m/s
u = initial velocity m/s
t = time s
a = acceleration m/s^2
s = distance travelled m

These formulae would give you a trapezoidal profile. The smoothing portions are essentially parabola and thus specified by the standard quadratic equation

y = ax^2 + bx + c

but in this case, x is time and y is velocity of course.

All the actual formulae are essentially derived from these.

You could have a sinusoidal profile, that would essentially mean that there was no linear acceleration or deceleration portion, and I suppose no constant velocity portion either. The reason that is not the usual solution is because the imperative to use smoothing does not require that the smoothing is as extreme as that. Linear acceleration and deceleration is not what smoothing seeks to avoid, it is the shock application of force represented by the transitions from constant velocity to acceleration and vice versa that smoothing is intended to avoid. It is perhaps easiest to conceive the force / time diagram. With the trapezoidal speed / time diagram, the force / time diagram is essentially rectangular. When smoothing is employed, the force / time diagram itself becomes trapezoidal. Don’t know if that makes any sense to you.
 
Last edited:
  • #12


Ken:

Thanks. I was looking for some motion control book which would also discuss the higher order modes that might result in selecting a certain profile over the other. I am obviously interested in faster settling time.

Also, if I wasn't clear, the jerk profile will be something like [sine 0 0 0 0 sine]. So, this will result in a constant velocity.

Thanks again.

Ken Natton said:
Well, pfuser01, I suppose the ultimate source is the standard speed / time diagram formulae well known to many a high school physics student:

[tex]v = u + at[/tex]

[tex]v^2 = u^2 + 2as[/tex]

[tex]s = ut + \frac{at^2}{2}[/tex]

Where:
v = final velocity m/s
u = initial velocity m/s
t = time s
a = acceleration m/s^2
s = distance travelled m

These formulae would give you a trapezoidal profile. The smoothing portions are essentially parabola and thus specified by the standard quadratic equation

y = ax^2 + bx + c

but in this case, x is time and y is velocity of course.

All the actual formulae are essentially derived from these.

You could have a sinusoidal profile, that would essentially mean that there was no linear acceleration or deceleration portion, and I suppose no constant velocity portion either. The reason that is not the usual solution is because the imperative to use smoothing does not require that the smoothing is as extreme as that. Linear acceleration and deceleration is not what smoothing seeks to avoid, it is the shock application of force represented by the transitions from constant velocity to acceleration and vice versa that smoothing is intended to avoid. It is perhaps easiest to conceive the force / time diagram. With the trapezoidal speed / time diagram, the force / time diagram is essentially rectangular. When smoothing is employed, the force / time diagram itself becomes trapezoidal. Don’t know if that makes any sense to you.
 
  • #13


pfuser01 said:
the jerk profile will be something like [sine 0 0 0 0 sine]. So, this will result in a constant velocity.


I must confess pfuser01, I have no idea what you mean by that. A constant velocity profile would be a horizontal line.

And perhaps we are on different wavelengths, but to me settling time would be a question of the tuning of your position control loop. S-curve profiling is simply a question of the position command to that loop.

I’m afraid I have no books I can recommend. There is some material available on the web.

http://www.pmdcorp.com/downloads/Mathematics_of_Motion_Control_Profiles.pdf

http://www.pmdcorp.com/news/articles/html/Mathematics_of_Motion_Control_Profiles.cfm
 
Last edited by a moderator:

1. What is an S-Curve equation?

An S-Curve equation is a mathematical formula used to model the motion profile of a 7 segment motion. It is based on the S-shaped curve that represents the acceleration, constant velocity, and deceleration phases of the motion.

2. How is an S-Curve equation used in modeling motion profiles?

The S-Curve equation is used to determine the acceleration, velocity, and position of a moving object at any given time during the motion. It helps to predict the behavior of the object and can be used to optimize the motion profile for efficiency and precision.

3. What are the key components of an S-Curve equation?

The key components of an S-Curve equation include the initial position, final position, maximum velocity, maximum acceleration, and time duration of the motion. These values are used to calculate the acceleration, velocity, and position at any given time during the motion.

4. What are the benefits of using an S-Curve equation for modeling motion profiles?

Using an S-Curve equation allows for precise control over the motion profile, resulting in smoother and more efficient movements. It also helps to minimize jerky movements and reduce wear and tear on the moving parts. Additionally, it can be adjusted and optimized for specific applications and conditions.

5. Are there any limitations to using S-Curve equations for modeling motion profiles?

While S-Curve equations are useful for modeling many types of motion profiles, they may not be suitable for all scenarios. In some cases, the motion may be more accurately modeled using other equations or methods. It is important to carefully consider the specific needs and constraints of a motion profile when choosing an equation to use.

Similar threads

  • Introductory Physics Homework Help
Replies
5
Views
1K
  • Introductory Physics Homework Help
Replies
2
Views
197
  • Introductory Physics Homework Help
Replies
12
Views
211
  • Special and General Relativity
Replies
5
Views
1K
Replies
1
Views
797
  • Differential Equations
Replies
2
Views
1K
  • Introductory Physics Homework Help
Replies
5
Views
1K
Replies
4
Views
2K
Replies
72
Views
5K
Replies
8
Views
2K
Back
Top