Calculating V for s with constant jerk

Topper

Addon Developer
Addon Developer
Donator
Joined
Mar 28, 2008
Messages
669
Reaction score
32
Points
43
For a constant acceleration (a=constant) into one direction, the formular for v to s is:
v = sqrt(2*a*s)
if v0 = 0
What's the formular for v for s, if the acceleration increases constantly (j=constant; V0=0; a0=0, s0=0)? (Without t)

v: Speed
a: acceleration
s: distance
 
Last edited:
Try:

[MATH]v = \sqrt[3]{\frac{9 \,\beta \, s^2}{2}}[/MATH]

where [MATH]\beta[/MATH] is the rate of increase of the acceleration.
 
Last edited:
Warning: You are entering the realm of differential equations! Your formula is actually the solution of the time-free kinematic equation:
(Using the term '&int' for the fancy integration symbol)

&int v dv = &int a ds
Integrate both sides to get

v²/2 = a . s + const
With 'a' being constant and all starting conditions set to 0 you get the simplified solution v = sqrt (2 . a . s)

However, if 'a' is not constant, the equation becomes
&int v dv = &int a(s) ds

To solve it, you need to describe 'a' as a function of 's' and properly integrate it :)
This becomes especially tricky as a non-constant 'a' would usually be given as a function of time 't'. So it might be easier to start with v = a(t) dt .
 
Ok thank you all I can confirm Keithth G's solution.
Without this solution I felt to unsure to solve it but now I got it too (hopefully):
I

[math]
\begin{split}
a&=j*t\\
v&=\frac{ds}{dt}\\
a&=\frac{dv}{dt}\\
j&=\frac{da}{dt}=const(j)\\
\end{split}
[/math]

II

[math]
\begin{split}
s&=\int v\,dt\\
v&=\int a\,dt\\
a&=\int j\,dt=j\,t\,\,\, (for\,j=const)\\
\end{split}
[/math]

III

Because:

[math]
\begin{split}
\int t^n\,dt=\frac{1}{n+1}\,t^{n+1}
\end{split}
[/math]

We can say...

[math]
\begin{split}
v&=\int j\,t\,dt=j\int t\,dt\\
&=\frac{j}{2}\,t^2\,\,\, (for\,V_{0}=0)\\
\end{split}
[/math]

so let's insert this in the formular for s of II

IV

[math]
\begin{split}
s&=\frac{j}{2}\int t^2\,dt\\
&=\frac{j}{2} \,\frac{1}{1+2}\,t^{2+1}\\
&=\frac{1}{6}\,j\,t^3
\end{split}
[/math]

Now using

[math]
\begin{split}
v&=\frac{j}{2}\,t^2\,\,\, \\
t&=\sqrt{\frac{2\,v}{j}}
\end{split}
[/math]

so...

[math]
\begin{split}
t^3&=(\sqrt{\frac{2\,v}{j}})^3\\
&=\sqrt{\frac{2^3\,v^3}{j^3}}\\
&=\sqrt{\frac{8\,v^3}{j^3}}\\
\end{split}
[/math]

insert this for t^3 this into last line of IV:

[math]
\begin{split}
s&=\frac{1}{6}\,j\,\sqrt{\frac{8\,v^3}{j^3}}\\
\sqrt{\frac{8\,v^3}{j^3}}&=\frac{6\,s}{j}\,\,\,\,|^2\\
\frac{8\,v^3}{j^3}&=36 \frac{s^2}{j^2}\,\,\,\,|*\frac{j^3}{8}\\
\end{split}
[/math]

now we want to know v^3

[math]
\begin{split}
v^3&=\frac{36\,s^2\,j^3}{8\,j^2}\\
&=\frac{9}{2}s^2\,j \,\,\,\,|\sqrt[3]{} \\
\end{split}
[/math]

...

[math]
\begin{split}
v&=\sqrt[3]{\frac{9}{2}\,s^2\,j} \,\,\,\,|*\frac{4}{4} \\
&=\frac{\sqrt[3]{36}}{2}\,\sqrt[3]{s^2j}\\
&=1,650...\,\sqrt[3]{s^2j}
\end{split}
[/math]

:tiphat::cheers:
 
Last edited:
I have a little problem with this stuff:
I used all the forms but it's not working right.
I want to calculate the rotation speed of a vessel to set a specific setpoint.
In the last few degrees, the acceleration should decrease slowley. In fact, this is used only for the last few degrees. However, I teseted it as shown here for the whole process and it should work as well even if it will take a bit long to reach the setpoint.

The ascceleration should be less and less if the vessel reaching the final orientation, so thats why I needed to calculate v for a constant j (jerk) in the previous post here. What I did now is to calculate j.
Ok, in a rotating world everything is different,

so a is alpha,
v is omega
s is phy and so on...
But however, the formulars should work as well...

So here comes the steps to calculate j:
[math]
\begin{split}
a&=j*t\\
t&=\frac{a}{j}\\
t^3&=\frac{a^3}{j^3}\\
v&=\frac{1}{2}jt^2\\
s&=\frac{1}{6}jt^3\\
\end{split}
[/math]

so we can say...

[math]
\begin{split}
j&=\frac{6s}{t^3}\\
j&=\frac{6sj^3}{a^3}\\
\frac{j^3}{j}&=\frac{a^3}{6s}\\
j^2&=\frac{a^3}{6s}\\
\end{split}
[/math]

[math]
\begin{split}
j&=\sqrt{\frac{a^3}{6s}}\\
\end{split}
[/math]

So let's cast a c++ code from this...

Code:
VECTOR3 autopilot::getYPRSpeedSetpointsByDeltaPhyDebug(VECTOR3 deltaPhy)
{
    VECTOR3 angularSpeedSetPoint = {0,0,0};
    VECTOR3 vMaxAccAcceleration = ORBITERTOOLS::GetMaxAngAcc(v);  //Returns the maximum angular acceleration (Omega)
    
    //"i" stores if deltaPhy is positiv or negativ to set angularSpeedSetPoint positiv or negative in the end
    VECTOR3 i = {0,0,0};    

    double maxYawAcceleration =   vMaxAccAcceleration.y;
    double maxPitchAcceleration = vMaxAccAcceleration.x;
    double maxBankAcceleration =  vMaxAccAcceleration.z;

    i.x = deltaPhy.x < 0 ? -1 : 1;
    i.y = deltaPhy.y < 0 ? -1 : 1;
    i.z = deltaPhy.z < 0 ? -1 : 1;

    VECTOR3 j;
    //See this post
    j.x = sqrt(pow(maxYawAcceleration,3.0)/(6.0*abs(deltaPhy.x)));
    j.y = sqrt(pow(maxPitchAcceleration,3.0)/(6.0*abs(deltaPhy.y)));
    j.z = sqrt(pow(maxBankAcceleration,3.0)/(6.0*abs(deltaPhy.z)));
    
    const double frac_1_3 = 1.0 / 3.0;
    const double frac_9_2 = 4.5;
    //Last formular of my previuos post
    angularSpeedSetPoint.x = pow(frac_9_2*abs(deltaPhy.x)*j.x,frac_1_3);
    angularSpeedSetPoint.y = pow(frac_9_2*abs(deltaPhy.y)*j.y,frac_1_3);
    angularSpeedSetPoint.z = pow(frac_9_2*abs(deltaPhy.z)*j.z,frac_1_3);

    angularSpeedSetPoint.x *= i.x;
    angularSpeedSetPoint.y *= i.y;
    angularSpeedSetPoint.z *= i.z;

    return angularSpeedSetPoint;
}

So the result is that the angular acceleration is higher as closer the rotation angle is to it's setpoint. If somebody can see what I did wrong it would be great...
 
Last edited:
Topper

I can see at least one problem:

In your original (linear) problem - as set out in your original post - the quantities in question were one-dimensional (i.e., 'scalar') quantities. All motion was constrained to a particular direction which, without loss of generality, one could call the 'x-axis'. One could have written the equations in 3D without much problem, here, and all of the equations would have looked much the same - except that one would have had to subscript everything with an 'x', 'y' or 'z' depending on which component of position, velocity, acceleration and so on that one was referring to.

