# Homework Help: Dependence between jerk and acceleration

1. Jul 13, 2010

### DidiCvet

Hello...

I am using velocity, acceleration and jerk constraints to minimize feedrate speed of robot arm movement. I want to know if there is a way to compute maximum jerk if I have maximum velocity and acceleration. Any references would be helpful.

Thanks
Didi

2. Jul 13, 2010

### Gear.0

TBH I've never really done anything requiring the use of jerk.
However, just from the definitions if you want to find the maximum jerk all you need to do is take the derivative of the Jerk and then set that to zero (and decide if it's maximum or minimum). That would be the most direct, and precise way.

The maximum acceleration and velocity wouldn't help you, because acceleration is zero where velocity is maximum.
Similarly, Jerk is zero where acceleration is maximum. You can't really get the maximum jerk from that.

But, based on your question I can see that perhaps you don't actually have the jerk in the form of an equation that you could take the derivative of. Is that so?

If it is, then another option would be to find where you have a maximum increase in acceleration, or just the sharpest slope in acceleration.
However, if again you can't find this quantity for some reason, then your best bet might be where acceleration is equal to zero.
In most cases you have the largest increase right where the lower graph changes sign.
For example with a pendulum you have the maximum acceleration when it is as high as it will go, right before it changes direction (which is where velocity is zero).
Also, you have maximum velocity right at the bottom (where position is zero).

But that last technique is more of a gamble, however if the motion you are trying to describe is reasonably harmonic, then it might work.

So a recap.. you have 3 options:
1) best method, take derivative of jerk set to zero and locate the maximum
2) find the steepest slopes of your acceleration graph and locate the maximum
3) (this should be the last resort) hope that jerk is maximum where acceleration is zero. (works best for harmonic motion).

There could be more options too, as I said I haven't worked with jerk much.. but that's the best I can think of.

Perhaps if you gave us more of a clue as to what this is actually for we could provide you with better methods of finding the maximum jerk.

3. Jul 14, 2010

### DidiCvet

Thank's for the reply,

I will try with second of the options that you describe me. True I don't have function (equation) of a jerk actually all I have are points of positions and time vector, from which I compute velocity and acceleration as change of position in time, and change of velocity in time. Now the robot arm that I'm working at is limited by maximum velocity and acceleration. I need to find the minimum time for the arm to move from position 0 to position n (n=100). I use optimization for this but in my algorithm for finding minimal time jerk is also needed so I need max jerk to reach maximum speed in minimum time with maximum acceleration allowed. I hope that this clearly describes my problem.

Thanks
Didi

4. Jul 14, 2010

### Gear.0

Actually you would just need maximum acceleration to have minimum time.

So, I'm guessing that because you are trying to find the maximum jerk that you cannot just.. switch to maximum acceleration instantly.. am I right?

Also, keep in mind while you are looking for maximum jerk that once the acceleration reaches maximum the jerk will become zero.

If I am understanding the situation correctly, then I would recommend you just forget about jerk.
Tell me if I am understanding.
You want to move a robot arm from 0 to 100 in the shortest possible time, and have it stop at position 100. You can directly control the acceleration of the robot arm (i.e. the force applied)? However, either the acceleration takes a while to build up to maximum acceleration and you cannot do it instantly, or you just need a very precise estimate of the time.

If all that is correct, then what I would do is make many measurements of moving the arm from zero velocity to maximum velocity. If the robot arm is fairly well designed and it is about the same amount of time to reach maximum velocity every time you do it... Then I think you should just use average acceleration.
Just divide the maximum velocity by the time it takes to reach max velocity and that is your average acceleration.

