Describing Rigid Body Motion in Space

2000px-rigid_body_attached_frame-svg
What we’ll discuss in this post: A rigid body get’s it’s own reference frame b, relative to another reference frame a

In this blog post, we’ll be learning some math tools that will allow us to easily describe how rigid bodies (e.g. solid objects or arbitrary shape) move in Cartesian space.

This will be very important to our future task of programming a robotic arm, because in order to understand how the end-effector of our robot will move, we’ll need to understand how moving the joints of our robot arm causes the links (which are rigid bodies) to move in space.

If you are still a little rusty on your linear algebra, check out this quick refresher post I wrote that should get you back on your feet and ready to digest the rest of this post.

The problem is actually a little harder than this, because the joints and links of our arm are connected in a chain. To describe the motion of any link in the chain, we also need to incorporate the fact that there may be several joints and links before it in the chain. So describing the motion of a link further along the chain also requires us to factor in several prior joints and links. This is the topic for our next post, where we talk about forward kinematics for robotic arms.

Frames of Reference

If you remember back to our Cartesian coordinate system, we had a few basic objects that needed to be in place before we could assign coordinates to different points in space. We needed the origin, and the axis’. With these two things, we could then define any point in space using just three numbers: The x-coordinate, the y-coordinate, and the z-coordinate.

1000px-coord_planes_color-svg
Our cartesian coordinate system

But where exactly is the origin? And how do we know which way the axis’ should point? Is there a marker somewhere on the earth that says: “This is the origin, and here are the axis’.

1_small

Of course not! There is no “absolute origin”, just like there is no “center” of the universe. We can place our coordinate system anywhere that we want, and start measuring coordinates from there. We could assign the origin to the top of the Eiffel tower, or in the pilot’s seat of an airplane that is traveling near the speed of sound, or on the wheel of a moving bus. This assignment of a coordinate system to a particular place and orientation is called a frame of reference.

For instance, when you walk around your house and observe things, you see everything from your frame of reference, the origin of which is pinned to the front of your face, with the x-axis looking outward and the z-axis pointing up.

In this way, all frames of reference are relative, meaning that the only way to describe the position and orientation of one frame of reference is by comparing it to another.

And we can define many frames of reference, not just one. And this is the key to describing how rigid bodies move. We describe the location and orientation of each rigid body by assigning it it’s own frame of reference.

frame_of_reference
Our two dolls, each a rigid body, is assigned a reference frame: The blue doll is assigned the O1 frame, and the brown doll the O2 frame

Each rigid body is pinned to the origin of it’s respective frame of reference, and is static in its own frame.

By assigning a frame of reference for each rigid body in this way, we can accurately describe how objects move in space, and more importantly, their positions and orientations relative to each other.

22oly6

Don’t worry, we’re going to walk through a few examples to show you how we’ll do this.

Translation: A Simple Rigid Body Motion

Imagine two frames of reference, O and O’ (pronouned “O prime”). Let O represent the initial position of the rigid body, and O’ will represent the position of the rigid body after the translation.

2000px-Frames_of_reference_in_relative_motion.svg
Here is a diagram of a pure translation of reference frame O’ along the x-axis

Translating a rigid body is the simplest kind of motion. All that it requires is a displacement vector, which describes the location of frame O’ relative to the initial frame, frame O’.

\vec{t} = \begin{bmatrix}3 \\ 5 \\ -1 \end{bmatrix}

We usually represent a translation vector with subscripts to tell us what reference frames we are translating from and to.

