Using the diagram and above equations, I need a matlab script file that converts
ID: 3674537 • Letter: U
Question
Using the diagram and above equations, I need a matlab script file that converts a point in (x,y) into angles theta1 and theta2 to position the robot arm at that point. Try points in each quadrant. To check that the formula works, recompute x and y from theta1 and theta2 using the formula given in the problem statement.
CH2 Problem: 141 Question: F s" a shoulder or base joint Figure P41 illustrates a robot arm that has two links" connected by two joint CH2 42 and an elbow joint. There is a motorat each joint. The joint angles are 1 and 2. The x, y coordinates of CH2 40 the hand at the end of the arm are given by x = L, cost, + L2 cos(81 + 2) y = Li sine, + L2 sin(91 + %) where L1 and L2 are the lengths of the links. Hand 2 Elbow Motor a, Base Motor Path of Hand Finish StartExplanation / Answer
%% hi dude
% use matlab latest R2014a versionfor Fuzzy logic support. %% i just tried few other methods to but This best for my knowledge.
%%
l1 = 10; % length of first arm
l2 = 7; % length of second arm%
%X = 8;
%Y =9 ;
%%
[X, Y] = meshgrid(x,y);
c2 = (X.^2 + Y.^2 - l1^2 - l2^2)/(2*l1*l2);
s2 = sqrt(1 - c2.^2);
THETA2D = atan2(s2, c2); % theta2 is deduced
%%
k1 = l1 + l2.*c2;
k2 = l2*s2;
THETA1D = atan2(Y, X) - atan2(k2, k1); % theta1 is deduced
%XY = [X Y];
XY = [X(:) Y(:)];
THETA1P = evalfis(XY, anfis1); % theta1 predicted by anfis1
THETA2P = evalfis(XY,anfis2); % theta2 predicted by anfis2
%%
theta1diff = THETA1D(:) - THETA1P;
theta2diff = THETA2D(:) - THETA2P;
subplot(2,1,1);
plot(theta1diff);
ylabel('THETA1D - THETA1P','fontsize',10)
title('Deduced theta1 - Predicted theta1','fontsize',10)
subplot(2,1,2);
plot(theta2diff);
ylabel('THETA2D - THETA2P','fontsize',10)
title('Deduced theta2 - Predicted theta2','fontsize',10)
% Its available dude. Just check below link to know more
%% http://in.mathworks.com/help/fuzzy/examples/modeling-inverse-kinematics-in-a-robotic-arm.html.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.