Now that you have average acceleration you can ignore jerk and just pretend that the acceleration reaches this average instantaneously (note this is not what physically happens, but it is a tool to simplify calculations). It is much easier to work with because it is constant.
Then you can just calculate the time it takes to reach max velocity (which should agree with experiment) and this should also be the time it takes to slow down to a stop (might want to experimentally verify this as well). That gives your starting and stopping time. You would then need to calculate how far the arm travels during startup (reaching max velocity) and slow down (going from max to zero).
If the sum of those distances is greater than the distance from point 0 to 100, then you have a problem.
(if this turns out to be the case, you can still solve this. I'd be happy to assist you further if you come to this point).

However, if it is less then that distance then all is good, because the rest of the distance will be traveled in between start and stop, and will be at maximum velocity.

|EDIT| and of course if you don't need the arm to stop, then just remove the slow down time from the calculations and treat the arm as going at maximum velocity all the way through (after startup).

Last edited: Jul 14, 2010
5. Aug 14, 2010

### Grumple

Hi Gear.0,

You just hit the nail on the head in terms of a problem I am trying to solve. I am working on an algorithm to produce an s-curve acceleration profile to jerk from 0 acceleration/velocity to peak acceleration/velocity, then back down to 0 acceleration/velocity traveling a known distance.

For now I am assuming constant jerk, although I am trying not to use the average acceleration simplification approach, as I may ultimately need to factor in loss of torque over increasing acceleration.

I think I have settled all the input cases except the case where I am constrained by distance itself instead of velocity or acceleration (i.e. the situation where I have traveled more than half my overall distance by the time i have jerked from 0 to max acceleration, then back down to 0).

I'm completely stuck trying to calculate a peak acceleration value to jerk to (using constant known jerk), that will result in half the total desired distance traveled at the point of reaching peak velocity and 0 acceleration.

Thanks very much for any help you can provide!

6. Aug 14, 2010

### Gear.0

It's been a while since the OP has replied so I don't think he will mind if we continue this alternate discussion here.

I think I understood you correctly. It's simply a matter of finding all the integrals.
So you have a constant jerk (let's say jerk has the value 'A', this gives the equation:
$$j = A$$
Then the acceleration is the integral of this with respect to time, and velocity is the integral of acceleration with respect to time, and distance is the integral of velocity with respect to time. Those equations are respectively,
$$a = A t + a_{0}$$
$$v = \frac{1}{2} A t^{2} + a_{0} t + v_{0}$$
$$x = \frac{1}{6} A t^{3} + \frac{1}{2} a_{0} t^{2} + v_{0} t + x_{0}$$

assuming that your initial acceleration, initial velocity, and initial position are all zero, then the final equation is simply:
$$x = \frac{1}{6} A t^{3}$$

Now, I'm also assuming that you allow your model to apply the same jerk of opposite magnitude during the slowdown process, in which case you want to have maximum constant positive jerk for the first half of the trip, and maximum constant negative jerk for the second half.
If this is correct, then you only need to do this calculation for the first half because it should take the same amount of time for the second half.

Now just take that last equation and plug in x=(1/2)distance. You should know what 'A' is, it's your constant jerk value, so the only unknown is 't'.
This is the time it should take to reach half way.
Then if you want to know what the maximum acceleration is at that point, just plug that value for 't' into the second equation:
$$a = A t + a_{0}$$
again, you probably want $a_{0}$ to be zero, and that will give you the highest value possible for your acceleration. If your acceleration were to go any higher than this under the distance constraint then you would not be able to stop in time.
So basically in a single formula your max acceleration would be:
$$a = A^{2/3} (3 d)^{1/3}$$

Also, for your algorithm, this might be the most efficient way to check what action to take. If you do exactly this calculation and you find that 'a' is greater than your maximum allowed acceleration, then you do not have a distance constraint and this method won't work, it is either an acceleration or velocity constraint and you would solve it a different way which you said you have already figured out. However if 'a' is less than or equal to the maximum allowed acceleration then you have a distance constrain and this calculation will provide you with the correct values.
Just keep in mind that all the equations are for half of the trip. So the max acceleration on the slowdown part would be -a, and the total time would 2*t, and you must make sure that that when finding time x=(1/2)d.

However in that final equation I wrote, 'd' is the full distance, not half the distance.

Last edited: Aug 15, 2010
7. Aug 16, 2010

### Grumple

Hi Gear.0,

Thanks a lot for the quick response! It seems that I'm generally on the right track based on your suggestions. I'm confused by how you used the simplified distance equation for half the distance though, and was wondering if you could clarify a few things:

I'm probably missing something obvious, but wouldn't a typical S-Curve motion include more than the two phases of jerk during a motion from rest-to-rest? In the distance constrained case I was picturing:
• First half of distance (and time):
• constant positive jerk from 0 acceleration, 0 velocity to peak acceleration (half peak velocity)
• constant negative jerk from peak acceleration to 0 acceleration (peak velocity)
• Second half of distance (and time):
• constant negative jerk from 0 acceleration to peak negative acceleration
• constant positive jerk from peak negative acceleration to 0 acceleration, 0 velocity

I came to the same point as you described in trying to generate time from a known half distance. However, because there are two distinct phases of jerk during one half of the total motion distance I came up against a wall. The distance traveled during the first half of the positive acceleration phase will be different than the second half, and I cant figure out how to relate them proportionally to the known half-of-total distance.

I assume I can get there somehow through the fact that the time is still equal between quarters, but I've been pulling my hair out trying to figure out how...What am I missing? =)

Cheers!

P.S - I just posted on this thread because it seemed on-topic, but I could move this to a new one if needed...

8. Aug 16, 2010

### Gear.0

I apologize, I made a horrible mistake. Everything I did applied to half the distance. So when I was talking about half the distance it was really a fourth lol, sorry about that.

However, the final equation still describes the maximum acceleration needed except that 'd' is now 1/2 the distance.

So to correct what I was saying you would plug 1/4 of the total distance into the distance equation, find the time. Then plug that time (which is also 1/4 of the total time) into the acceleration equation and you get that the maximum acceleration is:
$$a = A^{2/3}\left( \frac{3}{2}d \right)^{1/3}$$
and 'd' is once again the full distance.

I know I didn't clarify anything, I just corrected my mistake, but maybe that will clear everything up enough.
Please let me know if there is anything I can be more descriptive about, or perhaps any other errors I may have made, but I'm confident this is right now.

9. Aug 17, 2010

### Grumple

That clarified a lot, thanks! I wondered if you were just referring to half the motion, but I'm still shaky enough in some of this stuff that I didn't want to jump to assumptions.

I'm still confused regarding my key question though...sorry if I'm dragging this out but I really appreciate you taking the time to help.

The key thing I am missing is how you get away with assumming 1/4 of the distance happens in 1/4 of time. I can see how half of the total distance would be half of the total time because of symmetrical positive and negative acceleration phases for the overall distance. The problem I am stuck on is that the object should travel a greater distance during the second 1/4 of time than the first 1/4 (benifiting from velocity buildup of the first 1/4). If that is the case, it seems that I can't assume 1/4 of the total distance will be my point of peak acceleration. Howevever, I can't figure out how to calculate at what time/distance my peak acceleration will actually occur.

I know I'm probably missing something obvious here (some generalization rule?), but if you could explain this away I'd be all set!

10. Aug 17, 2010

### Gear.0

You are right again, man I can't believe I'm making all these stupid mistakes. I'm still just an undergraduate so maybe I shouldn't be helping you lol. But, if you'll permit me to give it another shot I'd like to write everything out in detail, hopefully that will force me to think more about it and prevent any future errors. I think I was looking for a shortcut to avoid doing it this way. I'm still wondering if there is an easier way to do it.

Please tell me if this is correct for what you need. You will start with zero velocity and acceleration, then apply a positive jerk "+A" to try and build up as much speed as you can then you have to reverse the jerk to "-A" which will bring the acceleration to zero, by this point you have traveled 1/2 the total distance and velocity is a maximum. Then in the third part you will continue with the "-A" jerk to get the acceleration as negative as possible in order to slow the object down, and in the fourth part the jerk will once again change to "+A" in order to bring the acceleration back to zero at the same time as velocity reaches zero and the position stops on the final point.

I really hope that is all correct now. As I said in my very first post to the OP This is my first time doing anything at all with "jerk" so it's a new concept for me.
If I've still made an error somewhere then I guess I'd better just quit before I cause any more damage. But this is my best attempt at the solution after actually sitting down for a while and thinking about the problem.
Here goes:

We again write the equations of motion, this time with the proper definition of the jerk as a bitwise function. Let's say that "T" is equal to a fourth of the total time.
$$jerk = \left\{ \begin{matrix} A & t < T, T > 3T \\ -A & T < t < 3 T \\ 0 & T < 0, T > 4T \end{matrix}$$
$$a = A t + a_{0}$$
$$v = \frac{1}{2} A t^{2} + a_{0} t + v_{0}$$
$$x = \frac{1}{6} A t^{3} + \frac{1}{2} a_{0} t^{2} + v_{0} t + x_{0}$$

Now the one thing that we can divide into fourths is time. So we know that we need to change to negative jerk once time is at (1/4) of the total time which is "T", then at t = T = (1/4)"total time", we have the following values:
$$a(T) = A T$$
$$v(T) = \frac{1}{2} A T^{2}$$
$$x(T) = \frac{1}{6} A T^{3}$$

Because you have a distance constraint then the only thing that will tell us what any of our unknowns are is (1/2)distance, so we have to go out to (1/2)total time, which is also 2*T.
For the next section the jerk becomes "-A" and the above values are now our initial values. Note, it's not as simple as plugging 2*T into the equations because remember the equation for jerk is bitwise. This next part is kind of weird because it's like we are starting again at T=0, so we actually plug in t=T instead of t=2T even though we are really at t=2T, this is all just a side effect of the bitwise function. Then you just plug in the a0 v0 and x0 values that we got above:
$$a(2 T) = -A T + AT = 0$$
$$v(2 T) = -\frac{1}{2} A T^{2} + A T^{2} + \frac{1}{2} A T^{2} = A T^{2}$$
$$x(2 T) = -\frac{1}{6} A T^{3} + \frac{1}{2} A T^{3} + \frac{1}{2} A T^{3} + \frac{1}{6} A T^{3} = A T^{3}$$

So it does appear that you are correct, for the first portion of the movement the object travels 1/12 of it's total distance instead of 1/4 as I was using, and in the second part it travels 5/12, then another 5/12, and finally the remaining 1/12 when it comes to a stop.

Now you can just plug in that x(2T) = (1/2)distance. Remember I was using T is a fourth of the time so 2T is half of the time, and at that point the object has traveled half of the total distance:
$$x(2 T) = \frac{1}{2} d = A T^{3}$$
$$T = \left( \frac{d}{2 A} \right)^{1/3}$$

and of course the total time is 4 times that value. So, now you can find your maximum acceleration magnitude with:
$$a(T) = AT = A \left( \frac{d}{2 A} \right)^{1/3}$$
$$= A^{2/3} \left( \frac{1}{2} d \right)^{1/3}$$

Then:
a(2T) = 0
a(3T) = -a(T)
a(4T) = 0

So the last value I gave you for the maximum acceleration was off by a factor of 1 over cube root of 3... Assuming this new value is now correct
lol. Hopefully it is.

Last edited: Aug 17, 2010
11. Aug 18, 2010

### Grumple

Wow, you described my problem exactly this time around and that looks to be exactly what I was missing, thanks!!! I will test this solution as soon as possible and post back to verify everything worked as it should.

It's funny, I came up with the same constant ratio of distance in the first quarter vs second quarter yesterday while experimenting, but could not explain it through algebra (it's embarrassing how many of the basic rules I've forgotten or don't think to use when looking at a problem now) so I didn't trust my results.

What I did was plug two made up values for jerk and time into the simplified distance formula for the first quarter. I used an arbitrary jerk of 1.0, and for time I used 0.25 (i.e. 1/4 of total time).
$$x(T) = \frac{1}{6} A T^{3}$$

This gave me a generally meaningless distance value. I also used my arbitrary jerk/time values to calculate equally meaningless end velocity and end acceleration values at 0.25 time.

I then used the end conditions above as my start conditions for the 2nd 1/4 of time to generate another meaningless distance using:
$$x = \frac{1}{6} A t^{3} + \frac{1}{2} a_{0} t^{2} + v_{0} t$$

I did this a few times with different starting jerk values and realized my second distance was always 5 times my first distance. That gave me a seemingly reliable way to break up my known half of total distance values to generate time as you described at the bottom of your solution.

Having said all that...it was useless without being able to understand why it worked, and your solution here explained it perfectly. Thanks again for helping me out with this!

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook