Search code examples
mathlinear-algebraalgebra

Calculate time for triangular and / or trapezoidal motion profile with initial velocity


I want to calculate the time it takes to reach target-pos from initial-pos, taken in account some initial velocities.

  • i: Initial Position: 0.0 m
  • t: Target Position: 10.0 m
  • a: Acc: 0.3 m/s2
  • d: Dec: 0.3 m/s2
  • v: Max Velocity: 0.5 m/s
  • u: Initial Velocities: [0.0 m/s, -0.5 m/s, 5.0 m/s]

First I calculate the distance needed to travel to reach the max velocity.

v_dist = ((v² * (a + d)) / (a * d)) / 2.0 
v_dist = ((0.25 * 0.6) / 0.09) / 2.0 
v_dist = ((0.15) / (0.09)) / 2.0 
v_dist = 0.833333 

If we do not reach the maximum velocity, in other words, if we do not travel the distance we need to travel to reach the maximum velocity, it will always be a Triangular Motion Profile

For a Triangular Motion Profile I use the following formula:

t = sqrt(2.0 * abs(t-i) * ((a+d)/(a*d))) 
Which results in: 
t = sqrt(2.0 * abs(10.0) * ((0.3+0.3)/(0.3*0.3))) 
t = sqrt(20 * (0.6/(0.09))) 
t = sqrt(20 * (6.6667)) 
t = sqrt(133.333) 
t = 11.547 

Unfortunately this formula doen not respect the initial velocity, and I can not figure out where to insert this. I also experience difficulties in wrapping my head around the ((a+d)/(a*d)) part.

How can I adjust the formula so it does take an initial velocity in account, even if the current direction of motion is in the opposite of where the target position is?

For a Trapezoidal Profile I use the following formula:

t = (abs(t-i) - ((a * (v/a)²) /2) + ((d * (v/d)²) /2)) / v + (v/a) + (v/d)

For this formula I have the same problem as for the triangular formula. I do not understand where I put the u (initial velocity) so it is processed correctly.


Solution

  • Look at the picture showing diagram V(t) - velocity vs time for trapezoid profile (ACDE) and triangular one (BFG) (abscissa values are arbitrary here)

    Ordinate of A point is initial velocity, ordinate of C,D is maximum velocity, ordinate of E is some velocity needed to reach the end.

    Abscissa of C and F is moment, when acceleration ends, F and D - when deceleration starts, E and G are stop moments.

    Slope of AB and BC are accelerations. Slopes of DE and FG are decelerations.

    Area under the polyline is distance.

    So for trapezoid profile you can calculate times needed for acceleration and deceleration, then find time at CD range to provide needed distance (sum of 0AC1, 1CD3, 3DE).

    For triangle profile find time of BF and FG segments (they depends) to provided needed distance (as sum of 0BF4 and 4FG)

    enter image description here