LESSON

# Relative positions in 2D

#### Share

#### Transcript

Let's have a look at a slightly more realistic example. Here I have a 2-dimensional car and a 2-dimensional coordinate frame. I've labeled this coordinate frame W and that stands for the world coordinate frame and this is quite a common thing in robotics to have one reference frame that all other reference frames are described with respect to. And to indicate that very, very clearly, I've labeled the x and y axis with the subscript W, so it's very, very clear that this the x-axis of the W frame and the y-axis of the W frame. Now let's indicate some points of interest in this car, the left seat: the right seat, one of the mirrors, door handles, and perhaps where we refuel it. I can describe each of these points by a vector, with respect to the world coordinate frame.

Now let's imagine that a car has moved, now it's over here, I could now describe all these points again in terms of vectors with respect to the origin of the world coordinate frame. But it's a little bit tedious because the points haven't actually moved with respect to the car, the whole car has moved and now I have to redefine all the vectors again. Perhaps, there's a better way. And there it is, we are going to use the coordinate frame idea again and we are going to create a new coordinate frame and I'm going to attach it to the car. I labeled this frame C - C for car. And just to be clear, I labeled the axis XC and YC: X and Y axis are the coordinate frame that are attached to the car. Now it's a simple matter to describe all these points of interest on the car in terms of vectors with respect to the car's coordinate frame. Now if I moved the car, the vectors have changed with respect to the world but they haven't changed with respect to the car's coordinate frame.

Let's simplify things a bit and introduce a pose here. So introduce another one of these fat arrows which represents a pose, and this is the pose from the world coordinate frame to the car's coordinate frame so it's W ksi Z. Now let's look at just a single point, one of the points on the door of the car. I'm going to label that point d and we created vector from frame C to this point d, and we denote that in the way we've already discussed we use a symbol P to denote that we're talking about a vector. C is the reference frame so this is a vector with respect to frame C, so it begins at the origin of frame C and it goes to the point d. Now let's consider that I want to know what is this vector: the point D with respect to the world coordinate frame. In some sort of simplistic way, what I want to do is to add these 2 arrows. I want to move along here, and I want to move along here. But it's not quite that simple, we can't add a pose and a vector. We can't add a fat arrow to a thin arrow. Poses and vectors are different mathematical objects so we need to do this a little bit carefully.

The way we do it is to introduce a new operator, and it's the dot. In this formalism, we have a pose and it operates on a vector in order to transform it to a different coordinate frame. That's what this operator dot does: it transforms this vector which describes the point d with respect to the coordinate frame C, to a vector that describes the point d with respect to the coordinate frame W. It performs a transformation between coordinate frames. All of this is rather abstract. I’ve introduced this operator dot, but I haven't told you actually what it is - how would you code it? And, we introduced this abstract pose thing described by the Greek letter ksi - and I haven't said exactly what that is or how you could code that or implement that. These are things would get to in the following sections in this lecture.

We introduce the idea of attaching a coordinate frame to an object. We can describe points on the object by constant vectors with respect to the object’s coordinate frame, and then relate those to the points described with respect to a world coordinate frame. We introduce a simple algebraic notation to describe this.

Try your hand at some online MATLAB problems. You’ll need to watch all the 2D “Spatial Maths” lessons to complete the problem set.

### Skill level

High school mathematics

This content assumes an understanding of high school-level mathematics, e.g. trigonometry, algebra, calculus, physics (optics) and some knowledge/experience of programming (any language).