MASTERCLASS

# Paths and Trajectories

### Lessons

#### Transcript

Finally, we come to the problem of interpolating between two poses. Poses have got a translational and a rotational component. We need to interpolate them separately. We refer to this as Cartesian interpolation. Let’s consider two poses; pose 0 and pose 1, each can be represented by a rotation matrix and a vector. We can convert the rotation matrix of each pose into a unique quaternion and we can interpolate the translation using the linear interpolation formula that we introduced earlier. S is a function of time, varies smoothly from 0 to 1 over the duration of the trajectory. And, we interpolate the rotation using the quaternion interpolation formula that we introduced in the last section. If we want, we can convert the interpolated quaternion back to a rotation matrix, combine it with the interpolated translation and rebuild a homogeneous transformation matrix.

Let’s now interpolate between two poses described in terms of homogeneous transformation matrices. The first pose is a null pose. It just got 0 orientation and a translational component of 0. The second pose has a finite translational component and a finite rotational component and is defined by this homogeneous transformation matrix here. Now, I can create a smooth trajectory between these two poses using the Toolbox function, ctraj which stands for Cartesian trajectory. And, the arguments are the initial pose, the final pose and the number of time steps. The result is a matrix that’s 4 x 4 x 50. Once again, this is a stack of homogeneous transformation matrices. The first element in the stack, look at all the rows and all the columns and the first in the stack looks like this. But, the 10th one in the stack, look at all the rows and all the columns and the 10th in the stack looks like this.

Each homogeneous transformation in this stack represents a pose along a trajectory and pose varies smoothly along this trajectory, smoothly in terms of translation and smoothly in terms of orientation. I can plot this using the tranimate function and we see here that the pose is changing from the initial pose to the final pose smoothly in position and in orientation.

We combine what we’ve learnt about smoothly varying position and orientation to create smoothly varying pose, often called Cartesian interpolation. ### 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.

Average

## Discussion

1. Prashant says:

Sir to understand interpolation of pose did I need to first understand whole quaternion mathematics?

1. Peter Corke says:

For interpolation you need to use spherical linear interpolation for unit quaternions. You can find an article about this here.

1. Prashant says:

thank you sir

2. Shivam Joshi says:

tranimate is very fast in my pc can we contrl its speed

1. Peter Corke says:

There is an ‘fps’ option to set frames per second

3. Anshay says:

Just like tranimate animates the pose in 3D, is there a function that draws trajectories in 3D?

1. Peter Corke says:

MATLAB can plot lines in 3D.