forward and inverse kinematics with 6 degrees of freedom
need Notations, Introduction, Theory, apparatus, Conclusion, and
references. leave a space for the discussion and results I will add it later. there is an uploaded file with the required material, I hope you find it sufficient. its basically all the info I need to solve the assignment and write a report.
ME40331 – Robotics Engineering Lab – Kinematics of a 6DOF
simulated robot
Deadline for this lab: Friday 6th/NOV/15 by 23:59 – Electronic Anonymous Moodle Submission
Aim: To build a kinematic simulation of a 6 DOF robot, including forward and inverse kinematics.
Submission: The lab requires that you to submit your Matlab files and report via Moodle. The
required submission material is stated in the lab.
Section 1 - Forward Kinematics:
Figure 1 shows 6DOF industrial robot manufactured by KUKA. The first part of this lab concerns
developing Matlab code to simulate the forward kinematics of this robot.
Figure 2 illustrates the joint parameters and variables for this robot, and Figure 3 the
positive/negative value for the joint angles.
Figure 1 - KUKA robot
Figure 2 - Robot link parameters
Figure 3 - Definition of (a) base/end-effector frames and (b) positive angles
Task 1: Given the link parameters in Figure 2, and the joint angle and frame definitions in
Figure 3, assign frames following the DH convention to all links, such that the end-effector
and the base frames are as shown. Ensure all the joint angles are zero radians when the
robot is in the position shown in Figure 3(a) and that the robot angles are positive as
shown in Figure 3(b).
Task 2: Program in Matlab an algorithm to compute the homogeneous transformation
that maps the robot’s end-effector position and orientation with respect to the base of
the robot. This will require editing the code found in RobotGUI.m (download from
Moodle).
Code Deliverable 1: A commented code that performs the correct forward kinematics and
displays it. Please ensure you edit:
? function [effpos,xyzCoor,R] = FK(thetas).
Where the robot’s joint angles are inputs to the code:
? thetas = [theta1, theta2, … theta6]
The function outputs are:
? effpos = [x,y,z] position of the end-effector (frame {6} in Figure 3)
? xyzCoor = [
0f1;
0f2;…;0f6] where the 0fi=[x,y,z] are the coordinates
of frame i w.r.t frame {0}
? R = [
0R1;
0R2…;0R6] where 0Ri is the rotation matrix of frame i w.r.t frame
{0} for example:
R(:,:,1) = [1 0 0 ; 0 1 0; 0 0 1];
??1
0 = [
1 0 0
0 1 0
0 0 1
]
(a) (b)
RobotGUI.fig Graphical User Interface
Figure 4 illustrates a screen capture of the visualiser program (RobotGUI.fig). The following explains
each element in the Graphical User Interface.
? The top left box Joint angles [rad] allows you to input joint angles by scrolling on the sliders,
the 1x6 table shows the numeric value of the joint angles that you input in Radians.
? The End-effector Position shows the position of the end effector as (x,y,z) T . This value will
not work correctly until you program the Forward Kinematics.
? The Wrist Centre Position indicates the (x,y,z)T
coordinates of the robot’s wrist. This value
will not work correctly until you program the Forward Kinematics.
? The End-effector Orientation table illustrates the rotation matrix 0R6, that is the orientation
of the end effector frame w.r.t base frame. This value will not work correctly until you
program the Forward Kinematics.
? The Forward Kinematics diagram plots the robot configuration as a function of the joint
angles. Each joint has a frame attached which corresponds to the D-H frames placed in Task
1. The colour coded frame indicates the X axis in blue, Y axis in Red and Z axis in Green.
? The Inverse Kinematics diagram plots the robot configuration as a function of the joint
angles as calculated by the inverse kinematics.
? Inverse Kinematic Selector allows you to select which of the four possible solutions of the
inverse kinematics should be displayed on the figure.
? Front Elbow-up, Front Elbow-Down, Back Elbow up, Back Elbow down tables show the four
possible Inverse Kinematics solutions as a function of the end-effector position and
orientation.
Figure 4: Robot visualiser GUI before and after the required code edits
RobotGUI.m Matlab code
Figure 5 illustrates the RobotGUI.m code which is the code behind the Graphical User Interface. The
figure illustrates all the functions that the program uses.
? All the functions from Line 1 RobotGUI(varargin) up to Line 317 UpDateTables(…)
are related to the Graphical User Interface and you do NOT need to edit or change. The
tasks in this lab only requires you to the last two functions [effpos, xyzCoor,R] =
FK(thetas) and [solution_IK]=IK(effPos, R06) which are explained in more
detail below.
Figure 5: RobotGUI.m code
Forward Kinematics Matlab code
Figure 6 shows the Forward Kinematics function which you need to edit with your code.
? The function FK takes one parameter as an input (thetas) which is a vector of 6
variables, for example the variables thetas below takes the values ?1 = 0,… ,?6 = 0
thetas = [ 0, 0, 0, 0, 0, 0];
? The function FK must output three variables, [effpos, xyzCoor, R] which are the
coordinates of the robot’s end-effector, the xyz origin coordinates of all the DH axis, and the
rotation matrix for each DH frame w.r.t base frame, i.e. 0R1,
0R2,…,
0R6
effpos =[0,0,0]; %sets the position of the end-effector
xyzCoor = [ 0, 0, 0.0;... %sets the origins of the DH frames on
0, 0, 0.1;... %0.1m increasing positions on the Z
0, 0, 0.2;... %axis
0, 0, 0.3;...
0, 0, 0.4;...
0, 0, 0.5;...
0, 0, 0.6];
? The following code sets the rotation matrix of the base of the robot, 0R0 to be in the positive
direction of the [x, y, z] frames as defined by Matlab.
R(:,:,1) = [1 0 0 ; 0 1 0; 0 0 1];
Figure 6: Forward Kinematics code that requires editing
Section 2 - Inverse Kinematics:
The second section of this lab is about computing the Inverse Kinematics for the same robot as in
section 1.
Calculation of the four possible inverse position solutions
Figure 7 shows and example of the four different Inverse Kinematics solutions for the Elbowmanipulator
(no wrist involved). Front elbow-up and elbow-down occur when x1 is pointing towards
the end-effector. The Back configurations occur when x1 is pointing away from its end-effector.
Task 3: Given the robot in section 1, compute the Inverse Kinematics algorithm and
embed it into the RobotGUI.m for testing before submitting.
Code Deliverable 2: A commented code that performs the correct inverse kinematics and
displays it. The four solutions for the elbow part of the robot are required (as shown in
Figure 7) as well as the two possible wrist configurations (Euler angles) for each of the
four position solutions.
Figure 7: Front and Back solutions for Elbow Robot
Inverse Kinematics Matlab code
Figure 8 illustrates the Inverse Kinematics function which you need to edit with your code.
? The IK function takes two parameters as an input the required end-effector position and
the required orientation for the robot (effPos, R06). Where R06 is a rotation
matrix encoding the required orientation for the end-effector. To compute the direction of
the z vector of the end-effector w.r.t. frame {0}, you can:
z6 = R06(1:3,3,7); %z6 is the Z direction of frame 6 w.r.t base frame
? The IK function returns one variable solution_IK which contains the four possible
inverse kinematic solutions for the position, each with two possible solutions for the wrist
these should be ordered as below:
solution_IK(1,1) = 0; %Front Elbow-up solution for theta(1)
solution_IK(2,1) = 0; %Front Elbow-up solution for theta(2)
solution_IK(3,1) = 0; %Front Elbow-up solution for theta(3)
solution_IK(4,1) = 0; %First possible solution for theta(4)
solution_IK(5,1) = 0; %First possible solution for theta(5)
solution_IK(6,1) = 0; %First possible solution for theta(6)
solution_IK(7,1) = 0; %Second possible solution for theta(4)
solution_IK(8,1) = 0; %Second possible solution for theta(5)
solution_IK(9,1) = 0; %Second possible solution for theta(6)
solution_IK(1,2) = 0; %Front Elbow-down solution for theta(1)
solution_IK(2,2) = 0;
solution_IK(3,2) = 0;
solution_IK(4,2) = 0; %First possible solution for theta(4)
solution_IK(5,2) = 0; %First possible solution for theta(5)
solution_IK(6,2) = 0; %First possible solution for theta(6)
solution_IK(7,2) = 0; %Second possible solution for theta(4)
solution_IK(8,2) = 0; %Second possible solution for theta(5)
solution_IK(9,2) = 0; %Second possible solution for theta(6)
solution_IK(1,3) = 0; %Back Elbow-up solution for theta(1)
solution_IK(2,3) = 0;
solution_IK(3,3) = 0;
solution_IK(4,3) = 0; %First possible solution for theta(4)
solution_IK(5,3) = 0; %First possible solution for theta(5)
solution_IK(6,3) = 0; %First possible solution for theta(6)
solution_IK(7,3) = 0; %Second possible solution for theta(4)
solution_IK(8,3) = 0; %Second possible solution for theta(5)
solution_IK(9,3) = 0; %Second possible solution for theta(6)
solution_IK(1,4) = 0; %Back Elbow-down solution for theta(1)
solution_IK(2,4) = 0;
solution_IK(3,4) = 0;
solution_IK(4,4) = 0; %First possible solution for theta(4)
solution_IK(5,4) = 0; %First possible solution for theta(5)
solution_IK(6,4) = 0; %First possible solution for theta(6)
solution_IK(7,4) = 0; %Second possible solution for theta(4)
solution_IK(8,4) = 0; %Second possible solution for theta(5)
solution_IK(9,4) = 0; %Second possible solution for theta(6)
Figure 8: Inverse Kinematics code to be edited
Deliverables (all in Moodle):
1. Forward kinematics code 5%
2. Inverse kinematics code 5%
3. Report documenting how the code works 5%
Report Guidelines
? 1000 words as a guide. Hard maximum 2000 words.
? Describe your code using code snippets (do not count towards
word limit) to illustrate the important parts of your code.
? Use equations, images, diagrams or any other required
medium to explain the code.
? Diagram showing the overall structure of the code (Ex. Fig. 7).
? You could think of this report as a help file of a Matlab function
eg:
http://uk.mathworks.com/help/matlab/math/inverses-anddeterminants.html
Figure 7 Example of code
diagram

