# How do I find the minimum time for computing a trajecotry for a robotic arm?

I am studying robotics and I am focusing on trajectory planning.

I have been struggling with this topic for a while, and I still have some doubts that I cannot solve. One of them is the following:

I was solving a problem for training which required this:

A robot joint should perform a rest-to-rest rotation $$\Delta \theta$$ in a total time $$T$$ by using a bang-coast-bang acceleration profile with symmetric acceleration and deceleration phases, each of duration $$Ts = \frac{T}{4}$$. Given a maximum joint velocity $$V_{max} > 0$$ and a maximum bound $$A_{max} > 0$$ for the absolute value of the joint acceleration, find the minimum time $$T_{min}$$ in this class of trajectories such that the motion is feasible.

I think that for let understand my doubts, I have to first say how I thought to tackle the problem, even if it is clearly the wrong way.

My idea for solving this proble was to find the maximum velocity, which is:

$$V_{max}=\frac{T}{4}$$

and from it derive the time $$T$$, which in my opinion was the minimum motion of time because it is referred to the maximum velocity. So, I thought the minumum time velocity to be:

$$T = \frac{4V_{max}}{A}$$

but this is obviusly wrong. Infact, when I went looking for the solution that my professor proposed for this exercise, the correct way was the following:  where there are also numercal values for the quantities, which I did not included in the question.

After seeing the solution, most concept where clarified. For example, I have understood that I should have calculated the minimum motion time for completing the otion(so for completing the total displacement) on the displacement from zero to $$T$$.

But there is still something I don't understand. In the solution, my professor derived a velocity $$V$$ and a displacement $$\Delta \theta _s$$ where this displacement is the displacement from zero to $$\frac{T}{4}$$ and it is equal to the displacement from $$\frac{3T}{4}$$ to $$T$$.

So, with this quantities he has computed the total displacement as :

$$\Delta \theta = 2\Delta \theta _s+V\frac{T}{2}$$

and from it he computed the acceleration and the velocity. Then he substitute in these the limit velocity and acceleration and then computed the minimum time trajectory.

But why he needed to compute both acceleration and velocity form the total displacement?

And what is $$V=\frac{T}{4}$$ that he computed in the beginning? Shoudn't this be the maximum velocity?

I have a lot of doubts on this, sice I do not understand also what are $$A=\frac{16\Delta \theta }{3T^{2}}$$ and $$V=\frac{4\Delta \theta }{3T}$$

And also, why there is the need to compute the time both from the acceleration and form the velocity?

Can somebody please help me understand?

## 1 Answer

Your problem statement is:

using a bang-coast-bang acceleration profile with symmetric acceleration and deceleration phases, each of duration $$T_s=\frac{T}{4}$$.

So, right off, you know the time spent in acceleration is $$T/4$$. The peak velocity is not $$T/4$$.

I'll agree that your professor's notation is hard to read (for me at least), but it looks like they're using functions for the notation.

The "bang-coast-bang" is also called a trapezoidal speed profile and it's super common with my industry's speed-regulated motors.

So, if your speed $$\dot{\theta}$$ is a function of time, and you ramp up to full speed $$V$$ at time $$t=T/4$$, then you can express that data point by showing your speed, as a function of time $$\dot{\theta}\left(t\right)$$:

$$\dot{\theta}\left(\frac{T}{4}\right) = V \\$$

This might be more useful if you replace $$V$$ with $$\dot{\theta}_{max}$$:

$$\dot{\theta}\left(\frac{T}{4}\right) = \dot{\theta}_{max} \\$$

and again, it's just saying that your angular speed $$\dot{\theta}$$ reaches your maximum speed at $$t = \frac{T}{4}$$. Remember that "big T", $$T$$, is the total time elapsed for the move, or the period for this operation.

Now, the other way you can express a speed, generically speaking, is:

$$v = \int\left(a\right)dt \\$$

which, for a constant acceleration, is:

$$v = at \\$$

Speed is acceleration times time. If you are using a constant acceleration, then you could also say that

$$\dot{\theta}\left(t=\frac{T}{4}\right) = A\frac{T}{4} \\$$

So now put those two statements above together and see that:

$$\boxed{\dot{\theta}\left(\frac{T}{4}\right) = V = A\frac{T}{4}} \\$$

