Sie sind auf Seite 1von 5

ANEXO %Inicializamos parametros

this.a1=0; %fijo
this.alpha1=pi/2; %fijo
1. Cdigo del brazo_RRR this.d2=0;
this.alpha2=0;
Para el presente proyecto se cre en this.d3=0;
this.alpha3=0;
primer lugar la clase Robot_RRRR this.d4=0;
que representa un robot de 4 grados this.alpha4=0;
de libertad (articulaciones rotativas) end
function
en donde se mantuvo como set_dimensions(this,L1,L2,L3,L4)
condicin que la estructura final del %Metodo para asignar las
dimensiones
brazo sea paralela al piso (Ver figura this.LL1=L1;
1). this.LL2=L2;
this.LL3=L3;
this.LL4=L4;
%Ponemos Los parametros DH q faltan
this.d1=L1;
this.a2=L2;
this.a3=L3;
this.a4=L4;

end

function

q=cinematica_inversa(this,xc,yc,zc)

%Metodo para la cinematica inversa


L1=this.LL1;
L2=this.LL2;
L3=this.LL3;
Figura 1. Brazo RRRR en Solidworks
L4=this.LL4;

%%%%%%%%%%%%%%%%
classdef robot_RRRR<handle %Angulo "theta 1"
properties q1_star=atan2(yc,xc);
%PARAMETROS MECANICOS %Angulo "theta3"
LL1 r2=xc^2+yc^2;
LL2 r1=sqrt(r2);
LL3 r=r1-L4;
LL4 s=zc-L1;
%PARAMETROS D.H num=r^2+s^2-L2^2-L3^2;
d1 den=2*L2*L3;
a1 D=num/den;
alpha1 if(abs(D)>1)
d2 error('POSICION IMPOSIBLE DE
a2 ALCANZAR')
alpha2 end
d3 q3_star=atan2(-sqrt(1-
a3 D^2),D);
alpha3 q2_star=atan2(s,r)-...
d4
a4 atan2(L3*sin(q3_star),L2+L3*cos(q3_st
alpha4 ar));
end q4_star=-1*(q2_star +
methods q3_star);
% CONSTRUCTOR %Vector de ANgulos
function this= robot_RRRR()
q=[q1_star q2_star q3_star this.alpha1=pi/2; %fijo
q4_star]; this.d2=0;
end this.alpha2=0;
function this.d3=0;
A1=compute_matrix_A1(this,theta1) this.alpha3=0;
%Metodo para hallar A1 this.d4=0;
this.alpha4=0;
A1=matriz_homogenea_DH(theta1,... end

this.d1,this.a1,this.alpha1);
end Cinemtica Inversa del Robot_RRR
function
A2=compute_matrix_A2(this,theta2) A continuacin se presenta la cinemtica
%Metodo para hallar A2 inversa con la condicin que la estructura
final del brazo se mantenga en posicin
A2=matriz_homogenea_DH(theta2,...
horizontal
this.d2,this.a2,this.alpha2);
function
end
q=cinematica_inversa(this,xc,yc,zc)

Articula the d a alp % Metodo para la cinematica inversa


cin ta ha L1=this.LL1;
L2=this.LL2;
1 q1 L1 0 90 L3=this.LL3;
2 q2 0 L2 0 L4=this.LL4;
3 q3 0 L3 0 %%%%%%%%%%%%%%%%
4 q4 0 L4 0 %Angulo "theta 1"
q1_star=atan2(yc,xc);
%Angulo "theta3"
function r2=xc^2+yc^2;
A3=compute_matrix_A3(this,theta3) r1=sqrt(r2);
%Metodo para hallar A3 r=r1-L4;
s=zc-L1;
A3=matriz_homogenea_DH(theta3,... num=r^2+s^2-L2^2-L3^2;
den=2*L2*L3;
this.d3,this.a3,this.alpha3); D=num/den;
end if(abs(D)>1)
function error('POSICION IMPOSIBLE DE
A4=compute_matrix_A4(this,theta4) ALCANZAR')
%Metodo para hallar A3 end
%CODO ARRIBA
A4=matriz_homogenea_DH(theta4,... q3_star=atan2(-sqrt(1-D^2),D);
q2_star=atan2(s,r)-...
atan2(L3*sin(q3_star),L2+L3*cos(q3_st
this.d4,this.a4,this.alpha4); ar));
end q4_star=-1*(q2_star + q3_star);
end %Vector de ANgulos
end q=[q1_star q2_star q3_star q4_star];
end

Cinemtica Directa del Robot_RRR

function this= robot_RRRR()


%Inicializamos parametros
this.a1=0; %fijo
AJUSTE DE SERVOMOTORES

Debido a que los angulos obtenidos con


los servos al ser usados mediante la
plataforma arduino no eran exactos, se
procedio a hacer un ajuste de minimos
cuadrados mediante un script en

matlab.
Resultados de los ajustes

Servo1:

Servo2:

Servo3:

Servo 4

Das könnte Ihnen auch gefallen