1D trajectory with via points


Let’s consider a more complex case. I want to start at this particular X value. I want to finish at this particular X value. But, in between, I wanted to visit this X value and this X value. I refer to these intermediate points as via points. Sometimes, it’s also referred to as way points. If a robot is going to do this particular motion, we have a problem in that the trajectory is not smooth. At each of the points, the velocity abruptly changes from one value to another.

Here, the velocity is increasing. A moment later, the velocity is decreasing. The way we get around this problem is to introduce what are called blends. So here, we have the motion between these points and in red, it’s shown the blend phase. Now, this is where we introduce a smooth mathematical curve which maintains continuity. So, initially, we accelerate on to the curve and head towards X2. When we get near X2, we start to transition in to the velocity we require on to the next path. So, we transition our velocity over a set period, over what’s called the acceleration interval.

So, our path now consists of segments of linear velocity with parabolic or higher-order polynomial blends to join them together. We can consider the motion in terms of three segments. The first segment gets us from point 1 to point 2, second segment from point 2 to point 3 and so on. Because you probably noticed by now that the robot isn’t actually getting to the via points. It’s getting close to X2 and then it’s going to turn to get on to the path to head towards X3. So, it misses X2 and then actually misses X3 as well. Now, this is just a bit of a trade off. If the acceleration time is very small, then we will go very close to the via points, but the acceleration will be very high. We’re going to have to head towards X2 and then very, very quickly change our velocity in to the velocity we need to head towards X3. If the acceleration time is large, then the acceleration of the robot is much lower, but we’re going to miss the via points by a larger amount. This is a fundamental engineering trade off between accuracy and acceleration.

Let’s create a trajectory with via points. The first point we want to visit has got a value of 10. The last point that I visit has got a value of 30. And, the via points I’m going to set as 40, 10 and the last one. To compute a trajectory with via points, I used the Toolbox function mstraj and it’s got rather a lot of arguments. First argument is the via points. The next argument is the velocity at which we move, and it’s going to be one unit per second.

The third argument I’m going to set to null for the time being. And, I’m going to put in the first location that we want to visit. I’m going to put in the time interval and I’m going to put in the acceleration time. And, here is our trajectory. We’ve gone from 10 up to 40, back down to 10 and up to 30.

Now, let’s look at what happens when we adjust some of the parameters. The first thing I’m going to do is to increase the acceleration time. So, I’m going to increase it from 2 to 4 and we can see that the trajectory has become more rounded. And, we can also see the distance by which the trajectory misses the via points has increased. I can increase the acceleration time even more, put it up to 8 and we can see again that the trajectory is much more rounded because the acceleration is much gentler but, the distance between the trajectory and the via points is increased even further. If I set the acceleration time to 0, we exactly reach the via points but the trajectory will be discontinuous. The acceleration will be infinite at the via points.

Let’s go back to something a little bit more gentle. And now, what I’m going to do is to increase the velocity at which we move along the trajectory. You can see right now that this trajectory takes nearly 90 seconds to execute. So, I’m going to double the speed at which we move along the trajectory, change the velocity from 1 to 2, and now we execute the trajectory in just under 50 seconds. The last thing that I’m going to do is to remove the velocity specification and replace it with a time specification. I’m going to say that I don’t care about velocity, but I do care about the time. And, I want to specify the times of the segments. I want the first segment to last for 10 seconds. I want the second segment to last for 30 seconds. And, I want the last segment to last for 20 seconds. And now, the trajectory looks like this.


There is no code in this lesson.

Frequently we want a trajectory that moves smoothly through a series of points without stopping.

Professor Peter Corke

Professor of Robotic Vision at QUT and Director of the Australian Centre for Robotic Vision (ACRV). Peter is also a Fellow of the IEEE, a senior Fellow of the Higher Education Academy, and on the editorial board of several robotics research journals.

Skill level

This content assumes high school level mathematics and requires an understanding of undergraduate-level mathematics; for example, linear algebra - matrices, vectors, complex numbers, vector calculus and MATLAB programming.

More information...

Rate this lesson


Check your understanding


  1. Prashant says:

    Sir in case of blends
    as you said if blend time is large then we move further from via points.
    is it not possible to create a smooth path which can pass through via point with large blend time?(as curve is smooth it can touch via point at its maxima.)

    1. Peter Corke says:

      There are many types of trajectories possible, I have only covered a common one that mostly follows straight lines between points. You could construct a spline that goes through the via points, but then the path would not be straight. What you use really depends on the particular application and the constraints that it imposes.

      1. Prashant says:

        okay sir

Leave a comment