You are on page 1of 12

KOCAEL NVERSTES

FEN BLMLER ENSTTS


MEKATRONK MHENDSL ANABLM DALI

2-RR PARALEL ROBOTUN KEMATK ANALZ

Projeyi Hazrlayan: 115113002 Volkan AYGL

Danman:Yrd. Do.Dr.Serdar KK

VOLKAN AYGL

2RR PARALEL ROBOT ANALZ

2-RR PLANAR ROBOTUN KNEMATK ANALZ VE


SMLASYONU
P(x,y)

a1

a2

C1

C2

l1

l2
1
OB1

2
OB2

X
1-TERS KNEMATK

VOLKAN AYGL

2RR PARALEL ROBOT ANALZ

OB1 B1C 1 C1P OP (1)


OB2 B2C 2 C2 P OP (2)
1 0 0 OB xi cos i

0 1 0 OB yi sin i
OB1 i

PT
0 0 1
0 0

0 0 0
1

0
cos(i ai ) sin(i ai )

sin(i ai ) cos(i ai )

0
0

0
0

sin i
cos i
0
0

0 0 cos ai

0 0 sin ai
1 0
0

0 1
0

sin ai
cos ai
0
0

0
0

li

0
1 0

0 1

1 0 0
0 1 0

li

0
0 0 1 0

0 0 0 1

0 OBxi ai cos(i ai ) li cos i

0 OByi ai cos(i ai ) li cos i


a
1
0

0
1

OBxi ai cos( i ai ) li cos i Px


OByi ai cos(i ai ) li cos i Py
buradan;

A tan 2( a, b) A tan 2 a 2 b 2 c 2 , c
i A tan 2(2li (OByi Py ), 2li (OBxi Px )) A tan 2 2li (OB yi Py )
ai A tan 2(ai sin i , ai cos i ) A tan 2 ai sin i ,
x2 Px OBX l cos i

2li (OBxi Px
)

ai cos i x2 2 , x2
2

2-LER KNEMATK

(di d12b12 d12 2bi 2c12b12 )


Py
2(b12 2 d12 2 )
(di d12b12 d12 2bi 2c12b12 )2 4(b12 2 d12 2 )(c12 2 d1d12c12 d12 2ci )

i A tan 2( q1 , q2 ) A tan q12 q2 2 q32 , q3


q3 bxi Px li cos i
q1 ai sin i
q2 i cos i
OBxi Px li cos i
ai cos(i ai )

ai sin(i ai )
OByi Py li sin i

xi 2 , xi

VOLKAN AYGL

2RR PARALEL ROBOT ANALZ

li2 2li Px cos i 2li Py sin i 2libxi cos i 2li byi sin i 2 Pxbxi Py 2 2 Pybyi bxi 2 byi 2 a 2 0
di 2(li cos i bxi )
bi 2(li sin i byi )
ci 2libyi sin i 2libxi cos i li 2 bxi 2 byi 2 a 2
Px 2 Py 2 di Px bi Py ci 0
Px 2 Py 2 d1Px b1Py c1
Px 2 Py 2 d 2 Px b2 Py c2
Px

c1 c2 Py (b1 b2 )
d1 d 2

(di d12b12 d12 2bi 2c12b12 )


Py
2(b12 2 d12 2 )

(di d12b12 d12 2bi 2c12b12 )2 4(b12 2 d12 2 )(c12 2 d1d12c12 d12 2ci )

q3 bxi Px li cos i
q1 ai sin i
i A tan 2(q1 , q2 ) A tan q12 q22 q32 , q3

3-GUI ARAYZ

q2 i cos i

VOLKAN AYGL

2RR PARALEL ROBOT ANALZ

