Вы находитесь на странице: 1из 19

Brazo robtico de 6 grados de libertad tipo revolucin

Oskar Conislla, Piero Rau, Renzo Salazar


Facultad de Ingeniera Mecnica
Universidad Nacional de Ingeniera
e-mail: oskarconislla20@gmail.com, piero.rau.e@gmail.com, rsalazara@uni.pe

Resumen: En este trabajo se indicarn los pasos seguidos REPRESENTACIN DENAVIT-HARTENBERG


para poder disear un brazo robtico de 6 grados de
libertad, implementndolo de manera econmica mediante Denavit y Hartenberg proponen un modelo matricial
servomotores, planchas de madera MDF y software open- para establecer de forma sistemtica un sistema de
source como lo es Arduino. coordenadas (soldado al cuerpo) para cada elemento de
Cabe recalcar que este trabajo tiene fines acadmicos, es una cadena articulada. D-H resulta en una matriz de
decir, no busca tener una aplicacin definida, sino transformacin homognea de 4x4 que representa cada
simplemente desea implementar, simular y codificar un uno de los sistemas de coordenadas de los elementos de
manipulador robtico RRR, mediante mtodos de la articulacin con respecto al sistema de coordenadas del
cinemtica directa e inversa, adems de otros elemento previo. Mediante transformaciones secuenciales,
fundamentos aplicados a los manipuladores robticos. el efector final expresado en las coordenadas de la mano
Palabras clave: Manipulador robtico, cinemtica, se puede transformar y expresar en las coordenadas de la
servomotores. base.
Las reglas para determinar cada sistema son:
El eje z (i1) yace a lo largo del eje de la
I. INTRODUCCIN articulacin
El eje x(i) es normal al eje z(i1) y apunta hacia
OBJETIVO GENERAL: Implementar un brazo robtico de afuera de l
6 grados de libertad El eje y(i) completa el sistema de coordenadas
dextrogiro segn se requiera
OBJETIVO ESPECFICO: Aplicar algoritmos de robtica La representacin D-H de un elemento rgido depende
para lograr controlar el brazo robtico de 4 parmetros geomtricos asociados con cada
elemento.
CINEMTICA DE UN ROBOT i: ngulo de la articulacin del eje x(i1) al eje x(i)
respecto del eje z(i1)
La cinemtica del robot estudia el movimiento del di: Distancia desde el origen del sistema de
mismo con respecto a un sistema de referencia. As, la coordenadas (i-1)-simo hasta la interseccin del eje z(i1)
cinemtica se interesa por la descripcin analtica del con el eje x(i) a lo largo del eje z(i1).
movimiento espacial del robot como una funcin del ai: Distancia de separacin desde la interseccin del eje
tiempo, y en particular por las relaciones entre la posicin y z(i1) con el eje x(i) hasta el origen del sistema i-simo a lo
la orientacin del extremo final del robot con los valores largo del eje x(i) (o la distancia ms corta entre los ejes
que toman sus coordenadas articulares. z(i1) y z(i) cuando los ejes de articulacin son paralelos)
Existen dos problemas fundamentales a resolver en la i: ngulo de separacin del eje z(i1) al eje z(i)
cinemtica del robot; el primero de ellos se conoce como el respecto del eje x(i)
problema cinemtico directo, y consiste en determinar cual
es la posicin y orientacin del extremo final del robot, con
respecto a un sistema de coordenadas que se toma como
referencia, conocidos los valores de las articulaciones y los
parmetros geomtricos de los elementos del robot; el
segundo, denominado problema cinemtico inverso,
resuelve la configuracin que debe adoptar el robot para
una posicin y orientacin del extremo conocidas.

Figura 2. Asignacin de parmetros cinemticos segn


Figura 1. Relacin entre cinemtica directa e inversa Denavit-Hartenberg
MATRIZ JACOBIANA El brazo cuenta con una base, unida a un servomotor tipo
MG996R, dndole un giro alrededor del eje vertical. El
El modelado cinemtico de un robot busca las relaciones eslabn principal, el brazo, est impulsado por 2 de estos
entre las variables articulares y la posicin-orientacin del servomotores. El antebrazo tambin tendr otros dos
robot. En esta relacin no se tienen en cuenta las fuerzas o servos, aadiendo un grado de libertad de revolucin en su
pares que actan sobre el robot. El sistema de control del unin con el brazo y otro con la mueca que sostiene el
robot debe establecer qu velocidades debe imprimir a gripper.
cada articulacin para conseguir que el extremo desarrolle El gripper cuenta con 2 microservos, tipo SG90 9 g, que le
una trayectoria temporal concreta. dan movilidad para girar con respecto al eje del antebrazo
A la relacin entre las velocidades de las coordenadas y para poder abrir sus garras, mediante un mecanismo de
articulares y las de posicin y orientacin del extremo del engranajes.
robot se le denomina matriz jacobiana.
IMPLEMENTACIN
MODELAMIENTO DINMICO POR EULER-LAGRANGE Para llevar a cabo este proyecto se compraron diversos
materiales, los cuales se mostrarn a continuacin:
Se obtiene la energa cintica total del sistema y la
energa potencial total del sistema. Tabla 1. Lista de materiales utilizados en el proyecto
K(q,q)= K1(q,q)+ K2(q,q)++ Ki(q,q) (1)
U(q)= U1(q)+ U2(q)++ Ui(q) (2) Nombre Uso Cantidad
MG996R Servomotor 5
Se obtiene el Lagrangiano del sistema, que viene a SG90 9 g Microservo 2
estar definido por: Arduino Microcontrolador 1
L(q,q)=K(q,q)-U(q) (3) LEONARDO
Madera MDF Material utilizado 1 plancha
Se desarrolla la ecuacin de disipacin: (50x35)
F=F1(q1)+F2(q2)++Fi(qi) (4) Jumpers Unin de comp. 25 aprox
Fuente de 12v Alimentacin 1
Ahora podemos desarrollar la ecuacin de movimiento Elem. unin Acople mecnico 40 aprox
de Euler-Lagrange, quedando: Protoboard Soporte 1

Mediante corte lser aplicado en la madera, obtuvimos las


(5) piezas a utilizar para el brazo robtico, que se muestran en
la figura 4.
II. PLANTEAMIENTO DEL PROBLEMA

DISEO MECNICO

Se trabaj en base a un diseo encontrado en lnea para


