User Tools

Site Tools


2_link_kinematics

This is an old revision of the document!


2-Link Kinematics of Planar Robotic Arm

Author: Norberto Torres-Reyes Email: torresre@unlv.nevada.edu
Date: Last modified on 09/06/18
Keywords: kinematics, planar, robotic arm, 2 link


The photo above depicts a diagram for a 2-link planar robotic arm. The big picture problem is to be able to obtain kinematic equations for any given degree of freedom robotic arm. This tutorial shows you how to obtain the kinematics of a 2-link robotic arm in order to solve for the joint angles given an arbitrary end-effector position.

Motivation and Audience

This tutorial's motivation is to <fill in the blank>. Readers of this tutorial assumes the reader has the following background and interests:

* Knows How to Use Matlab
* Perhaps also knows linear algebra.
* Perhaps additional background needed may include knowledge of kinematics


The rest of this tutorial is presented as follows:

  • Background And Theory
  • Analytical Solution
  • Numerical Solution
  • Graphical Simulation
  • Final Words

Background and Theory

This section provides a short background of the problem and basic theory used.

Homogeneous Transformations



In this case, we will only consider 2-dimensional homogeneous transformations. First, we must introduce homogeneous coordinates:

Vector v = [x y w]T , where scale factor w = 1

These coordinates are useful in applying rotations and translations and make transformations simpler than in Cartesian coordinates. We can apply an elementary rotation about the z-axis (normal to the page) with matrix:

[Rz] = [AxB AyB AzB]

Where Ax,y,zB are the unit vectors along the x,y,z-axis of frame B w.r.t frame A. This results in:



A translation vector p = pxi + pyj translates the origin of B from the origin of A. The given translation matrix P is given by:



Next, the translation matrix can be multiplied by the rotation matrix to obtain the complete homogeneous transformation matrix:



To obtain the coordinates for a given point p in frame B relative to frame A, the transformation matrix is multiplied by the vector of p in frame B. For example, in Matlab:

theta = 30*(pi/180);
Px = 2; Py = 3;
PframeB = [1; 4; 1];
T = [cos(theta) -sin(theta) Px; ...
     sin(theta)  cos(theta) Py; ...
     0 0 1];

PframeA = T*PframeB

PframeA = 
   0.8660
   6.9641
   1.0000



In the above example, frame B is translated in the (x,y) direction of frame A by (2,3) and rotated counter-clockwise by 30 degrees along the z-axis. The p vector in frame B has coordinates (1, 4) and the same vector in frame A has coordinates (0.8660, 6.9641).

To perform a combinations of rotations, translations, and/or transformations, the order of multiplication matters. For example, Rotz(30)*Trans(2,3), means that frame B is rotated by 30 degrees about z-axis of frame A and then translated by (2,3) w.r.t frame B. On the other hand, Trans(2,3)*Rotz[30] means frame B is translated by (2,3) w.r.t frame A, and then rotated by 30 degrees about z-axis of frame B.

If the transformation is about the new reference frame, then it is post-multiplied. If the transformation is about the old reference frame, then it is pre-multiplied.

For 3D rotations and translations, the following equations apply:



Forward Kinematics


The image above shows a diagram of the 2-link robotic arm that will be used in this example.

The forward kinematics are used to calculate the joint angles. This is done using planar transformations to go from the origin plane to the end-effector plane. This can be done with arbitrary translations and rotations, but a more practical approach is to use the Denavit-Hartenberg parameters. Obtaining the parameters is discussed more below. First, we will focus on the specific translations and rotations.

Each relative transformation can be described by a matrix A:

n-1An = Rot(zn, thetan)*Trans(0,0,dn)*Trans(an,0,0)*Rot(xn, alphan) , where n the number of links

Using Matlab, the relative transformation A can be calculated easily using symbolic variables (can also be done by hand):

>>syms theta d a alpha
>>Rotz = [cos(theta) -sin(theta) 0 0;...
          sin(theta)  cos(theta) 0 0;...
          0 0 1 0;...
          0 0 0 1];
>>Trans_d = [1 0 0 0;...
             0 1 0 0;...
             0 0 1 d;...
             0 0 0 1];
>>Trans_a = [1 0 0 a;...
             0 1 0 0;...
             0 0 1 0;...
             0 0 0 1];
>>Rotx = [1 0 0 0;...
          0 cos(alpha) -sin(alpha) 0;...
          0 sin(alpha) cos(alpha) 0;...
          0 0 0 1];
>> A = Rotz*Trans_d*Trans_a*Rotx
 
A =
 
[ cos(theta), -cos(alpha)*sin(theta),  sin(alpha)*sin(theta), a*cos(theta)]
[ sin(theta),  cos(alpha)*cos(theta), -sin(alpha)*cos(theta), a*sin(theta)]
[          0,             sin(alpha),             cos(alpha),            d]
[          0,                      0,                      0,            1]



Once each A matrix is obtained, the complete transformation T from frame {0} to frame {N} can be found through:

0Tn = 0A1 * 1A2

Denavit-Hartenberg (DH) Parameters

The DH-parameters (theta_j, d_j, a_j, alpha_j) are obtained from a set of rules that can be easily referenced online. Also, this video is helpful in visualizing each parameter.
*The first parameter, the Joint Angle, is labeled on the diagram and is the angle from the previous x-axis to the new x-axis about the old z-axis.
*The Link Offset is the distance from the origin of the previous frame of reference to the new x-axis along the old z-axis.
*The link length is the distance between the old z-axis and the new z-axis along the new x-axis.
*Finally, the Link Twist is the angle from the old z-axis to the new z-axis about the new x-axis.

The parameters obtained can be substituted into the A that we calculated earlier for each transformation (with j = 1,2):

Analytical Solution

Numerical Simulation - MatLab



clear; clc; format compact; 

L1 = 1; 
L2 = 1;

L(1) = Link([0 0 L1 0]); 
L(2) = Link([0 0 L2 0]);

TwoLink_arm = SerialLink(L, 'name', '2Link Arm'); 

The code above in Matlab creates a planar 2-link robotic arm class with arbitrary link lengths. From this, many functions can be used to do simulations and numerical analysis. For example, forward and inverse kinematics can be easily calculated. The code below translates the end-effector in the x-axis only and creates a transformation matrix. The 'ikine' function uses inverse kinematics to obtain the joint angles needed for the end-effector to achieve the desired position. The 'fkine' function takes in arbitrary joint angles and will return the position of the end-effector.


T = transl(1,0,0)
T =
     1     0     0     1
     0     1     0     0
     0     0     1     0
     0     0     0     1
>> q = TwoLink_arm.ikine(T,'mask',[1 1 0 0 0 0],'q0',[1 0]) 
q =
    1.0472   -2.0944
>> p = TwoLink_arm.fkine(q) 

p = 
    0.5000    0.8660         0         1
   -0.8660    0.5000         0 9.309e-13
         0         0         1         0
         0         0         0         1



The 'TwoLink_arm.plot(q)' function along with the joint angles can be used to plot the position of the robotic arm with the given angles, shown in the image below with the end-effector at (1,0).

Graphical Simulation


TBA

Final Words


TBA

For questions, clarifications, etc, Email: torresre@unlv.nevada.edu

2_link_kinematics.1538020767.txt.gz · Last modified: 2018/09/26 20:59 by ntorresreyes