No, let's start with planning trajectories.
Indeed, it's very interesting for me to do trajectory planning because at the end, when robots smoothly
tracks the trajectory you have imposed to eat, it is very satisfying to watch it.
OK.
Anyway, during trajectory planning, we have to determine two important since the first one is very
obvious for you.
Indeed, it is the paths that robot manipulator has to track.
You all know it, but this is not the end.
There is also one another issue that you have to take into account, and this is how the robot manipulator
will track the trajectory, namely motion lo.
So what?
What will be its speed or acceleration or jerk, which is the derivative of acceleration, how smooth
these variables have to be and so on.
So don't forget these two concepts geometric paths and motion, lo.
Additionally, they have to determine how much smooth trajectory we need.
We will talk about more deeply about this in further minutes.
Generally, while doing trajectory planning, we don't direct the right trajectory as a function of
time, but instead we write it as a function of some parameter, which is indeed directly a function
of time.
We can write it indeed, in this way, as you can see, P, which is workspace trajectory and Q, which
is joint space, trajectory or function of S and sigma parameters respectively, and s and sigma parameters
are a function of time.
Why do we do that?
This is because by changing parameterization, we can change the behavior of trajectory really easily.
Now, as we have said, it is very important to determine degree of smoothness during trajectory planning.
But how can we impose degree of smoothness for the trajectory?
We can do that by using parameters we have seen before.
So by setting trajectory parameters as some and degree polynomial function, we can set the smoothness
of the trajectory by smoothness of the trajectory, the mean smoothness in velocity and smoothness and
acceleration profiles.
So how smooth velocity and acceleration change is there any discontinuities because smooth velocity
or acceleration profiles mean that there is no discontinuities?
OK, here is how this parameter s as in OK, here is how we set parameter as in degree polynomial here
a zero is a zero to a n excuse me r alone coefficients that have to be determined because without them,
we cannot construct the trajectory.
However, we obtain them by utilizing boundary conditions on the trajectory.
So by using boundary conditions, we will obtain system of equations from where we can determine coefficients
at this moment.
You can ask, OK, perfect, but how will we determine the degree of the polynomial?
OK.
Here is the answer.
First of all, degree of polynomial has to be at least number of boundary conditions minus one.
Otherwise, you will not be able to satisfy your boundary conditions.
However, this is minimum limit.
You can then increase the degree of polynomial as much as you want in theory to get a smoother trajectory.
But don't forget, higher degree means higher number of coefficients to be calculated, which makes
trajectory planning difficult during real time operations.
Anyway, let's see now how we will do trajectory planning here.
I wrote parameter with any degree of polynomial.
We can write this in matrix form like that we are m is a non square matrix.
B is vector of boundary conditions and A is vector of unknown coefficients.
We can find a easily by just finding inverse of M.
Let's assume that we are given these minimal boundary conditions, meaning the initial configuration
and velocity and final position and velocity.
These are scalar variables because we will do trajectory planning for one joint.
However, in future lessons, we will see how to do trajectory planning for more than one joint robots.
So we have for boundary conditions in total.
This means the degree of polynomial M has to be at least three.
So let's choose degree of polynomial as three and the right trajectory as in Equation 1.0.
This trajectory is called cubic trajectory because the degree of polynomial is three.
Let's ride this system of equations by just planning boundary conditions in by plugging, excuse me,
boundary conditions into the polynomial.
We can convert them into matrix form as this and determine M Matrix A and B vectors.
From here, we can easily find a by inverting math.
M, this is the unknown coefficient vector of a after we have done inversion, you can easily apply
this procedure in MATLAB.
If you noticed during these calculations, we have taken initial time as zero.
But what happens if initial time is not zero?
It is very easy to handle in this case.
Excuse me, it's very easy to handle this case also.
We just have to subtract it from time variables in order to consider that for initial time time.
OK, now let's go to the lab and investigate more.
OK, now let's see how people construct could be polynomial in.
Excuse me, quick trajectory in MATLAB.
First of all, we will specify.
Sure, our boundary conditions, as you can see, this is nothing but the initial position, initial
and final position, and also the same initial velocity and final.
As you can see, the initial lows at the end final velocity are specified as zero.
And we will execute our trajectory for long term unit.
This is a function for concrete court efficiency.
OK, four cubic polynomial.
And this is this is the function.
So the input is nothing but position velocity and also the time.
Yes.
And I mean, this position can contains initial and final positions.
This initial final velocities and this is for initial and final time.
After that, we can't rewrite it to be Vector B vector, which is nothing but our boundary conditions.
Vector.
OK.
This is our aim and metrics.
We know it.
OK.
And this is our A..
As you can see, we find it by inversion matrix.
OK?
Because a matrix is our vector.
Excuse me, is our unknown vectors?
OK, perfect.
But now, after we have calculated and obtained a which is our unknown coefficients, we can construct
our trajectory and run it.
OK.
So what we are going to do is we specify a time limit, OK for ourselves.
This is my zero point two is in order to see what is in order to see the trajectory before zero and
after the, uh, before the initial time and after the initial time, you will see this is a necessary
detail for plotting.
You can do it even this way.
No problem, but you will see why we have done it in this way.
OK?
Did people, uh, create our vectors for, uh, position, velocity and acceleration?
OK?
Then what we are doing at is during the time, uh, you are our unit, OK?
During our time samples, OK?
Each time and each time sample, we are, uh, calculating, uh, our trajectory.
OK.
Here, and as I have said it, we have subtract zero point from the initial time.
So as our initial time is zero, it will be, um, less than zero.
And also this is, uh, we uh, we started with zero point two and the final time.
OK.
Here we just check it out.
The mean thing?
OK.
I mean, the this part is as part.
We have seen it on the uh, we are in, um, in our slides.
OK.
During talking about quick trajectory, as you can see, if you are calculating, uh, first of all,
Kutty, this is our normal quick, uh, trajectory.
These coefficients, uh, put it here.
OK.
We know these kind of connections because we calculated them here.
OK?
And we calculate the velocity and acceleration in these cases.
If the trajectory is what will happen with the trajectory before the initial time, before the initial
time.
As you can see, a position will be equal the initial positions.
However, velocity and acceleration will be zero because, um, because the robot doesn't, it didn't
start to move yet.
And after the final time, the robot will again stop so bills that inflation will be zero and the position
will be cute final.
Then we are just using support common.
We are plotting the and our trajectory.
So let's do that.
Let's run this section.
And as you can see, this is our orientation.
As you can imagine, if we put zero here, it would be if we didn't subtract 0.2 and he didn't add zero
point to the final time.
The trajectory will still be correct, but you know, these situations will not appear and it will be
a bit difficult.
It would start from here.
So in order to make our plotting a bit beautiful, we have done this.
So we see that before the initial turn, the position was an orientation or position of configuration.
OK was 10.
Then it started to increase up to 30 to the final.
OK?
And you can see the velocity also an acceleration.
As you can see, acceleration is what I exploration is.
This continues, OK, our velocity is continuous.
OK, OK.
This passenger levels for point to point trajectory planning.
Namely, we have one initial point and one final point, and that's all.
But what happens for Malta?
Segment trajectories, for example, what happens if we have middle points to consider?
Also, as in this case, it is very easy to handle this case.
Also, as we know how to the trajectory planning for one segment, we just need to split the trajectory
into multiple segments and do trajectory planning for each segment individually.
Sorry, I have missed one point, but anyway, I think you have to understand what I mean.
So for the first segment, the Q Zero will be initial and Q1 will be final.
Configuration for segment to Q1 will be the initial and the Q2 will be the final configuration and so
on.
Another problem I want to note is that until here we have assumed that we will be given initial final
and middle velocities.
But this is not always true.
Generally, we are given on the initial and final velocities and we have to figure out a middle point
velocities automatically.
Generally, initial and final velocities are zero because the robot starts from steady state and execute
the trajectory and becomes again for the middle points.
We can use the slope of the trajectory to determine the velocities automatically.
Calculating slope is given by this formula, which is nothing but velocity.
People calculate slope for two sequential lines.
If these two lines have different slopes, namely one increases while another decreases or vice versa,
we just said the middle point velocity at zero.
Otherwise, if these two lines are both increasing or decreasing, namely they have the same slope,
then we assign the middle point velocity as average of them.
OK, now let's go to the map and investigate this more.
OK, now let's see how we can do the same thing.
So it can be an calculation for the world segment trajectory for math sigman trajectory.
Here is our boundary conditions, OK?
And these are the time points where these boundary conditions are met.
OK.
And um, so here let me make it in this way.
OK, for now.
OK, this is our velocity.
We will talk about this now.
OK.
This is for automatic calculation of the velocities.
But first, let's see with the given velocities.
OK, boundary conditions or middle point conditions?
OK, then these are just time samples.
And here again, what we are doing is calculating the trajectory for velocity, excuse me, position
velocity and this acceleration and the V for each time segment, as you can see for each segment, excuse
me, in the time segment.
But for each segment, we are calculating coefficients.
OK?
Because at each segment, conditions will be different, so coefficients will be different.
So different in polynomials will be used with different in the same degree of polemic will be used,
but with different coefficients.
OK.
We calculated the coefficients and we are OK writing them in the matrix.
OK, which hold for each segment the configuration, configuration, velocity and acceleration.
Then we have to just combining these.
OK, combining these position velocity and acceleration for each time segment.
OK.
And then we are just plotting them.
OK.
Let's see how we can.
What is the result?
Let's run this.
As you can see, this is the trajectory, OK?
As you can see, this consists of multiple segments.
OK, here.
Here, here, here, here, here, here to here.
OK.
And this is the velocity, as you can see, acceleration again is discontinuous.
OK, let's see how we can calculate the velocity is not with the given ones, but with automatically
calculated once.
OK, automatically calculated once.
Let's, erm, comment this one also.
OK.
As you can see, this is the automatic for automatic calculation, as you can see, this is much more
smoother.
OK?
The velocity profile hardware acceleration profile is again what this continues.
OK.
Let's see how we can do that so that each time segment again we are calculating VK and VeeKay plus one
for, as we have said, we are calculating just
we are calculating the slope of the lines at each time sample and that at each condition middle condition.
OK.
Subsequent middle conditions possibly could be K plus one, and we just checked there.
So if you are not equal?
OK.
We put the velocity for that instant as zero.
If they are there are equal, then we are just finding their middle, OK?
They are not middle, but they're average.
And then again, we are doing the same thing and we're just plotting them.