un brazo robtico tipo revolucin con gripper, diseado en
Solidwords, como se muestra en la figura 3.

Figura 4. Piezas a enviar a cortar

Una vez obtenidas las piezas, el grupo se reuni para la


implementacin. En esta fase colocamos los servos,
comprobando que sus giros se diesen de forma adecuada;
unimos las piezas mediante tornillos y tuercas, asegurando
un buen ajuste entre los eslabones. Finalizando con las
respectivas pruebas utilizando el cdigo en Matlab y
controlado mediante Arduino.

Figura 3. Isomtrico del brazo robtico en Solidworks


Figur
a 7. Esquema del brazo robtico en el que se indican los
sistemas coordenados

Tabla 2. Parmetros Denevit-Hartenberg

Punto i di ai i
1 1 d1 0 90
Figura 5. Equipo realizando la implementacin 2 2+90 0 a2 0
3 3-90 0 a3 0
4 4+90 0 a4 90
5 5 d5 0 0
6 GRIPPER 0 0 0

Con esto generamos las matrices de transformacin para


cada punto, con el objetivo de poder trabajar en cualquiera
de los puntos. Hallamos las matrices de la cinemtica
directa, obteniendo lo que se muestra a continuacin:

Figura 8. Matrices DH obtenidas

Ahora hallamos la posicin final, multiplicando todas las


matrices en orden creciente, pero sin tener en cuenta el
gripper.

Figura 6. Brazo implementado, pero sin alimentar

III. MODELAMIENTO MATEMTICO

CINEMTICA DIRECTA Figura 9. Matriz obtenida entre el punto de referencia y el


gripper
Para poder llevar a cabo este proyecto, debemos definirlos
parmetros D-H, segn la tabla 2, apoyndonos en el CINEMTICA INVERSA
grfico de la figura 7.
Para esta parte, nos conviene girar pequeos ngulos a los
eslabones y analizar los ngulos a partir de las
dimensiones del brazo y la posicin final del brazo,
supuestamente conocida y a la cual le daremos las
coordenadas (xd, yd, zd).
Tomando como referencia la figura 7, nos conviene iniciar
en el plano xy, para obtener el primer ngulo, quedando la
vista mostrada en la figura 10. Mediante trigonometra:

Siendo estas ecuaciones las que necesitamos para


relacionarlas a la posicin final. Ahora determinemos 2 y
3, pero primero hallaremos , y s a partir de la figura 11,
utilizando la ley de cosenos:
Figura 10. Vista del brazo en el plano xy

Ntese que la dimensin d viene a ser una componente del


radio vector que describe a la posicin final.
Tambin podemos notar con bastante facilidad que:

Con estos valores intermedios se pueden determinar los


valores finales.
Adems, se tiene que la distancia radial especfica
de la base d se relaciona con xd e yd por:

Es comn en cinemtica inversa tener varias soluciones,


esto debido a las mltiples posiciones que puede tomar el
brazo para llegar a un punto comn, explicndose as la
Ahora debemos hallar los ngulos restantes, para razn por la que 2 puede tomar dos valores y, a partir de
ello nos apoyaremos en la figura 11, que muestra el ello, variar las dems soluciones.
plano rz, siendo r un componente radial.
Analizando el caso de las 3 primeras articulaciones:

Para la primera articulacin:

Figura 12. Diagrama para la articulacin 1


Figura 11. Vista del plano rz Siendo R la distancia desde el origen hasta la posicin, se
cumple:
Podemos hallar 2, 3 de manera similar a como se hace
en un caso de dos grados de libertad, pero para hacer
esto, debemos de hallar una expresin matemtica para
las coordenadas del punto 4. Para empezar, hallamos la
relacin entre los ngulos de unin 2, 3, 4 y , Como
sigue:

Para un determinado, se puede calcular la distancia


radial y la altura de la unin de la mueca, es decir, el
punto 4:
Para la segunda articulacin
Para la resolucin de la segunda articulacin, se ha de
tener en cuenta la posibilidad de CODO ARRIBA y CODO
ABAJO. En cada caso el ngulo 2 se calcular como la
suma o la resta de los ngulos y calculados
Ahora analizaremos las articulaciones 4, 5 y 6. Iniciando
por la 4. Para conocer el signo de la ecuacin se utiliza:

Se determina conociendo la orientacin y la


configuracin de MUECA; se calcula segn su
definicin, y MUECA es un parmetro del robot.

Se parte de la suposicin de que el signo es positivo, y


esta hiptesis se corrige con el parmetro M que se calcula
Figura 13. Posibles configuraciones para la articulacin 2 como combinacin de la configuracin de la mueca y la
orientacin requeridas.
De manera similar al caso anterior:
De esta manera se obtiene:

Figura 15. Parmetros obtenidos para la articulacin 4

Repetimos la operacin para las otras 2 articulaciones:

Para la quinta articulacin


Tenindose las siguientes 2 soluciones:

Para la tercera articulacin:


Figura 16. Parmetros obtenidos para la articulacin 5
Al igual que en la articulacin 2, se debe tener en cuenta
las dos posibles configuraciones del codo.
As, finalmente, para la sexta articulacin:

Figura 17. Parmetros obtenidos para la articulacin 6

Figura 14. Posibles configuraciones para la articulacin 3 CINEMTICA DIFERENCIAL


con su respectiva solucin
El objetivo en esta parte es obtener el Jacobiano, es decir,
aquellas matrices que describen tanto la velocidad lineal
Para analizar las configuraciones de la mueca (caso como la angular.
arriba y caso abajo), se utiliza un parmetro de orientacin
que hace referencia a la orientacin del vector unitario n (o A partir de las ecuaciones:
s) con respecto al vector unitario x 5 (o y5) y que viene
definido en la referencia como
G. Obtener los trminos hikm definidos por:

Podemos hallar el Jacobiano mediante algunas relaciones


cinemticas ya conocidas. Con: i,k,m: 1,2,n

H. Obtener la matriz columna de fuerzas de coriolis y


centrpeta H=[hj]T cuyos elementos vienen
definidos por

I. Obtener la matriz columna de fuerzas de


gravedad C = [ci]T cuyos elementos estn
definidos por:
Figura 18. Jacobiano de velocidad lineal obtenido para este
caso

i = 1,2,..,n
g : es el vector de gravedad expresado en el
sistema de la base {S0} y viene expresado por
(gx0,gy0,gz0,0)
rj : es el vector de coordenadas homognea del
Figura 19. Jacobiano de velocidad angular obtenido para centro de masas del elemento j expresado en el
este caso sistema de referencia del elemento i.
J. La ecuacin dinmica del sistema ser:
DINMICA DE LAGRANGE

