0% found this document useful (0 votes)
47 views

Set - 05 - 2023ht30061 Akash Gonjari - Robotics Lab Exam

The document contains the lab exam report submitted by a student. It includes two questions on forward and inverse kinematics of manipulators. For each question, it provides the problem statement, MATLAB code for the solution both as a function and a script, and screenshots of the MATLAB editor and command window output.

Uploaded by

Akash Gonjari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Set - 05 - 2023ht30061 Akash Gonjari - Robotics Lab Exam

The document contains the lab exam report submitted by a student. It includes two questions on forward and inverse kinematics of manipulators. For each question, it provides the problem statement, MATLAB code for the solution both as a function and a script, and screenshots of the MATLAB editor and command window output.

Uploaded by

Akash Gonjari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Lab Exam Report

Submitted in fulfillment of the requirements of


DEZG561- Mechanisms and Robotics

(Assignment)
By
Name: Akash Sanjay Gonjari

(ID NO: 2023HT30061)

BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, PILANI


CAMPUS
Second Semester 2023-2024
Question 1 Problem Statement

Objective of the Analysis:


To write a MATLAB function to find the tool point for the manipulator shown in the figure above.

MATLAB procedure and results


To write a MATLAB function file for the above problem, we first need to write the forward kinematic
equation of the manipulator.

Forward Kinematic Equation is given by

P = transz(d1)*transx(L1)*rotz(θ2)*transx(L2)*rotz(θ3)*transx(L3)*rotz(90)*rotx(90)*O

Where O = [0 0 0 1]T and P = [Px Py Pz 1]T

The code for function file for finding the tool point of the above manipulator is as below

function [P0,P1,P2,P3,P] = manipulatortoolpoint(O,L1,L2,L3,D1,theta2,theta3)

P =
transz(D1)*transx(L1)*rotz(theta2)*transx(L2)*rotz(theta3)*transx(L3)*rotz(90)*rotx(90)
*O;
P0 = O;
P1 = transz(D1)*O;
P2 = transz(D1)*transx(L1)*O;
P3 = transz(D1)*transx(L1)*rotz(theta2)*transx(L2)*O;

end
For the function manipulatortoolpoint ,

The inputs are

• O (origin)
• L1 (Length of link, constant)
• L2 (Length of link, constant)
• L3 (Length of link, constant)
• D1 (displacement, variable)
• theta2 (rotation angle, variable)
• theta3 (rotation angle, variable)

The outputs are the points

• P0 (Origin)
• P1 (Intermediate Point)
• P2 (Intermediate Point)
• P3 (Intermediate Point)
• P (Tool Point)

To use the above defined function, we use the below program script

% Lab Exam Question 1 (Forward Kinematics)

clc
clear all

% For the given manipulator, constants are defined as follows


O = [0,0,0,1]';
L1 = 200;
L2 = 350;
L3 = 250;

% Enter the value of variables


D1 = input("Enter the value of D1 in mm:");
theta2 = input("Enter the value of theta2 in degree:");
theta3 = input("Enter the value of theta3 in degree:");

% Calculate the toolpoint and intermediate points using function


"manipulatortoolpoint"
[P0,P1,P2,P3,P] = manipulatortoolpoint(O,L1,L2,L3,D1,theta2,theta3);

X = [P0(1),P1(1),P2(1),P3(1),P(1)];
Y = [P0(2),P1(2),P2(2),P3(2),P(2)];
Z = [P0(3),P1(3),P2(3),P3(3),P(3)];

plot3(X,Y,Z,'--rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',10)

hold on
Matlab Screenshots
Figure

1: Function file
Figure 2: Program Script
Result:

Figure 3: Command Window


Figure 4: Plot for home position with input D1=0, theta2 =0, theta3 =0 giving tool point as (800,0,0,)
Figure 5: Plots for 3 separate inputs on the same plot
Question 2 Problem Statement

Objective of the Analysis:


To write a MATLAB function to find d1 and θ2 for a given value of P for the manipulator shown in the
figure above.