In the rotating world things aren't so simple. If, however, you constrain all (rotational) motion to lie in one plane (i.e., a constant spin axis of your rigid, rotating body) then, in that plane, you can choose all of your quantities - phi, omega, etc. - to be one-dimensional (scalar) quantities. As you point out, one can use the earlier results of this thread to calculate the quantities that you want to use. BUT, at the end of your calculations, you then have to project everything from the plane back into 3D (using the constant spin axis of the system to define that projection operator).

At the moment, your code doesn't carry out the projection operation from a scaler problem back to three dimensions correctly. I'll spend a little time on this if you like - but I don't have time right now to work through the algebra and write it up.

---------- Post added at 03:47 AM ---------- Previous post was at 12:37 AM ----------

As I understand it, you want to rotate a vessel that is pointing in one direction [MATH]d_1[/MATH] to another direction [MATH]d_2[/MATH]. Given a constraints on the maximal rate of change of the angular acceleration, you want to calculate the angular separation of the two angles needed to slow the rotation of the craft so that when it rotates to the final orientation [MATH]d_2[/MATH] it comes to a complete stop.

Let's suppose that [MATH]d_1[/MATH] and [MATH]d_2[/MATH] are unit vectors (i.e., unit length) defined in, say, Orbiter's non-rotating global reference frame. (Any other rectilinear coordinate system will do, so long as it is non-rotating.) We can define a third vector, perpendicular to them both, which we will call [MATH]\Omega=(\omega_1,\omega_2,\omega_3)[/MATH] which is perpendicular to both [MATH]d_1[/MATH] and [MATH]d_2[/MATH] by setting:

[MATH]\xi = d_1\times d_2[/MATH]

and then normalising [MATH]\xi[/MATH] such that:

[MATH]\Omega = \frac{\xi }{\sqrt{\xi .\xi }}[/MATH]

Let's suppose that the angle between [MATH]d_1[/MATH] and [MATH]d_2[/MATH] is [MATH]\phi = \cos ^{-1}\left(d_1.d_2\right)[/MATH]. [MATH]\phi[/MATH] is a scalar quantity and is equivalent to the spatial distance [MATH]s[/MATH] that was referred to at the start of this post. Now, it should be feasible to use your earlier one-dimensional analysis to calculate the angular separation [MATH]\phi[/MATH] at which you need to start reducing the angular velocity of the craft.

To just complete the picture, though, if you have an arbitrary vector in your non-rotating rectilinear co-ordinate system, and if you know that you are rotating it by angle [MATH]\theta[/MATH] about a spin axis [MATH]\Omega[/MATH] as defined above, you can always calculate the position of the new vector by calculating the rotation matrix as follows:

Let:

[MATH]A = \left(
\begin{array}{ccc}
\omega _1^2 & \omega _1 \omega _2 & \omega _1 \omega _3 \\
\omega _1 \omega _2 & \omega _2^2 & \omega _2 \omega _3 \\
\omega _1 \omega _3 & \omega _2 \omega _3 & \omega _3^2 \\
\end{array}
\right)[/MATH]

[MATH]B = \left(
\begin{array}{ccc}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{array}
\right)[/MATH]

[MATH]C=\left(
\begin{array}{ccc}
0 & -\omega _3 & \omega _2 \\
\omega _3 & 0 & -\omega _1 \\
-\omega _2 & \omega _1 & 0 \\
\end{array}
\right)[/MATH].

Then, the rotation matrix that rotates an arbitrary vector about the spin anxious by an angle [MATH]\theta[/MATH] is given by:

[MATH]R(\theta) = (1-\cos (\theta )) \,A+\cos (\theta ) \,B+\sin (\theta ) \,C[/MATH]

so that if you have a starting vector [MATH]v[/MATH] it will transform to a new vector given by [MATH]v' = R(\theta).v[/MATH].

Now, this probably isn't entirely what you want. For example, you may wish to calculate pitch, yaw and roll components. But you will have to be a little more specific about which quantities it is that you are trying to calculate, I think.
 
Last edited:
Back
Top