This is a slight re-arranging of your professor's statement $$V = \dot{\theta}\left(\frac{T}{4}\right) = A\frac{T}{4} \\$$, but I find the professor's form more confusing because then it looks like $$V$$ is a function of $$\dot{\theta}(t)$$ and not the other way around.

The next line goes on to continue the "classic" constant-acceleration position formula:

$$x(t) = x_0 + v_0 t + \frac{1}{2}at^2 \\$$

or, in your angular case:

$$\theta(t) = \theta_0 + \dot{\theta}_0 t + \frac{1}{2} A t^2 \\$$

And here you can move your $$\theta_0$$ and assume $$\dot{\theta}_0 = 0$$ and so you wind up with:

$$\theta(t) - \theta_0 = \frac{1}{2}A t^2 \\$$

and, since $$\theta(t) - \theta_0 = \Delta \theta(t)$$, you can re-write that as:

$$\Delta \theta(t) = \frac{1}{2}A t^2 \\$$

Now again you're trying to find out how much the angle shifted at the end of the starting acceleration period $$(\Delta \theta_s)$$, and the acceleration period ends at $$t = \frac{T}{4}$$, so:

$$\boxed{ \Delta \theta_s = \Delta\theta\left(t = \frac{T}{4}\right) = \frac{1}{2}A\left(\frac{T}{4}\right)^2} \\$$

And now, finally, your speed profile states you accelerate for $$t = \frac{T}{4}$$, you move at constant speed $$V$$ for $$t = \frac{T}{2}$$, and you decelerate for $$t = \frac{T}{4}$$. Since your acceleration and deceleration rates are the same, the total angle traversed during that transient is the same and so:

$$\Delta \theta\left(t = T\right) = \Delta \theta_s + V\frac{T}{2} + \Delta \theta_s \\$$

Or, as your professor stated it,

$$\boxed{\Delta \theta\left(t = T\right) = 2\Delta \theta_s + V\frac{T}{2}} \\$$

So, what is $$V$$? That's from the first boxed equation here:

$$\dot{\theta}\left(\frac{T}{4}\right) = V = A\frac{T}{4} \\$$

and you can see:

$$V = A\frac{T}{4} \\$$

And, what is $$\Delta \theta_s$$? From the second boxed equation:

$$\Delta \theta_s = \Delta\theta\left(t = \frac{T}{4}\right) = \frac{1}{2}A\left(\frac{T}{4}\right)^2 \\$$

so:

$$\Delta \theta_s = \frac{1}{2}A\left(\frac{T}{4}\right)^2 \\$$

And finally you can plug that all into the third boxed equation:

$$\Delta \theta\left(t = T\right) = 2\Delta \theta_s + V\frac{T}{2} \\$$

And get:

$$\Delta \theta\left(t = T\right) = 2\left(\frac{1}{2}A\left(\frac{T}{4}\right)^2\right) + \left(A\frac{T}{4}\right)\frac{T}{2} \\ \Delta \theta\left(T\right) = \left(A\left(\frac{T}{4}\right)^2\right) + \left(A\frac{T}{4}\right)\frac{T}{2} \\ \Delta \theta\left(T\right) = A\left(\frac{T}{4}\right)\left(\frac{T}{4}\right) + A\left(\frac{T}{4}\right)\left(\frac{T}{2}\right) \\ \Delta \theta\left(T\right) = A\left(\frac{T^2}{16}\right) + A\left(\frac{T^2}{8}\right) \\ \Delta \theta\left(T\right) = A\left(\frac{T^2}{16}\right) + A\left(\frac{2T^2}{16}\right) \\ \boxed{\Delta \theta\left(T\right) = A\left(\frac{3T^2}{16}\right)}\\$$

And, realizing that the total angle change $$\Delta\theta$$ is defined to be $$\Delta\theta(T)$$, you can solve the boxed equation on the line above as:

$$\Delta \theta = A\left(\frac{3T^2}{16}\right)\\ \Delta \theta\frac{16}{3T^2} = A \\ \boxed{A = \frac{16\Delta\theta}{3T^2}} \\$$

You can solve for $$V$$ the same way with your expression $$V = A\frac{T}{4}$$, solving for $$A = V\frac{4}{T}$$, and then substituting into the above boxed formula:

$$A = V\frac{4}{T} = \frac{16\Delta\theta}{3T^2} \\ \boxed{V = \frac{4\Delta\theta}{3T}} \\$$

Hope this helps!