EK-1 KODLAR
function varargout = rbt(varargin)
% RBT M-file for rbt.fig
%
RBT, by itself, creates a new RBT or raises the existing
%
singleton*.
%
%
H = RBT returns the handle to a new RBT or the handle to
%
the existing singleton*.
%
%
RBT('CALLBACK',hObject,eventData,handles,...) calls the local
%
function named CALLBACK in RBT.M with the given input arguments.
%
%
RBT('Property','Value',...) creates a new RBT or raises the
%
existing singleton*. Starting from the left, property value pairs
are
%
applied to the GUI before rbt_OpeningFcn gets called. An
%
unrecognized property name or invalid value makes property
application
%
stop. All inputs are passed to rbt_OpeningFcn via varargin.
%
%
*See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
%
instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help rbt
% Last Modified by GUIDE v2.5 27-Nov-2011 18:06:56

VOLKAN AYGL

2RR PARALEL ROBOT ANALZ

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name',
mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @rbt_OpeningFcn, ...
'gui_OutputFcn', @rbt_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback',
[]);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before rbt is made visible.


function rbt_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject
handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% varargin
command line arguments to rbt (see VARARGIN)
% Choose default command line output for rbt
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes rbt wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = rbt_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject
handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;

% --- Executes on button press in pushbutton1.


function pushbutton1_Callback(hObject, eventdata,
global Q1 Q2 By1 By2 Bx1 Bx2 a1 a2 l1 l2 Px1 Py1
alfa2 alfa3 alfa4 delta1;
% hObject
handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future
% handles
structure with handles and user data
Q1=str2double(get(handles.edit1,'String'));

handles)
Py2 Py3 Py4 Xa Ya alfa1
version of MATLAB
(see GUIDATA)

VOLKAN AYGL

2RR PARALEL ROBOT ANALZ

Q2=str2double(get(handles.edit2,'String'));
l1=10;
l2=10;
a1=10;
a2=10;
Bx1=10;
Bx2=10+10*sqrt(2);
By1=0;
By2=0;
d1=2*(l1*cosd(Q1)+Bx1);
d2=2*(l2*cosd(Q2)+Bx2);
b1=2*(l1*sind(Q1)+By1);
b2=2*(l2*sind(Q2)+By2);
c1=2*l1*By1*sind(Q1)+l1^2+2*l1*Bx1*cosd(Q1)+Bx1^2-a1^2;
c2=2*l2*By2*sind(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,t5)*180/pi)+(atan2(sqrt(t4^2+t5^2-t6^2),t6)*180/pi);
alfa4=(atan2(t4,t5)*180/pi)-(atan2(sqrt(t4^2+t5^2-t6^2),t6)*180/pi);
%%%
Xa=(cosd(Q1)*10)+10;
Ya=10*(sind(Q1));
Xb=cosd(Q2)*10+(10+10*sqrt(2));
Yb=10*sind((Q2));
X=[10 Xa Px1 Xb 10+10*sqrt(2)];
Y=[ 0 Ya Py1 Yb 0];
axes(handles.axes1);
plot(X,Y,'b','LineWidth',3);
hold on;
plot(X,Y,'*','Markersize',8,'LineWidth',3);
grid on;
hold off;
set(handles.edit5,'String',Px1);
set(handles.edit6,'String',Py1);

VOLKAN AYGL

2RR PARALEL ROBOT ANALZ

% --- Executes on button press in pushbutton2.