Algoritmo computacional para el modelado dinmico de Donde T es el vector de fuerzas y pares motores
Lagrange-Euler. efectivos aplicados sobre cada coordenada qi.

A. Asignar a cada eslabn un sistema de referencia INTERFAZ EN GUIDE (MATLAB)


de acuerdo a las normas de D-H. Se ha realizado una interfaz en Guide(MATLAB) con el fin
B. Obtener las matrices de transformacin A para de que el manejo del brazo robtico se haga de manera
cada elemento i. sencilla.
C. Obtener las matrices Uij definidas por:

D. Obtener las matrices Uijk

E. Obtener las matrices de pseudoinercias J i para


cada elemento, que vienen definidas por:

Figura 20. Interfaz en Guide.

La interfaz consta de 4 bloques:


Cinemtica Directa:
Donde las inercias estn extendidas al elemento i Se ha utilizado un editText para el ingreso de cada angulo,
considerado, y(xi,yi,zi) son las coordenadas del con un botn para su ejecucin de la cinematica directa.
diferencial de masa dm respecto al sistema de
coordenadas del elemento.

F. Obtener la matriz de inercias D=[dij] cuyos


elementos vienen definidos por:

Figura 21. Muestra la parte de cinematica directa en guide.


Con: i,j=1,2,,n n:Nmeros de grados de
libertad Cinematica Inversa:
Se ha utilizado un editText para cada coordenada con un ser fcilmente reemplazados por otro material, segn
botn para su ejecucin de la cinematica directa. Ademas el propsito para el que se le quiera. En nuestro caso,
se ha colocado un RadioBoton para seleccionar si se se ha desarrollado con fines meramente acadmicos,
desea realizar una lnea recta en la trayectoria o no. por lo que se opt por madera siendo esta barata y
buena resistencia; sin embargo, no se descarta la
posibilidad de utilizar plstica u otro similar.

Se consigui aplicar los conocimientos obtenidos en


clases, tales como la teora de cinemtica directa e
inversa, o la dinmica de Euler y Lagrange. Estos
conocimientos se vincularon con lo aprendido en el
laboratorio, usando software como Arduino y Matlab
se logr manipular el brazo robtico segn los
requerimientos, adems me permitirnos simular los
Figura 22. Muestra la parte de cinemtica inversa en guide.
resultados esperados.
Conexin arduino: El xito de la implementacin se debe a diversas
Se ha utilizado un editText para ingresar el nmero del
consideraciones hechas por los alumnos, como
puerto serial donde se enviara las seales y un RadioBoton
aproximar la funcin de rozamiento o considerar el
para realizar la conexin.
peso adicional que otorgan los servos y microservos a
nuestro diseo, evitando as que el brazo no funcione
debido a la falta de potencia frente a una carga
superior a la esperada.

El uso de software de simulacin facilit la obtencin


de buenos resultados, adems de simplificar los
clculos de sobremanera; esto se dice porque se
Figura 23. Muestra la conexin al arduino en guide. puede aplicar el mtodo matricial (Jacobiano) en lugar
de realizar tediosas operaciones, como es el caso de
Simulacin: Lagrange.
Se ha utilizado un Axes para graficar la simulacin del
brazo robotico. RECOMENDACIONES

El diseo del manipulador robtico pudo haber sido


tedioso, pues se debe de tener en cuanto muchas
consideraciones; sin embargo, se pudo obtener un
diseo que se ajuste a nuestras necesidades en la
red, ahorrndonos valioso tiempo en el desarrollo del
proyecto.

La alimentacin de los servomotores debe ser con


una fuente de buen amperaje, pues si no suministra la
corriente adecuada, no generar el torque suficiente
para levantarse. De ser posible, usar al menos 2
fuentes al ponerlo en operacin.

Se debe de obtener los materiales y complementos a


partir de un equilibrio entre beneficios y costos, es
Figura 24. Muestra el ploteo de los ejes coordenados en la decir, no vamos a utilizar como material a utilizar
simulacin. acero inoxidable, debido a que es ms caro que la
madera MDF y nuestro modelo no requiere de tal
material, pues su fin es solo acadmico. Otro caso
dado es el del servo, pues se necesita una con un
torque necesario, no excesivo, pues si aumenta el
torque, tambin lo har el precio.

Los componentes de unin deben de estar bien


