LESSON

# Analyzing a robot arm that moves in 3D

#### Share

#### Transcript

The robots that we looked at so far move in the 2D plane but most useful robots move in three dimensions. What we want to do now is to determine the pose of the end effector of this robot which moves in three dimensional space. The process we follow is very, very similar to the process we did for the two dimensional robots. First of all we introduced a reference coordinate frame and then we indicate the part of the robot the object whose pose we’re interested in, that’s the end effector of the robot indicated here by the symbol ksi E.

The first step then is a rotation of the coordinate frame about the z axis by an amount Q1. Then we translate that coordinate frame in the x direction by an amount A1 the length of the first link. Then we rotate the coordinate frame about the z axis again by an amount Q2.

Next we translate in the X direction by an amount A2 that’s the length of the second link. Then we rotate around the Z axis again by the angle Q3 and finally we translate in the Z direction by the amount Q4.

We now have described the pose of the robot’s end effector as a chain, a sequence of elementary homogeneous transformation matrices. All of the matrices belong to the set SE3 that’s the set of all rotations and translations in three dimensional space. We could expand out each of these elementary matrices and multiply them all together to come up with a single homogeneous transformation metric representation the pose the end effector of this Scara robot. This small robot has gone four degrees of freedom, four rotational joints.

So the first rotation is around an axis like this. You see that the whole arm rotates around the base. The second rotating joint has got an axis like this and we can say that the whole arm can rotate around this axis here. The third joint is rotation around this axis, you see that longer arm rotates around that and the fourth joint is a rotation around an axis here. You can see that the whole group of mechanism rotates with respect to the lower arm.

Let’s finish off by looking at this four joint educational robot. We've had quite a bit of practice by now that we should be able to write down the expression for the robot end effector pose almost by inspection.

So this is the way I think about the problem. I imagine that the robot is stretched down vertically with its two fingers pointing to the sky and then I just write down the sequence of transformations. First of all the robots rotates around the reference Z axis by the amount Q1 and then we move up a little bit which is in the Z direction and then we rotate around the Y axis by the amount Q2.

Then we move up a little bit and encounter the next joint, joint 3 we rotate around the Y axis by the amount Q3 then we move up a bit more in the Z direction encounter the last joint, joint 4 we rotate around the Y axis by the joint angle Q4. And then we move up a bit more in the Z direction until we reach the tip of the fingers.

So just by mentally walking through the robot mechanism joint by joint, link by link we can write down an expression for the pose of the end effector. Then it’s a simple a matter of expanding out the matrices and then multiplying them all together. And we can use a tool like MATLAB to make that very easy for us.

Now we’re going to use MATLAB to determine the pose of the end effector of this robot which moves in three dimensions and we’re going to do this symbolically but first of all I’m going to define some symbolic variables for the various link lengths A1, A2, A3, and A4 and also for the four joint angles Q1, Q2, Q3 and Q4. We’re going to use the trchain function again. This time we’re going to use the function called trchain which operates in three dimensions rather than the function trchain2 which operates in two dimensions that we used in the previous examples.

And now I start to write this transform string so we’re going to do a rotation around the Z axis by Q1 and then we’re going to do a translation in the Z direction by A1 then we’re going to do a rotation around the Y axis by Q2 and then we’re going to do another translation in the Z direction by A2 and then we’re going to do a rotation around the Y axis by Q3 and then we’re going to do another translation in the Z direction by A3 and then we’re going to do a rotation around the Y axis by Q4 and finally a translation in the Z direction by A4.

I close that string and now I pass in the joint angles Q1, Q2, Q3 and Q4 and here we have the expression for the homogeneous transformation which represents the pose of this robot which moves in three dimensions. Because the robot’s operating in three dimensions this homogeneous transformation is a four-by-four matrix. And we can see that it’s quite a large and complex expression and I need to scroll sideways quite a lot to get to end of it.

If I wanted to determine the X coordinate of the end effector of this robot I would do that by taking the element in the first row and the forth column of this homogeneous transformation matrix and that would be the expression for the X coordinate of this robot and again that itself is quite a complex expression.

#### Code

We consider a robot with four joints that moves its end-effector in 3D space.

### Skill level

MATLAB experience

This content assumes an understanding of high school level mathematics; for example, trigonometry, algebra, calculus, physics (optics) and experience with MATLAB command line and programming, for example workspace, variables, arrays, types, functions and classes.

### Rate this lesson

## Check your understanding

## Discussion

## Leave a comment

Please Sign In to leave a comment.

trachain is not working with symbolic input ( I ‘m using matlab 2017b and the latest version from the toolbox)

This is best handled on the Toolbox forum tiny.cc/rvcforum

I have same Matlab version and same problem with newest toolbox. Function trchain just doesnt work with syms function. It gives me ans that is 4×4 double instead of 4×4 sym.

Uninstall the Phased Array System Toolbox as it clashes with Dr. Corke’s toolbox.

I am a bit bothered. why are exactly are the rotations q2, q3, q4 about the y-axis instead of the z-axis?

Thanks a lot sir.

YOU ARE SIMPLY AMAZING!

If i’m not wrong, If you see in the picture, the Z initial axis points up and rotates the entire robot around its base. Then, there is a small translation in Z direction. After that, all the other motors behave as a 3 link planar manipulator. Mr. Corke opted to maintain the y axis in the same direction of the rotation of the motors, then the Z axis always points in direction of the next joint, thus the continuos translation on that axis. Other usual approach is to rotate only in direction of Z. For this to happen, apply a fixed rotation of pi/2 in positive X direction, after the first homogeneous transformation, giving you the expression:

E=Rz(q1) Tz(a1) Rx(pi/2) Rz(q2) Ty(a2) Rz(q3) Ty(a3) Rz(q4) Ty(a4)

Giving you the same position of x,y,z, but a different pose.

Sir at 1:06 should it be Tz(q4) or Tz(a3)?

There is no a3. q1..q4 are the joint variables, representing the degrees of freedom (motion) of the robot. For a SCARA robot the last joint moves vertically.