function pushbutton2_Callback(hObject, eventdata, handles)
global Px Py alfa11 alfa21;
% hObject
handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
Px=str2double(get(handles.edit3,'String'));
Py=str2double(get(handles.edit4,'String'));
%%
a1=10;a2=10;l1=10;l2=10;
OBx1=10;OBy1=0;OBx2=10+10*sqrt(2);OBy2=0;
%%
X1=(a1^2)-(l1^2)-(Px^2)-(Py^2)-(OBx1^2)-(OBy1^2)+(2*Px*OBx1)+(2*Py*OBy1);
X2=(a2^2)-(l2^2)-(Px^2)-(Py^2)-(OBx2^2)-(OBy2^2)+(2*Px*OBx2)+(2*Py*OBy2);
a1=2*l1*(OBy1-Py);
a2=2*l2*(OBy2-Py);
b1=2*l1*(OBx1-Px);
b2=2*l2*(OBx2-Px);
teta11=(180/pi)*(atan2(a1,b1)+atan2(sqrt((a1^2)+(b1^2)-(X1^2)),X1));
d=-a1*sind(teta11);
e=a1*cosd(teta11);
f=Px-OBx1-l1*cosd(teta11);
alfa11=atand(d/e)+atand(sqrt(d^2+e^2-f^2)/f);
teta21=(180/pi)*(atan2(a2,b2)+atan2(sqrt((a2^2)+(b2^2)-(X2^2)),X2));
d=-a2*sind(teta21);
e=a2*cosd(teta21);
f=Px-OBx2-l2*cosd(teta21);
alfa21=atand(d/e)+atand(sqrt(d^2+e^2-f^2)/f);
%% Grafik Kodlar
Xa=cosd(teta11)*10+10;
Ya=0+10*sind((teta11));
Xb=cosd(teta21)*10+(10+10*sqrt(2));
Yb=0+10*sind((teta21));
X=[10 Xa Px Xb (10+10*sqrt(2))];
Y=[0 Ya Py Yb 0];
axes(handles.axes1);
plot(X,Y,'b','LineWidth',3);
hold on;
plot(X,Y,'*','Markersize',8,'LineWidth',3);
grid on;
hold off;
set(handles.edit7,'String',teta11);
set(handles.edit8,'String',teta21);

function edit3_Callback(hObject, eventdata, handles)


% hObject
handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit3 as text
%
str2double(get(hObject,'String')) returns contents of edit3 as a
double

VOLKAN AYGL

2RR PARALEL ROBOT ANALZ

% --- Executes during object creation, after setting all properties.


function edit3_CreateFcn(hObject, eventdata, handles)
% hObject
handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit4_Callback(hObject, eventdata, handles)


% hObject
handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit4 as text
%
str2double(get(hObject,'String')) returns contents of edit4 as a
double

% --- Executes during object creation, after setting all properties.


function edit4_CreateFcn(hObject, eventdata, handles)
% hObject
handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit1_Callback(hObject, eventdata, handles)


% hObject
handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
%
str2double(get(hObject,'String')) returns contents of edit1 as a
double

% --- Executes during object creation, after setting all properties.


function edit1_CreateFcn(hObject, eventdata, handles)
% hObject
handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.

VOLKAN AYGL

2RR PARALEL ROBOT ANALZ

%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit2_Callback(hObject, eventdata, handles)


% hObject
handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit2 as text
%
str2double(get(hObject,'String')) returns contents of edit2 as a
double

% --- Executes during object creation, after setting all properties.


function edit2_CreateFcn(hObject, eventdata, handles)
% hObject
handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit5_Callback(hObject, eventdata, handles)


% hObject
handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit5 as text
%
str2double(get(hObject,'String')) returns contents of edit5 as a
double

% --- Executes during object creation, after setting all properties.


function edit5_CreateFcn(hObject, eventdata, handles)
% hObject
handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

10

VOLKAN AYGL

2RR PARALEL ROBOT ANALZ

function edit7_Callback(hObject, eventdata, handles)


% hObject
handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit7 as text
%
str2double(get(hObject,'String')) returns contents of edit7 as a
double

% --- Executes during object creation, after setting all properties.


function edit7_CreateFcn(hObject, eventdata, handles)
% hObject
handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit8_Callback(hObject, eventdata, handles)


% hObject
handle to edit8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit8 as text
%
str2double(get(hObject,'String')) returns contents of edit8 as a
double

% --- Executes during object creation, after setting all properties.


function edit8_CreateFcn(hObject, eventdata, handles)
% hObject
handle to edit8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit6_Callback(hObject, eventdata, handles)


% hObject
handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit6 as text

11

VOLKAN AYGL

2RR PARALEL ROBOT ANALZ

%
double

str2double(get(hObject,'String')) returns contents of edit6 as a

% --- Executes during object creation, after setting all properties.


function edit6_CreateFcn(hObject, eventdata, handles)
% hObject
handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

12

You might also like