MATLAB procedure and results


To write a MATLAB function file for the above problem, we first need to write the forward kinematic
equation of the manipulator.

Given robot is a Planar Manipulator. We take the plane of operation of the robot is XY Plane (X-
Horizontal, Y-Vertical).

Forward Kinematic Equation for the manipulator is given by

P = rotz(90)*rotx(90)*transz(d1)*rotz(90)*rotx(-90)*rotz(θ2)*transx(L2)*rotx(90)*O

Where O = [0 0 0 1]T and P = [Px Py 0 1]T

Solving the matrices, we get the following equations

Px = d1 + L2cos(θ2)

Py = L2sin (θ2)

From the above equations, we get

θ2 = sin-1(Py/L2) ------------------------------------------------ (1)

D1 = Px – L2cos(θ2) ----------------------------------------- (2)


θ2 and D1 can be determined using equations 1 and 2

Note:

• The manipulator, due to its geometry can work only in the XY plane (Planar manipulator)
• The manipulator, due to its geometry is assumed to be operating in the First and Fourth Quadrant
only
• In the first quadrant, the calculated value of θ2 is correct.
• In the fourth quadrant, actual θ2 will be 360 + θ2 obtained from equation 1

The function file for calculating D1 and θ2 for a given tool point and L2 for above manipulator is as below

function [theta2,d1] = planar_inv(L2,px,py)

if px>0 && py>0


theta2 = asind(py/L2) ; % Calculate angle theta2
d1 = px - L2*cosd(theta2) ; % Calculte distance d1
else if px>0 && py<0
theta2 = 360 + asind(py/L2); % Calculate angle theta2
d1 = px - L2*cosd(theta2) ; % Calculte distance d1
else
disp('The given coordinates are outside the work envelope of the manipulator');
end
end

The inputs are

• L2 (Length of link, constant)


• Px (x-coordinate of tool point)
• Py (y-coordinate of tool point)

The outputs are the points

• θ2
• D1

To use the above defined function, we use the below program script

(see next page)


% Lab Exam Question 2 Set 5 Planar Robot Inverse Kinematics
% Robot operates in the XY Plane (X Horizontal, Y vertical)
% Robot can only operate in the 1st Quadrant and 4th Quadrant
clc
clear all
L2 = input('Enter the length of link L2:');
px = input('Enter the X coordinate of the tool point (1st or 4th Quadrant
only):');
py = input('Enter the Y coordinate of the tool point (1st or 4th Quadrant only,
magnitude less than or equal to L2):');

[theta2,d1] = planar_inv(L2,px,py)

O = [0,0,0,1]';
P = rotz(90)*rotx(90)*transz(d1)*rotx(-90)*rotz(-
90)*rotz(theta2)*transx(L2)*rotx(90)*O;
P0 = O;
P1 = rotz(90)*rotx(90)*transz(d1)*rotx(-90)*rotz(-90)*O;

X = [P0(1),P1(1),P(1)];
Y = [P0(2),P1(2),P(2)];

plot(X,Y,'--rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',10)

hold on
Matlab Screenshots

Figure 6: Function
Figure 7: Program
Figure 8: Command Window with results
Result:

Figure 9: Result for point in 1st quadrant


Figure 10: Result for point in 4th Quadrant
Result Plots:

Figure 11: Plots for various inputs on the same plot (inputs mentioned in square boxes)
Tutorial screenshots
Problem 1:

Figure 12: Without using Function


Figure 13: Defining function Rotz
Figure 14: Solution Using rotz function
Problem 2:

Figure 15: Problem 2 solution


Problem 3:

Figure 16: Problem 3 solution


Problem 4:
Figure 17: Problem 4 solution
Problem 5:
Figure 18: Problem 5 solution
Problem 6
Figure 19: Problem 6 program
Inverse Kinematic Problem 1
Figure 20: Inverse Kinematic Problem 1 solution
Inverse Kinematic Problem 2
Figure 21: Inverse Kinematic Problem 2 solution

You might also like