IV. CONCLUSIONES Y RECOMENDACIONES ajustados para evitar rozamientos o balanceos
innecesarios. Asegurar, sobre todo, las uniones entre
CONCLUSIONES los servos y el brazo, pues puede darse el caso en el
que el servo gire, pero la estructura no gire con l.
Se logr desarrollar un modelo de un manipulador
robtico industrial de bajo costo, con materiales de V. BIBLIOGRAFA
fcil obtencin en el mercado local, pero que pudieron
[1] Barrientos Antonio, Pein Luis Felipe, Balaguer Carlos, my_servo_02.write(angle_02);
Aracil Rafael, Fundamentos de robtica Universidad my_servo_03.write(angle_03);
Politcnica de Madrid my_servo_04.write(angle_04);
[2] K.S. Fu,R.C. Gonzales, C. S. G. delay(20);
Lee,Robotics:Sensing,Control, Visin, and Intellengence
Mc Graw Hill
}
[3]Mark W. Spong, Set Hutchinson, M. Vidsayagar,Robot }
Modeling and control
ANEXO B
Codigo Matlab:
ANEXO
Matriz D-H
ANEXO A function
Codigo Arduino: [A]=matriz_homogenea_DH(theta,d,a,alpha
);
#include <Servo.h> if(nargin<4)
//-----------------------------------// error('matriz_homogenea_DH: Numero
//2. RUTINA DE CONFIGURACION insuficiente de parametros')
// end
Servo my_servo_01; //Objeto myservo para manejar % Creacion Matriz homogenea
el servomotor %2.1 Variables auxiliares
Servo my_servo_02; ct=cos(theta);
Servo my_servo_03; st=sin(theta);
Servo my_servo_04; ca=cos(alpha);
int my_servo_PIN_01=6; sa=sin(alpha);
int my_servo_PIN_02=9; %2.2
int my_servo_PIN_03=10; %Verifiamos "alpha"
int my_servo_PIN_04=11; if(alpha==pi/2)
ca=0;
//int angle; sa=1;
//-----------------------------------// elseif(alpha==-pi/2)
//2. RUTINA DE CONFIGURACION ca=0;
//------------------------------------// sa=-1;
void setup() { end
// put your setup code here, to run once:
my_servo_01.attach(my_servo_PIN_01); if(theta==pi/2)
my_servo_01.write(0); ct=0;
//Se le puede colocar distintas caracteristicas de st=1;
acuerdo a la marca del servommotror elseif(theta==-pi/2)
my_servo_02.attach(my_servo_PIN_02); ct=0;
my_servo_02.write(0); st=-1;
my_servo_03.attach(my_servo_PIN_03); end
my_servo_03.write(180); A=[ct -st*ca st*sa a*ct; st ct*ca
my_servo_04.attach(my_servo_PIN_04); -ct*sa a*st;0 sa ca d; 0 0 0 1];
my_servo_04.write(0); end

delay(1000);
//Activa el puerto serial Ploteo de coordenadas:
Serial.begin(9600); function hout = plot_frame(T,varargin)
} % plot_frame Plot the frame of a 3D
transformation
void loop() { %
// put your main code here, to run repeatedly: % PLOT_FRAME(T, OPTIONS) draws a 3D
if(Serial.available()==4) coordinate frame represented by the
{//A. Leemos el byte enviado % SE(3) homogeneous transform T(4x4).
int angle_01=Serial.read(); // Se lee el valor %
int angle_02=Serial.read(); // Se lle valor uchar % Author: Ivan A. Calle
int angle_03=Serial.read(); // Se lee el valor Flores(icallef@uni.pe)
int angle_04=Serial.read(); // Se lle valor uchar
//B. enviamos el angulo al serrvomotor %--------------------------------------
my_servo_01.write(angle_01); --------------------------------%
% 1. INITIAL CONFIGURATION line(o,y1,o,'Color',
%-------------------------------------- opt.color,'linewidth',3,'Parent', hg)
--------------------------------% line(o,o,z1,'Color',
% 1.1. CHECK FOR THE CASE "trplot(H, opt.color,'linewidth',3,'Parent', hg)
T)" end
if isscalar(T) && ishandle(T)
% Set handle and transformation % 2.3. NOW PLACE THE FRAME IN THE
matrix DESIRED POSE
H = T; set(hg, 'Matrix', T);
T = varargin{1};
% Check for basic rotation matrices
if(size(T,1)==3 && size(T,2)==3) %--------------------------------------
T = [T zeros(3,1); zeros(1,3) --------------------------------%
1]; % 3. ADD EXTRA STUFF TO THE AXES
end %--------------------------------------
% Update Frame --------------------------------%
set(H, 'Matrix', T); % 3.1. LABEL THE AXES
return; if isempty(opt.frame)
end fmt = '%c';
else
% 1.2. CREATE A 'hgtransform' GRAPHICS fmt = sprintf('%%c_{%s}',
OBJECT TO HANDLE ALL THE AXES opt.frame);
hax = gca; end
hg = hgtransform('Parent', hax); % -> Put the labels 'Xi, Yi'
hold on text(x1(1), x1(2), x1(3), sprintf(fmt,
'X'), 'Parent', hg,....
% 1.3. SET VECTOR OF OPTIONS 'FontWeight', 'bold', 'FontSize',
% -> Default values 14);
opt.color = 'b'; text(y1(1), y1(2), y1(3), sprintf(fmt,
opt.axes = true; 'Y'), 'Parent', hg,...
opt.axis = []; 'FontWeight', 'bold', 'FontSize',
opt.frame = []; 14);
opt.view = []; text(z1(1), z1(2), z1(3), sprintf(fmt,
opt.width = 1; 'Z'), 'Parent', hg,...
opt.handle = []; 'FontWeight', 'bold', 'FontSize',
% -> Parse the vector 14);
opt = tb_optparse(opt, varargin);
% 3.2. LABEL THE NUMBER OF THE FRAME
% 1.4. CHECK FOR ROTATION MATRICES AT THE ORIGIN
if(size(T,1)==3 && size(T,2)==3) text(o(1)-0.04*x1(1), o(2)-0.04*y1(2),
T = [T zeros(3,1); zeros(1,3) 1]; ['\{' opt.frame '\}'], 'Parent', hg);
end
% 3.3. SET 'VIEWPOINT'
if ischar(opt.view) && strcmp(opt.view,
%-------------------------------------- 'auto')
--------------------------------% cam = x1+y1+z1;
% 2. DRAW THE AXES view(cam(1:3));
%-------------------------------------- elseif ~isempty(opt.view)
--------------------------------% view(opt.view);
% 2.1. CREATE UNIT VECTORS end
o = [0 0 0]';
x1 = [1 0 0]';
y1 = [0 1 0]'; %--------------------------------------
z1 = [0 0 1]'; --------------------------------%
% 4. RETURN HANDLE
% 2.2. DRAW THE NORMAL AXES AND ATTACH %--------------------------------------
THEM TO THE GROUP --------------------------------%
for i=1:3 if nargout > 0
line(x1,o,o,'Color', hout = hg;
opt.color,'linewidth',3,'Parent', hg) end
%Ponemos Los parametros DH
end % END FUNCTION q faltan
this.d1=L1;
this.a2=L2;
this.a3=L3;
this.a4=L4;

end
function
q=cinematica_inversa(this,xc,yc,zc)
Clase robot_RRRR %Metodo para la cinematica
inversa
classdef robot_RRRR<handle L1=this.LL1;
%ROBOT PLANAR L2=this.LL2;
L3=this.LL3;
L4=this.LL4;
properties
%PARAMETROS MECANICOS %%%%%%%%%%%%%%%%
LL1 %Angulo "theta 1"
LL2 q1_star=atan2(yc,xc);
LL3 %Angulo "theta3"
LL4 r2=xc^2+yc^2;
%PARAMETROS D.H r1=sqrt(r2);
d1 r=r1-L4;
a1 s=zc-L1;
alpha1 num=r^2+s^2-L2^2-L3^2;
d2 den=2*L2*L3;
a2 D=num/den;
alpha2 if(abs(D)>1)
d3 error('POSICION IMPOSIBLE
a3 DE ALCANZAR')
alpha3 end
d4 q3_star=atan2(+sqrt(1-D^2),D);
a4 q2_star=atan2(s,r)-...
alpha4
end atan2(L3*sin(q3_star),L2+L3*cos(q3_star
));
methods q4_star=-1*(q2_star + q3_star);
% CONSTRUCTOR %Vector de ANgulos
function this= robot_RRRR() q=[q1_star q2_star q3_star
%Inicializamos parametros q4_star];
this.a1=0; %fijo end
this.alpha1=pi/2; %fijo function
this.d2=0; A1=compute_matrix_A1(this,theta1)
this.alpha2=0; %Metodo para hallar A1
this.d3=0;
this.alpha3=0; A1=matriz_homogenea_DH(theta1,...
this.d4=0;
this.alpha4=0; this.d1,this.a1,this.alpha1);
end end
function
set_dimensions(this,L1,L2,L3,L4) function
%Metodo para asignar las A2=compute_matrix_A2(this,theta2)
dimensiones %Metodo para hallar A2
this.LL1=L1;
this.LL2=L2; A2=matriz_homogenea_DH(theta2,...
this.LL3=L3;
this.LL4=L4; this.d2,this.a2,this.alpha2);
end
%Angulo enviado al arduino
function ang_servo0y=[25 30 40 50 60 70 80 90
A3=compute_matrix_A3(this,theta3) 100 110 120 130 140 150 160 170 180];
%Metodo para hallar A3 %Angulo de trabajo
ang_servo0x=[0 10 20 30 40 50 60 70 80
A3=matriz_homogenea_DH(theta3,... 90 95 100 110 120 130 140 150];
%Angulo enviado al arduino
this.d3,this.a3,this.alpha3); ang_servo1y=[16 25 36 46 56 66 76 86 96
end 106 116 126 136 146 156];
%Angulo de trabajo
function
A4=compute_matrix_A4(this,theta4) ang_servo1x=[-2 15 25 40 50 60 70 80
%Metodo para hallar A3 100 115 120 130 145 155 170];
%Angulo enviado al arduino
ang_servo2y=[0 10 20 30 40 50 60 70 80
A4=matriz_homogenea_DH(theta4,...
90 100 110 120 130 140 150 160 170
180];
this.d4,this.a4,this.alpha4); %Angulo de trabajo
end ang_servo2x=[-20 -15 0 10 25 35 45 60
end 70 80 100 110 120 130 142 155 165 180
end 190];
%Angulo enviaado al arduino
Cinemtica Inversa: ang_servo3y=[30 40 50 60 70 80 90 100
El codigo busca que el actuador final se mantenga en 110 120 130 140 150 154 160 180];
direccion horizontal. %Angulo de trabajo
function q=cinematica_inversa(this,xc,yc,zc) ang_servo3x=[140 135 125 115 105 90 82
70 60 48 32 20 10 -8 -20 -30];
% Metodo para la cinematica inversa
L1=this.LL1;
P0=polyfit(ang_servo0x,ang_servo0y,2);
L2=this.LL2; P1=polyfit(ang_servo1x,ang_servo1y,2);
L3=this.LL3; P2=polyfit(ang_servo2x,ang_servo2y,2);
L4=this.LL4; P3=polyfit(ang_servo3x,ang_servo3y,2);
theta1=polyval(P0,ang_1);
%%%%%%%%%%%%%%%% theta2=polyval(P1,ang_2);
%Angulo "theta 1" theta3=polyval(P2,ang_3);
q1_star=atan2(yc,xc); theta4=polyval(P3,ang_4);
%Angulo "theta3"
r2=xc^2+yc^2;
r1=sqrt(r2); if(ang_1>0 && ang_1<20)
r=r1-L4; theta1=30;
s=zc-L1; end
num=r^2+s^2-L2^2-L3^2; if(ang_2>0 && ang_2<25)
den=2*L2*L3; theta1=25;
D=num/den; end
if(abs(D)>1) Codigo de interfaz (GUIDE)
error('POSICION IMPOSIBLE DE ALCANZAR') function varargout =
end Brazo_UNI(varargin)
%CODO ARRIBA
% BRAZO_UNI MATLAB code for
q3_star=atan2(-sqrt(1-D^2),D);
q2_star=atan2(s,r)-... Brazo_UNI.fig
atan2(L3*sin(q3_star),L2+L3*cos(q3_star)); % BRAZO_UNI, by itself, creates a
q4_star=-1*(q2_star + q3_star); new BRAZO_UNI or raises the existing
%Vector de ANgulos % singleton*.
q=[q1_star q2_star q3_star q4_star]; %
end % H = BRAZO_UNI returns the handle
to a new BRAZO_UNI or the handle to
Ajuste de servomotores: % the existing singleton*.
Ya que se observaba un desfasaje entre el angulo que se %
le mandaba al arduino y el ngulo de trabajo real. Se opt %
por hacer un ajuste usando la funcin polyval de matlab
BRAZO_UNI('CALLBACK',hObject,eventData,
para cada angulo , colocando todo esto en la funcin
thetas.
handles,...) calls the local
function [theta1,theta2, % function named CALLBACK in
theta3,theta4]=thetas(ang_1,ang_2,ang_3 BRAZO_UNI.M with the given input
,ang_4) arguments.
%
% function Brazo_UNI_OpeningFcn(hObject,
BRAZO_UNI('Property','Value',...) eventdata, handles, varargin)
creates a new BRAZO_UNI or raises the % This function has no output args, see
% existing singleton*. Starting OutputFcn.
from the left, property value pairs are % hObject handle to figure
% unrecognized property name or % eventdata reserved - to be defined
invalid value makes property in a future version of MATLAB
application % handles structure with handles and
% stop. All inputs are pa% user data (see GUIDATA)
applied to the GUI before % varargin command line arguments to
Brazo_UNI_OpeningFcn gets called. An Brazo_UNI (see VARARGIN)
%ssed to Brazo_UNI_OpeningFcn via
varargin.com % Choose default command line output
% for Brazo_UNI
% *See GUI Options on GUIDE's handles.output = hObject;
Tools menu. Choose "GUI allows only
one % Update handles structure
% instance to run (singleton)". guidata(hObject, handles);
%
% See also: GUIDE, GUIDATA, GUIHANDLES % UIWAIT makes Brazo_UNI wait for user
response (see UIRESUME)
% Edit the above text to modify the % uiwait(handles.figure1);
response to help Brazo_UNI

% Last Modified by GUIDE v2.5 19-Nov- % --- Outputs from this function are
2016 16:52:05 returned to the command line.
function varargout =
% Begin initialization code - DO NOT Brazo_UNI_OutputFcn(hObject, eventdata,
EDIT handles)
gui_Singleton = 1; % varargout cell array for returning
gui_State = struct('gui_Name', output args (see VARARGOUT);
mfilename, ... % hObject handle to figure
'gui_Singleton', % eventdata reserved - to be defined
gui_Singleton, ... in a future version of MATLAB
'gui_OpeningFcn', % handles structure with handles and
@Brazo_UNI_OpeningFcn, ... user data (see GUIDATA)
'gui_OutputFcn',
@Brazo_UNI_OutputFcn, ... % Get default command line output from
'gui_LayoutFcn', [] handles structure
, ... varargout{1} = handles.output;
'gui_Callback', %%
[]); axes(handles.axes1);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = %----------------------------%
str2func(varargin{1}); % 1.CONFIGURACION INICIAL
end %---------------------------%
%1.1 Posicion deseada
if nargout xc=3;
[varargout{1:nargout}] = yc=0;
gui_mainfcn(gui_State, varargin{:}); zc=2;
else %1.2 Ploteo del entorno
gui_mainfcn(gui_State, T0=eye(4);
varargin{:}); plot_frame(T0,'color','k','view','auto'
end );
% End initialization code - DO NOT EDIT axis([-2 4 -2 4 0 3])
hold on
grid on
% --- Executes just before Brazo_UNI is xlabel('x(m)')
made visible. ylabel('y(m)')
plot3(xc,yc,zc,'ro','MarkerFaceColor',' %4.2 Eslabon4
k','MarkerSize',10) %->Hallamos A4
%--------------------------------- theta4=0;
%2.Parametros Mecanicos Del Robot A4=my_robot.compute_matrix_A4(theta4);
%-------------------------------- %Ploteamos
L1=0.3; T04=T03*A4;
L2=1.2; h4=plot_frame(T04,'frame','4','color','
L3=1.25; b');
L4=1.54;
global my_robot set(handles.xc,'String',T04(1,4))
my_robot=robot_RRRR; set(handles.yc,'String',T04(2,4))
my_robot.set_dimensions(L1,L2,L3,L4) set(handles.zc,'String',T04(3,4))
%--------------------%
%3.CINEMATICA INVERSA global conectado
%--------------------% conectado = 0;
%3.1 UISAMOS EL METODO global linea
"cinemtica_inversa" linea = 0;
% axes(handles.axes2);
q=my_robot.cinematica_inversa(xc,yc,zc) hold on;
; I=imread ('uni.jpg');
% q1d=q(1); image(I);
% q2d=q(2);
% q3d=q(3); % --- Executes on button press in
% q4d=q(4); pushbutton1.
% %3.2Salidas function pushbutton1_Callback(hObject,
% disp('Angulos') ~, handles)
% disp(q) % hObject handle to pushbutton1 (see
% disp(q*180/pi) GCBO)
%----------------% % eventdata reserved - to be defined
%4.1 Eslabon 1 in a future version of MATLAB
%->Hallamos A1 % handles structure with handles and
global theta1 theta2 theta3 theta4 user data (see GUIDATA)
global h1 h2 h3 h4 xc =
theta1=0; str2num(get(handles.textbox1,'String'))
A1=my_robot.compute_matrix_A1(theta1); ;
%Ploteamos yc =
T01=A1; str2num(get(handles.textbox2,'String'))
h1=plot_frame(T01,'frame','1','color',' ;
r'); zc =
str2num(get(handles.textbox3,'String'))
;
%4.2 Eslabon2 %plot3(xc, yc, zc, 'ro',
%->Hallamos A2 'MarkerFaceColor', 'k',
theta2=0; 'MarkerSize',3);
A2=my_robot.compute_matrix_A2(theta2); global my_robot
%Ploteamos
T02=T01*A2; %. Cinematica Inversa
h2=plot_frame(T02,'frame','2','color',' %--------------------------------------
m'); -----------------------------------%
% 3.1. Usamos el Metodo " Cinematica_
Ivarsa"
%4.2 Eslabon3 q = my_robot.cinematica_inversa(xc, yc,
%->Hallamos A3 zc);
theta3=0; q1d = q(1);
A3=my_robot.compute_matrix_A3(theta3); q2d = q(2);
%Ploteamos q3d = q(3);
T03=T02*A3; q4d = q(4);
h3=plot_frame(T03,'frame','3','color',' % 3.2. Salidas
b'); % disp('angulos')
% disp(q)
% disp(q*180/pi) m=[theta1 theta2 theta3
% qc = q*180/pi; theta4]*180/pi();
%
% set(handles.th1,'String',qc(1)) [m1,m2,m3,m4]=thetas(m(1),m(2),m(3),m(4
% set(handles.th2,'String',qc(2)) ));
% set(handles.th3,'String',qc(3)) if conectado==1
% set(handles.th3,'String',qc(4)) fwrite(s1,
[m1,m2,m3,m4],'uchar');
end

global theta1 theta2 theta3 theta4


global h1 h2 h3 h4 m=[theta1 theta2 theta3
global conectado theta4];
global s1 %B.Obtenemos Los angulos
global linea
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% A1=my_robot.compute_matrix_A1(theta1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if linea ==1 A2=my_robot.compute_matrix_A2(theta2);
x0 =
str2num(get(handles.xc,'String')); A3=my_robot.compute_matrix_A3(theta3);
y0 =
str2num(get(handles.yc,'String')); A4=my_robot.compute_matrix_A4(theta4);
z0 =
str2num(get(handles.zc,'String')); T01=A1;
%delete(h); T02=A1*A2;
h = line([x0 xc],[y0 yc],[z0 T03=T02*A3;
zc],'LineWidth',2.0) T04=T03*A4;
STEPS=20;
X=linspace(x0,xc,STEPS); set(handles.xc,'String',T04(1,4))
Y=linspace(y0,yc,STEPS);
Z=linspace(z0,zc,STEPS); set(handles.yc,'String',T04(2,4))

%5. Lazo Principal set(handles.zc,'String',T04(3,4))


%C.PLOTEAMOS LOS SITEMAS
for i=1:STEPS COORDENADOS
%A.Obtenemos Los angulos plot_frame(h1,T01);
q = plot_frame(h2,T02);
my_robot.cinematica_inversa(X(i), Y(i), plot_frame(h3,T03);
Z(i)); plot_frame(h4,T04);
theta1 = q(1);
theta2 = q(2); %DELTA DE TIEMPO
theta3 = q(3); pause(0.1)
theta4 = q(4); end
% theta1=THETA1(i); else
% theta2=THETA2(i); %5.2Definimos los angulos
% theta3=THETA3(i); STEPS=20;
% theta4=THETA4(i); THETA1=linspace(theta1,q1d,STEPS);
THETA2=linspace(theta2,q2d,STEPS);
THETA3=linspace(theta3,q3d,STEPS);
set(handles.th1,'String',theta1*180/pi( THETA4=linspace(theta4,q4d,STEPS);
)) %5. Lazo Principal

set(handles.th2,'String',theta2*180/pi( for i=1:STEPS


)) %A.Obtenemos Los angulos
theta1=THETA1(i);
set(handles.th3,'String',theta3*180/pi( theta2=THETA2(i);
)) theta3=THETA3(i);
theta4=THETA4(i);
set(handles.th4,'String',theta4*180/pi(
))
function textbox1_Callback(hObject,
set(handles.th1,'String',theta1*180/pi( eventdata, handles)
)) % hObject handle to textbox1 (see
GCBO)
set(handles.th2,'String',theta2*180/pi( % eventdata reserved - to be defined
)) in a future version of MATLAB
% handles structure with handles and
set(handles.th3,'String',theta3*180/pi( user data (see GUIDATA)
))
% Hints: get(hObject,'String') returns
set(handles.th4,'String',theta4*180/pi( contents of textbox1 as text
)) %
m=[theta1 theta2 theta3 str2double(get(hObject,'String'))
theta4]*180/pi(); returns contents of textbox1 as a
double
[m1,m2,m3,m4]=thetas(m(1),m(2),m(3),m(4
));
if conectado==1 % --- Executes during object creation,
fwrite(s1, after setting all properties.
[m1,m2,m3,m4],'uchar'); function textbox1_CreateFcn(hObject,
end eventdata, handles)
% hObject handle to textbox1 (see
GCBO)
m=[theta1 theta2 theta3 % eventdata reserved - to be defined
theta4]; in a future version of MATLAB
%B.Obtenemos Los angulos % handles empty - handles not
created until after all CreateFcns
A1=my_robot.compute_matrix_A1(theta1); called

A2=my_robot.compute_matrix_A2(theta2); % Hint: edit controls usually have a


white background on Windows.
A3=my_robot.compute_matrix_A3(theta3); % See ISPC and COMPUTER.
if ispc &&
A4=my_robot.compute_matrix_A4(theta4); isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'
T01=A1; ))
T02=A1*A2;
T03=T02*A3; set(hObject,'BackgroundColor','white');
T04=T03*A4; end

set(handles.xc,'String',T04(1,4))

set(handles.yc,'String',T04(2,4)) function textbox2_Callback(hObject,


eventdata, handles)
set(handles.zc,'String',T04(3,4)) % hObject handle to textbox2 (see
%C.PLOTEAMOS LOS SITEMAS GCBO)
COORDENADOS % eventdata reserved - to be defined
plot_frame(h1,T01); in a future version of MATLAB
plot_frame(h2,T02); % handles structure with handles and
plot_frame(h3,T03); user data (see GUIDATA)
plot_frame(h4,T04);
% Hints: get(hObject,'String') returns
%DELTA DE TIEMPO contents of textbox2 as text
pause(0.1) %
end str2double(get(hObject,'String'))
end returns contents of textbox2 as a
theta1 = q1d; double
theta2 = q2d;
theta3 = q3d;
theta4 = q4d;
% --- Executes during object creation, get(0,'defaultUicontrolBackgroundColor'
after setting all properties. ))
function textbox2_CreateFcn(hObject,
eventdata, handles) set(hObject,'BackgroundColor','white');
% hObject handle to textbox2 (see end
GCBO)
% eventdata reserved - to be defined
in a future version of MATLAB
% handles empty - handles not function textbox6_Callback(hObject,
created until after all CreateFcns eventdata, handles)
called % hObject handle to textbox6 (see
GCBO)
% Hint: edit controls usually have a % eventdata reserved - to be defined
white background on Windows. in a future version of MATLAB
% See ISPC and COMPUTER. % handles structure with handles and
if ispc && user data (see GUIDATA)
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor' % Hints: get(hObject,'String') returns
)) contents of textbox6 as text
%
set(hObject,'BackgroundColor','white'); str2double(get(hObject,'String'))
end returns contents of textbox6 as a
double

function textbox3_Callback(hObject, % --- Executes during object creation,


eventdata, handles) after setting all properties.
% hObject handle to textbox3 (see function textbox6_CreateFcn(hObject,
GCBO) eventdata, handles)
% eventdata reserved - to be defined % hObject handle to textbox6 (see
in a future version of MATLAB GCBO)
% handles structure with handles and % eventdata reserved - to be defined
user data (see GUIDATA) in a future version of MATLAB
% handles empty - handles not
% Hints: get(hObject,'String') returns created until after all CreateFcns
contents of textbox3 as text called
%
str2double(get(hObject,'String')) % Hint: edit controls usually have a
returns contents of textbox3 as a white background on Windows.
double % See ISPC and COMPUTER.
if ispc &&
isequal(get(hObject,'BackgroundColor'),
% --- Executes during object creation, get(0,'defaultUicontrolBackgroundColor'
after setting all properties. ))
function textbox3_CreateFcn(hObject,
eventdata, handles) set(hObject,'BackgroundColor','white');
% hObject handle to textbox3 (see end
GCBO)
% eventdata reserved - to be defined
in a future version of MATLAB
% handles empty - handles not function textbox5_Callback(hObject,
created until after all CreateFcns eventdata, handles)
called % hObject handle to textbox5 (see
GCBO)
% Hint: edit controls usually have a % eventdata reserved - to be defined
white background on Windows. in a future version of MATLAB
% See ISPC and COMPUTER. % handles structure with handles and
if ispc && user data (see GUIDATA)
isequal(get(hObject,'BackgroundColor'),
% Hints: get(hObject,'String') returns % handles empty - handles not
contents of textbox5 as text created until after all CreateFcns
% called
str2double(get(hObject,'String'))
returns contents of textbox5 as a % Hint: edit controls usually have a
double white background on Windows.
% See ISPC and COMPUTER.
if ispc &&
% --- Executes during object creation, isequal(get(hObject,'BackgroundColor'),
after setting all properties. get(0,'defaultUicontrolBackgroundColor'
function textbox5_CreateFcn(hObject, ))
eventdata, handles)
% hObject handle to textbox5 (see set(hObject,'BackgroundColor','white');
GCBO) end
% eventdata reserved - to be defined
in a future version of MATLAB
% handles empty - handles not % --- Executes on button press in
created until after all CreateFcns pushbutton2.
called function pushbutton2_Callback(hObject,
eventdata, handles)
% Hint: edit controls usually have a % hObject handle to pushbutton2 (see
white background on Windows. GCBO)
% See ISPC and COMPUTER. % eventdata reserved - to be defined
if ispc && in a future version of MATLAB
isequal(get(hObject,'BackgroundColor'), % handles structure with handles and
get(0,'defaultUicontrolBackgroundColor' user data (see GUIDATA)
))
global theta1 theta2 theta3 theta4
set(hObject,'BackgroundColor','white'); global h1 h2 h3 h4
end global my_robot
global conectado s1

q1d =
function textbox4_Callback(hObject, str2num(get(handles.textbox4,'String'))
eventdata, handles) *pi()/180;
% hObject handle to textbox4 (see q2d =
GCBO) str2num(get(handles.textbox5,'String'))
% eventdata reserved - to be defined *pi()/180;
in a future version of MATLAB q3d =
% handles structure with handles and str2num(get(handles.textbox6,'String'))
user data (see GUIDATA) *pi()/180;
q4d =
% Hints: get(hObject,'String') returns str2num(get(handles.textbox7,'String'))
contents of textbox4 as text *pi()/180;
%
str2double(get(hObject,'String'))
returns contents of textbox4 as a STEPS=20;
double THETA1=linspace(theta1,q1d,STEPS);
THETA2=linspace(theta2,q2d,STEPS);
THETA3=linspace(theta3,q3d,STEPS);
% --- Executes during object creation, THETA4=linspace(theta4,q4d,STEPS);
after setting all properties. %5. Lazo Principal
function textbox4_CreateFcn(hObject, for i=1:STEPS
eventdata, handles) %A.Obtenemos Los angulos
% hObject handle to textbox4 (see theta1=THETA1(i);
GCBO) theta2=THETA2(i);
% eventdata reserved - to be defined theta3=THETA3(i);
in a future version of MATLAB theta4=THETA4(i);
%%
m=[theta1 theta2 theta3 function conectar_Callback(hObject,
theta4]*180/pi(); eventdata, handles)
% hObject handle to conectar (see
[m1,m2,m3,m4]=thetas(m(1),m(2),m(3),m(4 GCBO)
)); % eventdata reserved - to be defined
if conectado==1 in a future version of MATLAB
fwrite(s1, % handles structure with handles and
[m1,m2,m3,m4],'uchar'); user data (see GUIDATA)
end
%% % Hint: get(hObject,'Value') returns
toggle state of conectar
set(handles.th1,'String',theta1*180/pi( global conectado
)) global puerto
%clear puerto
set(handles.th2,'String',theta2*180/pi( global s1
)) conectado = 1-conectado;
puerto = get(handles.puerto,'String');
set(handles.th3,'String',theta3*180/pi( puerto = strcat('com',puerto);
)) if conectado == 1
fclose('all');
set(handles.th4,'String',theta4*180/pi( delete(instrfind)
)) s1=serial(puerto);
m=[theta1 theta2 theta3 theta4]; fopen(s1);
disp('m:') disp(puerto)
disp(m*180/pi) old=[0,0,0,0];
%B.Obtenemos Los angulos fwrite(s1,old,'uchar');
end
A1=my_robot.compute_matrix_A1(theta1);

A2=my_robot.compute_matrix_A2(theta2);
function puerto_Callback(hObject,
A3=my_robot.compute_matrix_A3(theta3); eventdata, handles)
% hObject handle to puerto (see
A4=my_robot.compute_matrix_A4(theta4); GCBO)
% eventdata reserved - to be defined
T01=A1; in a future version of MATLAB
T02=A1*A2; % handles structure with handles and
T03=T02*A3; user data (see GUIDATA)
T04=T03*A4;
set(handles.xc,'String',T04(1,4)) % Hints: get(hObject,'String') returns
set(handles.yc,'String',T04(2,4)) contents of puerto as text
set(handles.zc,'String',T04(3,4)) %
%C.PLOTEAMOS LOS SITEMAS str2double(get(hObject,'String'))
COORDENADOS returns contents of puerto as a double
plot_frame(h1,T01);
plot_frame(h2,T02);
plot_frame(h3,T03); % --- Executes during object creation,
plot_frame(h4,T04); after setting all properties.
function puerto_CreateFcn(hObject,
%DELTA DE TIEMPO eventdata, handles)
pause(0.1) % hObject handle to puerto (see
end GCBO)
% eventdata reserved - to be defined
theta1 = q1d; in a future version of MATLAB
theta2 = q2d; % handles empty - handles not
theta3 = q3d; created until after all CreateFcns
theta4 = q4d; called
% --- Executes on button press in
conectar. % Hint: edit controls usually have a
white background on Windows.
% See ISPC and COMPUTER. end
if ispc && % --- Executes on button press in
isequal(get(hObject,'BackgroundColor'), modo_linea.
get(0,'defaultUicontrolBackgroundColor' function modo_linea_Callback(hObject,
)) eventdata, handles)
% hObject handle to modo_linea (see
set(hObject,'BackgroundColor','white'); GCBO)
end % eventdata reserved - to be defined
in a future version of MATLAB
% handles structure with handles and
% --- Executes during object creation, user data (see GUIDATA)
after setting all properties. global linea
function th4_CreateFcn(hObject, linea = 1-linea;
eventdata, handles)
% hObject handle to th4 (see GCBO) % Hint: get(hObject,'Value') returns
% eventdata reserved - to be defined toggle state of modo_linea
in a future version of MATLAB
% handles empty - handles not
created until after all CreateFcns
called

function textbox7_Callback(hObject,
eventdata, handles)
% hObject handle to textbox7 (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 textbox7 as text
%
str2double(get(hObject,'String'))
returns contents of textbox7 as a
double

% --- Executes during object creation,


after setting all properties.
function textbox7_CreateFcn(hObject,
eventdata, handles)
% hObject handle to textbox7 (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');

Вам также может понравиться