\vec{t}_{OO'} = \begin{bmatrix}3 \\ 5 \\ -1 \end{bmatrix}

To describe any point in frame A in the translated frame B, we would just add the translation vector to it:

\vec{x}_{O} +\vec{t}_{OO'} = \vec{x}_{O'}

So for instance, let’s define our rigid body object to be a cube, with 6 points (one point for each corner) in reference frame O. We can see what our cube would look like in the translated frame O’ by adding the translation vector, \vec{t}_{OO'} to all six points.

Rotation

Rotating a rigid body is the other kind of motion that a body can undergo. Assuming we have an object that undergoes a pure rotation (no translation), we can again define two reference frames: O is the initial reference frame of the object, O’ is after the rotation.

2000px-rotation_cartesian_coordinates_about_z_axis-svg
In this figure, we are rotating around the z-axis

In the diagram above, the black lines represent the initial reference frame O, and the green lines represent the rotated reference frame O’.

We can define a 3 X 3 rotation matrix, R_{OO'} to show how any point in reference frame O would look like if we rotated it into reference frame O’:

R_{OO'} \vec{x}_O = \vec{x}_{O'}

So for instance, if we define our rigid body object to be a cube, with 6 points in reference frame O, we can multiply those points by R_{OO'} to see what the cube would look like in the rotated reference frame O’.

Generalizing Motion: Rotation and Translation

In the real world, we rarely move by pure translation or pure rotation. Usually we move by both rotating and translating, like when we drive our car and turn left or right.

In the next blog post, we’ll be discussing a technique that we can use to describe this kind of complex motion very simply, and along the way we’ll explain how this relates to our robot arm.

Advertisement

Introduction to Cartesian Coordinates, Vectors and Transformation Matrices

2000px-coord_system_ca_0-svg

Welcome to Cartesian coordinate space! We’ll be spending a lot of time here, and because it’s so important to building, developing and programming robotic arms, we’ll need to get comfortable working with it to describe how things exist and move (specifically, chains of rigid bodies) within it.

First, a Disclaimer

There is nothing special about Cartesian space. It’s just a mathematical model to help us describe real space (i.e. the space that you are living in right now) in a more specific and workable way. There are lots of other kinds of mathematical spaces that are used to describe real-space, but Cartesian space is the easiest for our purposes here. It’s just a tool!

The Origin and the Axis’

In a Cartesian coordinate system, there two very important things to understand: The origin and the axis’.

The axis’ (pronounced “axe-ees”) are the three lines labeled X, Y and Z that you see in the image above. The z-axis is the line that runs up-down. The y-axis runs east-west, and the x-axis runs north-south.

The origin is the place in the image labeled O where these three axis’ intersect, which is right in the middle of the space.

Given these things, we can identify any point in space by just 3 numbers:

  • How far up or down it is from the origin. This is called the z-coordinate
  • How far east or west it is from the origin. This is called the y-coordinate
  • How far north or south it is from the origin. This is called the x-coordinate

Vectors: How to Describe Points in Space

To make things nice and compact, we’ve developed a handy notation for describing these three coordinates in a Cartesian coordinate system, called vectors. A vector is just a one-dimensional array of these three coordinates, and looks like this:

\begin{bmatrix} 5 \\ 7 \\ 9 \end{bmatrix}

The top number represents the x-coordinate, the second the y-coordinate, and the bottom number is the z-coordinate. In the case of the vector above, this point is 5 units past the origin on the x-axis, 7 units past the origin along the y-axis, and 9 units past the origin on the z-axis.

We call the position of a number in a vector the index to help identify which number in a vector we are talking about. The number at index 1 is the first number, the number at index 2 is the second number, and so on.

You can visualize the location of this (or any) point by using this simple technique:

  • Imagine you are standing at the origin.
  • Walk 5 units up the x-axis, then stop.
  • Now walk 7 units up the y-axis, then stop again.
  • Finally walk 9 units up the z-axis. You’re now at the point that the vector describes!

Again, a vector like this represents a point in our Cartesian space, and is usually visualized as an arrow or line:

2000px-3d_vector-svg

In the image above, the a arrow represents a vector, where the ax line represents the x-coordinate for the vector (and similarly for ay and az).

Vectors are usually denoted by lowercase, bold letters like a or lowercase letters with an arrow on top \vec{a}.

Translation: Moving points from A to B

Let’s say that you have a vector a which describes a point in our Cartesian space, and you’d like move it a little bit up to describe a point that is 5 units higher on the z-axis. Changing a vector to describe a new point that is a fixed distance away in a particular direction is called translation.

It’s very easy to translate a vector, because it just requires us to add two vectors:

\begin{bmatrix} 5 \\ 7 \\ 9 \end{bmatrix} +\begin{bmatrix} 0 \\ 0 \\ 5 \end{bmatrix} =\begin{bmatrix} 5 \\ 7 \\ 14 \end{bmatrix}

Adding two vectors is done horizontally: Add all the top numbers together to produce the resultant top number, add all the middle numbers to produce the resultant output number, etc.

Intuitively, you can imagine that you are standing at the point described by the first vector, and now the second vector begins at this point. If you follow that vector to it’s end, you’ll arrive at the sum. The image below illustrates this in the plane:

vector_addition

Similarly, you could move the same vector to describe a point that is 5 units lower on the z-axis by instead subtracting this displacement vector.

Matrices: How to Transform Vectors

So far, we’ve described the coordinate system, how we can represent points in space, and how we can add and subtract vectors to effectively translate them. But what if we want to do something more interesting with a point, like rotate it around the z-axis?

This is where matrices come in handy. In a Cartesian coordinate system, a matrix usually represents a transformation on a vector like:

  • Rotating the vector around an axis
  • Scaling it to be bigger or smaller
  • Mirroring it across a plane

A matrix is just a two-dimensional array, and looks like this:

 A = \begin{bmatrix} \frac{5}{6} & \frac{1}{6} & 0 \\[0.3em] \frac{5}{6} & 0 & \frac{1}{6} \\[0.3em] 0 & \frac{5}{6} & \frac{1}{6} \end{bmatrix}

Usually capital letters are used to denote that a variable is a matrix

There is a special matrix called the Identity Matrix (Often denoted as I) that does absolutely nothing but spit out the original vector when applied to a vector. It is just a matrix that has all ones going down the center of the matrix diagonally, and zeroes elsewhere:

 I = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}

Using a Matrix to Transform a Vector

To transform a vector, we multiply the vector by the matrix to produce the transformed vector:

\begin{bmatrix} 1 & 1 & 3 \\ 4 & 1 & 2 \\ 6 & 1 & 1 \end{bmatrix} \cdot \begin{bmatrix} 2 \\ 3 \\ 2 \end{bmatrix} = \begin{bmatrix} 11 \\ 15 \\ 17 \end{bmatrix}

The dot in the equation above represents matrix multiplication. Matrix multiplication can be tricky at first, but with a little practice it becomes second nature. I won’t go into the details here, but this video by Khan Academy does a much better job of explaining it than I ever could. Watch it a few times and try it out yourself to really get the hang of it.

Matrix Inverses: The “Reverse” Transformation

Sometimes, we have a matrix that represents a certain transformation of a vector, but we would like to know what matrix we would need to “undo” that transformation. The answer, luckily, is simple: The inverse of the transformation matrix.

The inverse of a matrix is another matrix that, when multiplied by the original matrix, produces the identity matrix:

A \cdot A^{-1} = I

In this equation, A-1 represents the inverse of the matrix A. So for example, if A represented a rotation of 45 degrees around the z-axis, A-1 would represent a rotation of -45 degrees around the z-axis.

Applying Multiple Transformations to a Vector

Oftentimes, we want to apply several transformations to a vector in a particular order. Suppose we want to apply the transformation matrix A to a vector first, then apply the transformation matrix B to the result of this, and furthermore apply C to that result.

To do this, we multiply the vector by the three matrices:

C \cdot B \cdot A \cdot \vec{x} = \vec{y}

Usually we omit the dot in-between the matrices and vectors, and the dot is then implied:

C B A \vec{x} = \vec{y}

As you can see, to ensure that we multiply in the correct order, by arrange the matrices from right-to-left. So for the above equation, we would first multiply x by A, then multiple the result of that by B, and the result of that by C. In this way we have applied the A, B and C transformation matrices in the correct order.

Next steps

And that it’s! You now know enough to be officially dangerous. There is certainly much more to be learned regarding vector spaces like this one, but for the purposes of learning about things like rigid body motion in space, this is enough for now.

Now that you’ve completed this lesson, be sure to check out our store for lots of cool robotic applications for your new knowledge!

A Gentle Introduction to Robotic Arms

If you are reading this post, you’ve taken the first step on a very rewarding journey towards being a roboticist! Whether you’re interested in actually automating something, or just interested in playing around, this blog will take you from your first baby steps in understanding of what robotic arms are and how they work, to some more advanced concepts in the field like motion planning, grasping, and visual servoing.

After reading this, if you are interested in building/buying a robot arm to tinker with yourself, you should check-out our robotic arm store.

While we won’t get into the nitty-gritty in this post, at some point you’ll need to have some basic maths to follow along. At least a basic knowledge of linear algebra, trigonometry and basic calculus will be needed. If you feel like you might need a little refresher on these topics, Khan Academy is a fantastic (and free) resource for learning everything you need to know to become a world-class roboticist.

What is a robotic arm?

A robotic arm is a kind of open kinematic-chain, which is really just a collection of links and joints.

three-link-annotated

Usually at the end of this chain is a tool of some kind, like a gripper or a welder or a drill. This is called the end-effector.

One great example of links and joints is your own human arm. The links in your arm are the bones, and the joints are the connections between the bones: Your elbow, your shoulder, your wrist., etc.

A link can be any shape and size, so long as it is one solid, rigid object. Joints generally come in one of two varieties:

Revolute joints are the joints that you are most familiar with. They are equivalent to a hinge: They rotate just one way. A door hinge or a wheel is a great example of a revolute joint. Revolute joints have an axis that describes which way they rotate:

2000px-revolute_joint-svg

Your elbow is another good example of a revolute joint.

Prismatic or linear joints are less common, but are useful when linear and not rotational motion is desired. Linear joints slide along a line, like a drawer slide or a telescope.

200px-prismatic_joint-svg

By serially combining links with joints that are oriented along different axis’, you can produce all kinds of different kinds of robotic arms, each more suited to some tasks than others.

And that’s it – In theory, robotic arms are very simple. But put several simple things together and things get complicated very quickly…

Some common robotic arms

Just to give you and intuitive sense of what we’re talking about here, lets look at a few common designs of robotic arms that you’ll see in a lot of places:

Articulated Robot

kuka_robot_for_flat_glas_handling

An articulated robotic arm is the kind of robot arm that you’re probably most familiar with. These arms can have anywhere from 3 to 7 joints. All of the joints are revolute, and they are the most dexterous kind of robotic arm. These arms are usually used in applications like spot-welding or painting, where the end-effector must be in very specific positions and orientations.

SCARA Robot

kuka_industrial_robot_kr10_scara

A SCARA arm is a special arm that excels at working in a plane. It’s great for pick-and-place tasks (like picking things up off of a conveyor belt). SCARA arms are relatively fast, and are precise enough to do detailed electronics or medical testing work. All revolute and linear joints on a SCARA robot point in the Z-direction.

Gantry Arm (Tower Crane)

Tower Gantry Bridge Construction Crane Shipyard

A gantry arm is a simple arm where all of the joints but the base are linear. One linear joint moves the load up and down, another linear joint moves it outwards and inwards. A revolute joint at the base turns the arm. These arms are used for heavy lifting, like the tower crane that you see here.

Delta Robot

rostock-delta-robot-3d-printer-1

A delta robot is actually a closed kinematic chain, and so is not technically a robotic arm. However it is popular enough that I thought it warranted a mention here. Delta robots control the position and orientation of their end-effector by moving three attached links. By connecting the end effector to three links instead of one, delta robots can move very fast, with minimal error.

Sneak Peek at Rigid Body Motion and Kinematics

Now that you understand what a robot arm is, I can tell you now that most of the work of building and programming a robotic arm successfully is understanding how the arm end-effector moves, when the joints move in different ways. 

To get there, though, we’ll first need to equip you with some very important mathematical tools for understanding how we describe the motion of rigid bodies in space. This will be the subject of the next blog post, in which we’ll show you how to represent the motion of rigid bodies using some basic linear algebra.

If you liked this post, don’t forget to check out our store for all things related to robot arms and to subscribe!