Documentos de Académico
Documentos de Profesional
Documentos de Cultura
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Outputs from this function are returned to the command line.
function varargout = Brazo_UNI_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)
%4.2 Eslabon2
%->Hallamos A2
theta2=0;
A2=my_robot.compute_matrix_A2(theta2);
%Ploteamos
T02=T01*A2;
h2=plot_frame(T02,'frame','2','color','m');
%4.2 Eslabon3
%->Hallamos A3
theta3=0;
A3=my_robot.compute_matrix_A3(theta3);
%Ploteamos
T03=T02*A3;
h3=plot_frame(T03,'frame','3','color','b');
%4.2 Eslabon4
%->Hallamos A4
theta4=0;
A4=my_robot.compute_matrix_A4(theta4);
%Ploteamos
T04=T03*A4;
h4=plot_frame(T04,'frame','4','color','b');
global conectado
conectado = 0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%
global my_robot
%-------------------------------------------------------------------------%
% 3. Cinematica Inversa
%-------------------------------------------------------------------------%
% 3.1. Usamos el Metodo " Cinematica_ Ivarsa"
q = my_robot.cinematica_inversa(xc, yc, zc);
q1d = q(1);
q2d = q(2);
q3d = q(3);
q4d = q(4);
% 3.2. Salidas
% disp('angulos')
% disp(q)
% disp(q*180/pi)
% qc = q*180/pi;
%
% set(handles.th1,'String',qc(1))
% set(handles.th2,'String',qc(2))
% set(handles.th3,'String',qc(3))
% set(handles.th3,'String',qc(4))
T01=A1;
T02=A1*A2;
T03=T02*A3;
T04=T03*A4;
set(handles.xc,'String',T04(1,4))
set(handles.yc,'String',T04(2,4))
set(handles.zc,'String',T04(3,4))
%C.PLOTEAMOS LOS SITEMAS COORDENADOS
plot_frame(h1,T01);
plot_frame(h2,T02);
plot_frame(h3,T03);
plot_frame(h4,T04);
%DELTA DE TIEMPO
pause(0.3)
end
theta1 = q1d;
theta2 = q2d;
theta3 = q3d;
theta4 = q4d;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%
q1d = str2num(get(handles.textbox4,'String'))*pi()/180;
q2d = str2num(get(handles.textbox5,'String'))*pi()/180;
q3d = str2num(get(handles.textbox6,'String'))*pi()/180;
q4d = str2num(get(handles.textbox7,'String'))*pi()/180;
STEPS=20;
THETA1=linspace(theta1,q1d,STEPS);
THETA2=linspace(theta2,q2d,STEPS);
THETA3=linspace(theta3,q3d,STEPS);
THETA4=linspace(theta4,q4d,STEPS);
%5. Lazo Principal
for i=1:STEPS
%A.Obtenemos Los angulos
theta1=THETA1(i);
theta2=THETA2(i);
theta3=THETA3(i);
theta4=THETA4(i);
%%
m=[theta1 theta2 theta3 theta4]*180/pi();
[m1,m2,m3,m4]=thetas(m(1),m(2),m(3),m(4));
if conectado==1
fwrite(s1,[m1,m2,m3,m4],'uchar');
end
%%
set(handles.th1,'String',theta1*180/pi())
set(handles.th2,'String',theta2*180/pi())
set(handles.th3,'String',theta3*180/pi())
set(handles.th4,'String',theta4*180/pi())
m=[theta1 theta2 theta3 theta4];
disp('m:')
disp(m*180/pi)
%B.Obtenemos Los angulos
A1=my_robot.compute_matrix_A1(theta1);
A2=my_robot.compute_matrix_A2(theta2);
A3=my_robot.compute_matrix_A3(theta3);
A4=my_robot.compute_matrix_A4(theta4);
T01=A1;
T02=A1*A2;
T03=T02*A3;
T04=T03*A4;
set(handles.xc,'String',T04(1,4))
set(handles.yc,'String',T04(2,4))
set(handles.zc,'String',T04(3,4))
%C.PLOTEAMOS LOS SITEMAS COORDENADOS
plot_frame(h1,T01);
plot_frame(h2,T02);
plot_frame(h3,T03);
plot_frame(h4,T04);
%DELTA DE TIEMPO
pause(0.3)
end
theta1 = q1d;
theta2 = q2d;
theta3 = q3d;
theta4 = q4d;