LESSON

# Analyzing a 2-joint planar robot arm

#### Share

#### Transcript

Now I'm going to add a second joint to the robot that I've shown you before and this robot is a little bit interesting in that the end effector can reach any particular point within an outer maximum circle described by this, like an easily adaptive position like this, like an adaptive position like that. My two-degree of freedom robot can adapt any x-y coordinate within the maximum circle.

With this two-degree of freedom robot, although we can adapt any x-y coordinate within its working space, it can’t adapt an arbitrary orientation. So if the robot wants to be at this particular xy coordinate, there is no other orientation of this link of the robot that's possible because orientation and position are highly coupled.

Let's follow a similar procedure to determine the pose of the end effector of these two-link robot. I'm going to notate the robot and indicate the length of its two links and indicate the two joint angles. Next, we're going to rotate out well coordinate frame by an amount Q1. So a world reference frame now becomes this grey coordinate frame shown here. Next I'm going to translate that coordinate frame along with the first link of the robot so now it's here. We've applied now a transformation in the x direction by the distance A1. Now I'm going to rotate the frame by the amount Q2, the coordinate frame now looks like this.

Finally, I'm going to translate it in the x direction by the amount A2. This gives us the coordinate frame attached to the end effector of the robot, the end effector pose.

Now I can expand out this expression and multiply together each of these matrices and the result is this. Once again, we can look at the translational path of this homogeneous transformation matrix. These elements here pulling out, and now I have an expression for the x and y coordinate of the end effector of my two-link robot. Once again we can see that the rotational path of this transformation matrix which indicates the orientation of the end effector is also a function of Q1 and Q2. In fact it’s a function of Q1+Q2. So once again, we can use Q1 and Q2 to independently control x and y but we can't independently control the orientation of the end effector. If we use Q1 and Q2 to choose x and y, then the orientation of the end-effector is already determined and can be independently chosen.

An interesting thing with a two-link manipulator is that there are two joint angle configurations that will put the end effector at a desired position. Here is one configuration of the robot, and here is an alternative configuration of the robot that results in the same end effector position.

For the two-link robot, I've already created some works based variables to represent the link lengths, that's the variables A1 and A2 and to represent the two joint angles Q1 and Q2. And you can see their numeric values over here. To determine the end effector pose I need to chain together a number of elementary homogeneous transformations so I am going to have a rotation by Q1 followed by translation and the x direction by A1 followed by a rotation of Q2, followed by a translation in the x direction by the length of link 2.

And I'm going to parse in the two joint angles, Q1 and Q2. Here we have a homogeneous transformation representing the pose of the end effector of a two-link robot and the position of the end effector is given by these two numbers here and this 2X2 matrix here represents the orientation of the end effector.

Now we can substitute these numeric values by symbols so I defined symbol Q1 and Q2 and symbols for A1 and A2. We can see in the workspace now these things are symbolic objects as far as MATLAB is concerned. And I can repeat this trchain2 function and what I have now is a symbolic representation of the pose of this two-link robot manipulator.

I can import a model of a two-link manipulator as the tool box of function mdl_planar2, and creates a new object in the works based called P2 which represents this robot manipulator.

What I can do is I can invoke the teach method again and here we see a two-link robot manipulator and I can adjust its joint angles and see how it moves. Up here we have the x and y coordinates of the robot end effector and we see that that updates as I adjust the joint angles.

An interesting thing with the two-link manipulator is that there are two sets of joint angles which result in the same end effector position. I'm going to use the plot method and I'm going to move the robot to a configuration where joint one has got an angle of zero and joint 2 has an angle of pi on two radians.

And here we see a robot in that particular configuration. Now I'm going to plot it in a different configuration, that angle is going to be pi on two and this angle is going to be minus pi on two.

What we see is that the robot end effector has got exactly the same position. Robot has a different configuration, the end effector has got a different orientation but the position is exactly the same.

#### Code

We consider a robot, which has two rotary joints 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.

If I use symbolic representation in MATLB and now have my rotation matrix represented in terms of q1, q2 and q3, what way can I use to substitute q1, q2 and q3 in the rotation matrix in MATLAB. Thanks

Are you wanting to substitute numerical values?

How did you go from E=R(q_1)T_x(a_1)R(q_2)T_x(a_2) to the matrix

Each of the terms in this equation, eg. R(q_1) or T_x(a_1), is a matrix. I’ve just multiplied them together. To understand how to represent rotations and translations as matrices, more specifically homogeneous transformation matrices, have a look at the 2D Geometry masterclass.

Hello teacher, thank you very much for these magnificent robotics classes. Why do you say in minute 0:50 that there is no other orientation of the last link? , because it is known later that if there is another possible orientation. Thank you very much dear professor.

You are correct, there are 2 possible orientations for this position, but I didn’t want to complicate the argument at this early stage. Sorry for the confusion,