Hi All,

This is my first post, so apologies if it is not suitable for this board.

I'm writing a trajectory control algorithm for a simple stepper motor
controller. I want to implement a trapezoidal
velocity profile. Given values for

1) The distance to cover (s) 2) The acceleration of the motor (a) 3) The time to cover the distance (t)

I need to calculate the maximum speed of the motor on the top of the trapezoid (Vmax)

i.e.

Vmax ________________________________

0 t

I thought this would be relatively straightforward,

Splitting the trajectory into 3 phases (accel, const speed, decel) the time for each phase is t1, t2 and t3

Taking the following 4 equations...

t = t1 + t2 + t3 t1 = t3 Vmax = a

I can solve for Vmax. However, the resulting equation is a quadratic, and hence has two solutions.

For ref, the solution, using the quadratic formula is Vmax = 0.5

Having done a few example problems, it seems that that there are always two real number solutions, both of which are greater than zero.

From my examples, the smaller of the two solutions seems to be the correct one. The greater seems to be the solution for the following (nonsense) trajectory...

Vmax ________ \

So, my questions are these...

1) Is this right? It seems that in the process of trying to solve the problem, I'm introducing this extra solution. Is there a way of combining the equations such that I only have a simple linear equation to solve, or is this just a feature of this particular problem.

2) If I have to go down the quadratic route, is it valid to assume that the smaller of the two solutions for Vmax is always the correct one?

Many thanks for all help.

Jim Donaldson

This is my first post, so apologies if it is not suitable for this board.

I'm writing a trajectory control algorithm for a simple stepper motor

1) The distance to cover (s) 2) The acceleration of the motor (a) 3) The time to cover the distance (t)

I need to calculate the maximum speed of the motor on the top of the trapezoid (Vmax)

i.e.

Vmax ________________________________

*/ \ /*\*/ \ /*\ 0 / \0 t

I thought this would be relatively straightforward,

Splitting the trajectory into 3 phases (accel, const speed, decel) the time for each phase is t1, t2 and t3

Taking the following 4 equations...

t = t1 + t2 + t3 t1 = t3 Vmax = a

*** t1 s = (Vmax ***t2) + (0.5 VMax*** t1) + (0.5 ***VMax * t3)I can solve for Vmax. However, the resulting equation is a quadratic, and hence has two solutions.

For ref, the solution, using the quadratic formula is Vmax = 0.5

*** a ***( t - sqrt( t^2 - (4 * s / a)))Having done a few example problems, it seems that that there are always two real number solutions, both of which are greater than zero.

From my examples, the smaller of the two solutions seems to be the correct one. The greater seems to be the solution for the following (nonsense) trajectory...

Vmax ________ \

*/ \ /*\*/ \/**/\ /*\*/ \ 0 /*\So, my questions are these...

1) Is this right? It seems that in the process of trying to solve the problem, I'm introducing this extra solution. Is there a way of combining the equations such that I only have a simple linear equation to solve, or is this just a feature of this particular problem.

2) If I have to go down the quadratic route, is it valid to assume that the smaller of the two solutions for Vmax is always the correct one?

Many thanks for all help.

Jim Donaldson