LESSON

# Analyzing a very simple 1-joint robot arm

#### Share

#### Transcript

Here I have created a very simple robot out of Lego. It's got simply one rotational joint or one revolute joint. And the end effector position of the robot can follow any point around a circle if not particularly interesting or particularly useful.

What we are interested in now is to describe the pose of the end effector of this one joint robot. The end effector is indicated by this symbol here. We will recall from the earlier lecture that when we want to describe the pose of an object in two dimensions, we attach a coordinate frame to it and the position of the object is described by the position of the origin of the coordinate frame and the orientation of the object is described by the angle between that coordinate frame and the reference coordinate frame. I've indicated here a reference coordinate frame with the axis x and y.

The first thing we're going to do is to rotate that coordinate frame by the angle Q1. That's the joint angle of our 1 degree freedom robot. So I'm going to apply a homogeneous transformation, a rotation, by the angle Q1. And now I'm going to translate the coordinate frame along the link of the robot. So I'm now going to apply a translation in the x direction. So the gray coordinate frame shown here represents the pose of the robot. We get to the end effector coordinate frame by rotating and then translating the reference coordinate frame. All these transforms are in two dimensions. So we say that they belong the set SE2. That's the set of all translations and rotations in two dimensions.

Using what we learned in an earlier lecture, I can expand this out. Then I can multiply the two matrices together and I come up with a single homogeneous transformation matrix which describes the pose of the end effector. The position of the end effector is given by these two elements in three homogeneous transformation matrix and I've written them out here. And we can see that they describe a set of points which lie on a circle of radius A1.

So the position of the end effector is a function of the joint angle Q1 and the orientation of the end effector which is given by this matrix here is also a function of Q1. So its not possible for us to independently set the position and the orientation of the robot. There are just not enough joints or degrees of freedom in a simple robot like this.

Let's look at doing this in MATLAB. I'm going to define a couple of workspace variables A1 which represents a length of the first link and Q1 which represents the joint angle. Now in order to determine the end effector pose, I need to multiply together a couple of elementary transformations.

An easier way to do this using the robot toolbox is with the function called trchain2. It computes the result of the chain of homogeneous transformations.

The first one in the chain rotation by Q1 and that's followed by a translation in the x direction, that's along the link by a distance A1. I just represent that as a string in MATLAB and then I parse in the joint angle that I'm interested in which is Q1 and here is the result.

What this is done is when the trchain2 is executing, it looks of the variable A1 in the workspace and it looks for the variable Q1 as being the first element of the vector that I parsed in. A1 from the workspace. Q1 comes from the parsed vector. Here is in numeric form the 3x3 homogeneous transformation matrix representing the pose of the end effector of our simple one link robot.

Now I can do it using symbols instead of numbers. And to do that invoke some functions from MATLAB’s symbolic toolbox and I’m going to say Q1 is a symbol and A1 is a symbol. Now what I'm going to do is just repeat the command that I did previously.

And what we had here is a symbolic representation of the pose of the end effector; the same as we worked out a slide ago. Another I can do using the robotic's toolbox is to import a model of a plainer one joint robot. I do that with this function mdl_planar1 and we created a new variable in that workspace; variable called P1. You can see that it's of a serial link of type. It's a robot manipulator type object.

Now with this particular type object, it's got a number of methods. An interesting method is to teach method and if I invoke that, all you see here is a graphical representation of a one link robot and a simple teach pendant, a single slider here. And as I adjust the slider we see the robot move. I'm adjusting the value of the first joint angle. What we see here is the xy coordinate of the end effector of the robot changing as I adjust each joint angle.

We consider the simplest possible robot, which has one rotary joint and an arm.

### 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.

Respected sir, I am Facing issues on running function “trchain2”. although I have the student license version given from university. while checking in the library of robot toolbox, it says there is no function like this. After that, I copied your ‘s library file of 2-d trchain and made a function of this but while again running the program it shows an error that trot2 is not defined and trans12.

Please, sir, guide me.

I have the latest version MATLAB and ROBOTIC TOOLBOX.

Please post this question to the support forum tiny.cc/rvcforum, along with details of the error message you are seeing. Also say how you installed the toolbox (zip file or mltbx file).

I am confused regarding the order of multiplication of rotation and translation.

In my mind a transform T from frame A to frame B, shows how the coordinate frame B is positioned and oriented with respect to frame A.

If T = [-1 0 2;

0 -1 3;

0 0 1]

Then I would say that frame B is rotated by 180 degrees and translated [2;3] from the origin of frame A (that is translated [2;3] in frame A coordinates).

If I e.g. do:

T = trot2(pi) * transl2(2,3)

Then T becomes:

T = [-1 0 -2;

0 -1 -3;

0 0 1]

Which in my mind means that frame B is flipped 180 degrees and is positioned below frame A at (-2,-3).

If I do:

T = transl2(2,3) * trot2(pi/2), then

T = [-1 0 -2;

0 -1 -3;

0 0 1]

Which seems sensible to me, but wrong according to the order of multiplication you present here.

I hope this is not too confusing.

I completely agree with the first part of your answer. At a glance it’s hard to say this is a rotation by 180degrees. The columns of the rotation matrix are (-1,0) and (0,-1) and these are the directions of the new x- and y-axis respectively, in terms of the original coordinate frame.

I disagree with your last answer

>> T = transl2(2,3) * trot2(pi/2)

T =

0.0000 -1.0000 2.0000

1.0000 0.0000 3.0000

0 0 1.0000

the translational parts are not negative as you have written them. In words, what this is saying is move the origin of the frame by (2,3) THEN rotate by pi/2.

Your middle example says something different

>> T = trot2(pi) * transl2(2,3)

T =

-1.0000 -0.0000 -2.0000

0.0000 -1.0000 -3.0000

0 0 1.0000

it says rotate by pi/2 THEN move the origin of the frame by (2,3) in the new/rotated frame.

If this doesn’t answer your question then please rephrase and we can go again. These are important concepts to grasp but once it “clicks” it’s a very helpful way to think about spatial problems.

As per your lectures, a Homogenous Transformation Matrix represents a translation followed by a rotation, which I completely agree with. But in most of the online resources on the web, I have seen people saying that it represents a rotation followed by a translation. When I try to do as such i.e. Rotation Matrix * Translation Matrix, I don’t get the Homogenous Matrix. So I believe its a translation followed by a rotation. Is my belief true?

Hello teacher, thank you very much for these magnificent robotics classes. I am using toolbox 10.4 and when I run p1.teach, the variation in q1 looks like a variation of roll, why does roll describe manipulator rotation? Thanks a lot in advance.

Although this is a planar example, we can consider this a 3D problem with z-axis out of the page/screen. The end-effector orientation for our simple robot is described simply by rotation about the z-axis, it cannot rotate about the x- or y-axes. Teach displays orientation using XYZ roll-pitch-yaw angles which means Rx(yaw) Ry(pitch) Rz(roll), hence the rotation appears as a “roll” value. Perhaps not intuitive, but teach() was really meant for proper 3D robots.