User Tools

Site Tools


2_link_kinematics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
2_link_kinematics [2018/09/10 21:44]
ntorresreyes [Graphical Simulation]
2_link_kinematics [2018/09/25 22:09] (current)
ntorresreyes [Background and Theory]
Line 10: Line 10:
 <!-- Add a representative photo of your tutorial below. ​ Make it centered in the page --> <!-- Add a representative photo of your tutorial below. ​ Make it centered in the page -->
  
-{{ torres:​tutorials:​2_link_tutorial_1.png?​200 |}}+{{ torres:​tutorials:​2_link_tutorial_1.png?​400 |}}
  
 \\ \\
Line 29: Line 29:
 \\ \\
 The rest of this tutorial is presented as follows: The rest of this tutorial is presented as follows:
 +  * Homogeneous Transformations
   * Background And Theory   * Background And Theory
-  * Numerical ​Simulation+  ​* Analytical Solution 
 +  ​* Numerical ​Solution
   * Graphical Simulation   * Graphical Simulation
   * Final Words   * Final Words
Line 37: Line 39:
  
 This section provides a short background of the problem and basic theory used. This section provides a short background of the problem and basic theory used.
 +\\
 +\\
 +** Homogeneous Transformations **
 +\\
 +\\
 +{{:​torres:​tutorials:​2_link_tutorial_9.png?​450|}}
 +\\
 +\\
 +In this case, we will only consider 2-dimensional homogeneous transformations. First, we must introduce homogeneous coordinates:​
 +\\
 +\\
 +Vector v = [x y w]<​sup>​T</​sup>​ , 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:
 +\\
 +\\
 +[R<​sub>​z</​sub>​] = [<​sup>​A</​sup>​x<​sub>​B</​sub>​ <​sup>​A</​sup>​y<​sub>​B</​sub>​ <​sup>​A</​sup>​z<​sub>​B</​sub>​]
 +\\
 +\\
 +Where <​sup>​A</​sup>​x,​y,​z<​sub>​B</​sub>​ are the unit vectors along the x,y,z-axis of frame B w.r.t frame A. This results in:
 +\\
 +\\
 +{{:​torres:​tutorials:​2_link_tutorial_10.png?​300|}}
 +\\
 +\\
 +A translation vector **p** = p<​sub>​x</​sub>​i + p<​sub>​y</​sub>​j translates the origin of B from the origin of A. The given translation matrix **P** is given by:
 +\\
 +\\
 +{{:​torres:​tutorials:​2_link_tutorial_11.png?​200|}}
 +\\
 +\\
 +Next, the translation matrix can be multiplied by the rotation matrix to obtain the complete homogeneous transformation matrix:
 +\\
 +\\
 +{{:​torres:​tutorials:​2_link_tutorial_12.png?​nolink&​300|}}
 +\\
 +\\
 +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:
 +\\
 +\\
 +<​code>​
 +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
 +</​code>​
 +\\
 +\\
 +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).
 \\ \\
 \\ \\
Line 71: Line 133:
 \\ \\
 ---- ----
 +<​code>​
 clear; clc; format compact; ​ clear; clc; format compact; ​
  
-L1 = 1; \\+L1 = 1; 
 L2 = 1; L2 = 1;
  
-L(1) = Link([0 0 L1 0]); \\+L(1) = Link([0 0 L1 0]); 
 L(2) = Link([0 0 L2 0]); L(2) = Link([0 0 L2 0]);
  
-TwoLink_arm = SerialLink(L,​ '​name',​ '2Link Arm');+TwoLink_arm = SerialLink(L,​ '​name',​ '2Link Arm'​); ​ 
 +</​code>​
 ---- ----
 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. 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) ​\\+<​code>​ 
 +T = transl(1,​0,​0)
 T = T =
      ​1 ​    ​0 ​    ​0 ​    1      ​1 ​    ​0 ​    ​0 ​    1
Line 90: Line 155:
      ​0 ​    ​0 ​    ​1 ​    0      ​0 ​    ​0 ​    ​1 ​    0
      ​0 ​    ​0 ​    ​0 ​    1      ​0 ​    ​0 ​    ​0 ​    1
->> q = TwoLink_arm.ikine(T,'​mask',​[1 1 0 0 0 0],'​q0',​[1 0]) \\+>> q = TwoLink_arm.ikine(T,'​mask',​[1 1 0 0 0 0],'​q0',​[1 0]) 
 q = q =
     1.0472 ​  ​-2.0944     1.0472 ​  ​-2.0944
->> p = TwoLink_arm.fkine(q) ​\\+>> p = TwoLink_arm.fkine(q) ​
  
 p =  p = 
Line 100: Line 165:
          ​0 ​        ​0 ​        ​1 ​        0          ​0 ​        ​0 ​        ​1 ​        0
          ​0 ​        ​0 ​        ​0 ​        1          ​0 ​        ​0 ​        ​0 ​        1
 +</​code>​
  
 \\ \\
2_link_kinematics.1536641063.txt.gz · Last modified: 2018/09/10 21:44 by ntorresreyes