function varargout = SimuladorCs(varargin)
% SIMULADORCS M-file for SimuladorCs.fig
% SIMULADORCS, by itself, creates a new SIMULADORCS or raises the existing
% singleton*.
%
% H = SIMULADORCS returns the handle to a new SIMULADORCS or the handle to
% the existing singleton*.
%
% SIMULADORCS('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SIMULADORCS.M with the given input arguments.
%
% SIMULADORCS('Property','Value',...) creates a new SIMULADORCS or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before SimuladorCs_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to SimuladorCs_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
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help SimuladorCs
% Last Modified by GUIDE v2.5 04-Jan-2007 21:25:14
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @SimuladorCs_OpeningFcn, ...
'gui_OutputFcn', @SimuladorCs_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 SimuladorCs is made visible.
function SimuladorCs_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 SimuladorCs (see VARARGIN)
set(handles.figure1,'Color',[0.16 0.2117 0.36]);
[a,map,b]=imread('_Cylindrical.JPG');
set(handles.NomeSumulador,'CData',a);
[a,map,b]=imread('_Iniciar.JPG');
set(handles.pbiniciar,'CData',a);
set(handles.pbjacobiano,'CData',a);
set(handles.pbtrajectoria,'CData',a);
[a,map,b]=imread('_Rodar_Off.JPG');
set(handles.tbrodar,'CData',a);
[a,map,b]=imread('_Reset_.JPG');
set(handles.pbrestaurar,'CData',a);
[a,map,b]=imread('_Zoom_Off.JPG');
set(handles.tbzoom,'CData',a);
[a,map,b]=imread('_Cursor_Off.JPG');
set(handles.tbDataCursor,'CData',a);
[a,map,b]=imread('Guardar_.JPG');
set(handles.pbGuarda,'CData',a);
[a,map,b]=imread('Apagar_.JPG');
set(handles.pbDEL,'CData',a);
[a,map,b]=imread('Guardar_Dados.JPG');
set(handles.GuardaDados,'CData',a);
[a,map,b]=imread('Ler_Dados.JPG');
set(handles.LerDados,'CData',a);
set(hObject, 'Units', 'pixels');
handles.isec = imread( 'isec','jpeg'); % Read the image file banner.jpg
info = imfinfo('isec','jpeg'); % Determine the size of the image file
%position = get(hObject, 'Position');
%set(hObject, 'Position', [position(1:2) info.Width + 100 info.Height + 100]);
axes(handles.axes7);
axis off;
image(handles.isec)
set(handles.axes7, ...
'Visible', 'off', ...
'Units', 'pixels');%,...
set(hObject, 'Units', 'pixels');
handles.robotimagem = imread( 'robotimagem','jpeg'); % Read the image file banner.jpg
info = imfinfo('robotimagem','jpeg'); % Determine the size of the image file
%position = get(hObject, 'Position');
%set(hObject, 'Position', [position(1:2) info.Width + 100 info.Height + 100]);
axes(handles.axes8);
axis off;
image(handles.robotimagem)
set(handles.axes8, ...
'Visible', 'off', ...
'Units', 'pixels');%,...
% set(hObject, 'Units', 'pixels');
% handles.fundo = imread( 'fundo','JPEG'); % Read the image file banner.jpg
% info = imfinfo('fundo','JPEG'); % Determine the size of the image file
% %position = get(hObject, 'Position');
% %set(hObject, 'Position', [position(1:2) info.Width + 100 info.Height + 100]);
% axes(handles.fundoaxes);
% axis off;
% image(handles.fundo)
% set(handles.fundoaxes, ...
% 'Visible', 'off', ...
% 'Units', 'pixels');%,...
% %'Position', [50 50 info.Width info.Height]);
%set(gca,'XDir','rev','YDir','rev','ZDir','rev') %muda a parte positiva com a negativa
%set(handles.axes1,'XAxisLocation','bottom');
% Choose default command line output for SimuladorCs
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
axes(handles.axes1);
axis on
axis([-100 100 -100 100 -100 100]); %%%%%%%%tem-se de por
% UIWAIT makes SimuladorCs wait for user response (see UIRESUME)
% uiwait(handles.figure1);
Iniciar_variaveis; %%%%%%%%inicia variaveis
Inicia_Matriz_Objecto; %%%%%%%%%%%%Iniciar todas as matirzes referentes as faces dos objectos
Desenha_robo(hObject, eventdata,handles); %%Matlab 7.3
%%SimuladorCs('Desenha_robo',hObject, eventdata,handles);%%Matlab /7.1
set(handles.editteta1,'String','0');
set(handles.editteta4,'String','90');
set(handles.editteta5,'String','0');
set(handles.editteta6,'String','0');
set(handles.editd2,'String','90');
set(handles.editd3,'String','125');
set(handles.textd2,'String',get(handles.editd2,'String'));
set(handles.textd3,'String',get(handles.editd3,'String'));
set(handles.textteta1,'String',get(handles.editteta1,'String'));
set(handles.textteta4,'String',get(handles.editteta4,'String'));
set(handles.textteta5,'String',get(handles.editteta5,'String'));
set(handles.textteta6,'String',get(handles.editteta6,'String'));
%%%%%%%%%%%%%%%Colocar acentos%%%%%%%%%%%%%%%%%%%%
set(handles.PX,'String','Posio X');
set(handles.PY,'String','Posio Y');
set(handles.PZ,'String','Posio Z');
set(handles.rbcinemdirect,'String','Cinemtica Directa');
set(handles.rbcineminv,'String','Cinemtica Inversa');
set(handles.uipanelCineDirect,'Title','Cinemtica Directa');
set(handles.uipanel10,'Title','Trajectrias');
set(handles.uipCinInv,'Title','Cinemtica Inversa');
set(handles.text28,'String','Posio X =');
set(handles.text29,'String','Posio Y =');
set(handles.text30,'String','Posio Z =');
set(handles.uipanel7,'Title','Posio Rob');
set(handles.editPX,'String','110');
set(handles.editPY,'String','-150');
set(handles.editPZ,'String','90');
set(handles.edittetaf,'String','90');
set(handles.edittetap,'String','0');
set(handles.textpx,'String','110');
set(handles.textpy,'String','-150');
set(handles.textpz,'String','90');
set(handles.texttetaf,'String','90');
set(handles.texttetap,'String','0');
% --- Outputs from this function are returned to the command line.
function varargout = SimuladorCs_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;
function editteta1_Callback(hObject, eventdata, handles)
% hObject handle to editteta1 (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 editteta1 as text
% str2double(get(hObject,'String')) returns contents of editteta1 as a double
Teta1 = str2num(get(handles.editteta1,'String'));
if(Teta1<-180 || Teta1>180)
errordlg('ngulo Invalido:Digite um valor entre -180 e 180 ','Erro','on')
set(handles.editteta1,'String',' '); %limpar a caixa
end
% --- Executes during object creation, after setting all properties.
function editteta1_CreateFcn(hObject, eventdata, handles)
% hObject handle to editteta1 (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editd2_Callback(hObject, eventdata, handles)
% hObject handle to editd2 (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 editd2 as text
% str2double(get(hObject,'String')) returns contents of editd2 as a double
d2 = str2num(get(handles.editd2,'String'));
if(d2<0 || d2>180)
errordlg('Distncia Invalida:Digite um valor entre 0 e 180cm ','Erro','on')
set(handles.editd2,'String',' '); %limpar a caixa
end
% --- Executes during object creation, after setting all properties.
function editd2_CreateFcn(hObject, eventdata, handles)
% hObject handle to editd2 (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editd3_Callback(hObject, eventdata, handles)
% hObject handle to editd3 (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 editd3 as text
% str2double(get(hObject,'String')) returns contents of editd3 as a double
d3 = str2num(get(handles.editd3,'String'));
if(d3<0 || d3>235)
errordlg('Distncia Invalida:Digite um valor entre 0 e 235cm ','Erro','on')
set(handles.editd3,'String',' '); %limpar a caixa
end
% --- Executes during object creation, after setting all properties.
function editd3_CreateFcn(hObject, eventdata, handles)
% hObject handle to editd3 (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editteta4_Callback(hObject, eventdata, handles)
% hObject handle to editteta4 (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 editteta4 as text
% str2double(get(hObject,'String')) returns contents of editteta4 as a double
Teta4 = str2num(get(handles.editteta4,'String'));
if(Teta4<-180 || Teta4>180)
errordlg('ngulo Invalido:Digite um valor entre -180 e 180 ','Erro','on')
set(handles.editteta4,'String',' '); %limpar a caixa
end
% --- Executes during object creation, after setting all properties.
function editteta4_CreateFcn(hObject, eventdata, handles)
% hObject handle to editteta4 (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editteta5_Callback(hObject, eventdata, handles)
% hObject handle to editteta5 (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 editteta5 as text
% str2double(get(hObject,'String')) returns contents of editteta5 as a double
Teta5 = str2num(get(handles.editteta5,'String'));
if(Teta5<-90 || Teta5>90)
errordlg('ngulo Invalido:Digite um valor entre -90 e 90 ','Erro','on')
set(handles.editteta5,'String',' '); %limpar a caixa
end
% --- Executes during object creation, after setting all properties.
function editteta5_CreateFcn(hObject, eventdata, handles)
% hObject handle to editteta5 (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editteta6_Callback(hObject, eventdata, handles)
% hObject handle to editteta6 (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 editteta6 as text
% str2double(get(hObject,'String')) returns contents of editteta6 as a double
Teta6 = str2num(get(handles.editteta6,'String'));
if(Teta6<-180 || Teta6>180)
errordlg('ngulo Invalido:Digite um valor entre -180 e 180 ','Erro','on')
set(handles.editteta6,'String',' '); %limpar a caixa
end
% --- Executes during object creation, after setting all properties.
function editteta6_CreateFcn(hObject, eventdata, handles)
% hObject handle to editteta6 (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%INICIAR%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in pbiniciar.
function pbiniciar_Callback(hObject, eventdata, handles)
% hObject handle to pbiniciar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.output = hObject;
global teta1 d2 d3 d4 l1 teta4 teta5 teta6 T06
global flag_cinematicainversa flag_cinematicadirecta flag_joystick flag_joyInver
global ai BP d flag_joy
flag_joy=0;
if flag_joystick==1
Mov_joystick(hObject, eventdata,handles); %Matlab 7.3
%% SimuladorCs('Mov_joystick',hObject, eventdata,handles); %%Matlab 7.1
set(handles.editteta1,'String',get(handles.textteta1,'String'));
set(handles.editteta4,'String',get(handles.textteta4,'String'));
set(handles.editteta5,'String',get(handles.textteta5,'String'));
set(handles.editteta6,'String',get(handles.textteta6,'String'));
set(handles.editd2,'String',get(handles.textd2,'String'));
set(handles.editd3,'String',get(handles.textd3,'String'));
set(handles.editPX,'String',get(handles.textpx,'String'));
set(handles.editPY,'String',get(handles.textpy,'String'));
set(handles.editPZ,'String',get(handles.textpz,'String'));
set(handles.edittetaf,'String',get(handles.texttetaf,'String'));
set(handles.edittetap,'String',get(handles.texttetap,'String'));
return;
end
if flag_joyInver==1
Joy_Inverso(hObject, eventdata,handles);%%Matlab 7.3
%SimuladorCs('Joy_Inverso',hObject, eventdata,handles); %%Matlab 7.1
set(handles.editteta1,'String',get(handles.textteta1,'String'));
set(handles.editteta4,'String',get(handles.textteta4,'String'));
set(handles.editteta5,'String',get(handles.textteta5,'String'));
set(handles.editteta6,'String',get(handles.textteta6,'String'));
set(handles.editd2,'String',get(handles.textd2,'String'));
set(handles.editd3,'String',get(handles.textd3,'String'));
set(handles.editPX,'String',get(handles.textpx,'String'));
set(handles.editPY,'String',get(handles.textpy,'String'));
set(handles.editPZ,'String',get(handles.textpz,'String'));
set(handles.edittetaf,'String',get(handles.texttetaf,'String'));
set(handles.edittetap,'String',get(handles.texttetap,'String'));
return;
end
if flag_cinematicadirecta==1
teta1deg=str2num(get(handles.editteta1,'String'));
d2=str2num(get(handles.editd2,'String'));
d3=str2num(get(handles.editd3,'String'));
teta4deg=str2num(get(handles.editteta4,'String'));
teta5deg=str2num(get(handles.editteta5,'String'));
teta6deg=str2num(get(handles.editteta6,'String'));
teta1=(teta1deg*pi)/180;
teta4=(teta4deg*pi)/180;
teta5=(teta5deg*pi)/180;
teta6=(teta6deg*pi)/180;
set(handles.textd2,'String',get(handles.editd2,'String'));
set(handles.textd3,'String',get(handles.editd3,'String'));
set(handles.textteta1,'String',get(handles.editteta1,'String'));
set(handles.textteta4,'String',get(handles.editteta4,'String'));
set(handles.textteta5,'String',get(handles.editteta5,'String'));
set(handles.textteta6,'String',get(handles.editteta6,'String'));
Desenha_robo(hObject, eventdata,handles); %Matlab 7.3
%SimuladorCs('Desenha_robo',hObject, eventdata,handles); %Matlab 7.1
%% Determinar PX,Py e Pz
Px=T06(1,4);
Py=T06(2,4);
Pz=T06(3,4);
tetaf=teta6+teta4;
tetafdeg=tetaf*180/pi;
set(handles.textpx,'String',num2str(Px));
set(handles.textpy,'String',num2str(Py));
set(handles.textpz,'String',num2str(Pz));
set(handles.texttetaf,'String',num2str(tetafdeg));
set(handles.texttetap,'String',get(handles.editteta5,'String'));
set(handles.editteta1,'String',get(handles.textteta1,'String'));
set(handles.editteta4,'String',get(handles.textteta4,'String'));
set(handles.editteta5,'String',get(handles.textteta5,'String'));
set(handles.editteta6,'String',get(handles.textteta6,'String'));
set(handles.editd2,'String',get(handles.textd2,'String'));
set(handles.editd3,'String',get(handles.textd3,'String'));
set(handles.editPX,'String',get(handles.textpx,'String'));
set(handles.editPY,'String',get(handles.textpy,'String'));
set(handles.editPZ,'String',get(handles.textpz,'String'));
set(handles.edittetaf,'String',get(handles.texttetaf,'String'));
set(handles.edittetap,'String',get(handles.texttetap,'String'));
return;
end
if flag_cinematicainversa==1
Px=str2num(get(handles.editPX,'String'));
Py=str2num(get(handles.editPY,'String'));
Pz=str2num(get(handles.editPZ,'String'));
if(sqrt((Px^2)+(Py^2))<112.75 || sqrt((Px^2)+(Py^2))>282) %est fora do volume de trabalho
errordlg('Posies Px e Py fora do volume de trabalho:Digite novamente','Erro','on')
set(handles.editPX,'String',' '); %limpar a caixa
set(handles.editPY,'String',' '); %limpar a caixa
end
if(sqrt((Px^2)+(Py^2))>=112.75 && sqrt((Px^2)+(Py^2))<=282) %est dentro do volume de trabalho
tetaf=str2num(get(handles.edittetaf,'String'));
tetap=str2num(get(handles.edittetap,'String'));
teta1=atan2(Py,Px)+atan2(sqrt(Px^2+Py^2-l1^2),l1);
d2=Pz;
d3=sin(teta1)*Px-cos(teta1)*Py-d4;
teta4=atan2(1,0);
teta5=(tetap*pi)/180;
tetaf=(tetaf*pi)/180;
teta6=tetaf-teta4;
teta1deg=teta1*180/pi;
teta4deg=teta4*180/pi;
teta5deg=teta5*180/pi;
teta6deg=teta6*180/pi;
teta1str=num2str(teta1deg);
teta4str=num2str(teta4deg);
teta5str=num2str(teta5deg);
teta6str=num2str(teta6deg);
d2str=num2str(d2);
d3str=num2str(d3);
set(handles.textd2,'String',d2str);
set(handles.textd3,'String',d3str);
set(handles.textteta1,'String',teta1str);
set(handles.textteta4,'String',teta4str);
set(handles.textteta5,'String',teta5str);
set(handles.textteta6,'String',teta6str);
set(handles.textpx,'String',get(handles.editPX,'String'));
set(handles.textpy,'String',get(handles.editPY,'String'));
set(handles.textpz,'String',get(handles.editPZ,'String'));
set(handles.texttetaf,'String',get(handles.edittetaf,'String'));
set(handles.texttetap,'String',get(handles.edittetap,'String'));
Desenha_robo(hObject, eventdata,handles); %Matlab 7.3
%SimuladorCs('Desenha_robo',hObject, eventdata,handles); %Matlab 7.1
set(handles.editteta1,'String',get(handles.textteta1,'String'));
set(handles.editteta4,'String',get(handles.textteta4,'String'));
set(handles.editteta5,'String',get(handles.textteta5,'String'));
set(handles.editteta6,'String',get(handles.textteta6,'String'));
set(handles.editd2,'String',get(handles.textd2,'String'));
set(handles.editd3,'String',get(handles.textd3,'String'));
set(handles.editPX,'String',get(handles.textpx,'String'));
set(handles.editPY,'String',get(handles.textpy,'String'));
set(handles.editPZ,'String',get(handles.textpz,'String'));
set(handles.edittetaf,'String',get(handles.texttetaf,'String'));
set(handles.edittetap,'String',get(handles.texttetap,'String'));
end
end
% --- Executes on button press in rbcinemdirect.
function rbcinemdirect_Callback(hObject, eventdata, handles)
% hObject handle to rbcinemdirect (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of rbcinemdirect
global flag_cinematicainversa flag_cinematicadirecta flag_joystick flag_joy flag_joyInver
flag_cinematicadirecta=1;%%%assim sei q este radio buttom est selecionado
flag_cinematicainversa=0;
flag_joystick=0;
flag_joy=0;
flag_joyInver=0;
set(handles.editteta1,'Enable','on');
set(handles.editteta4,'Enable','on');
set(handles.editteta5,'Enable','on');
set(handles.editteta6,'Enable','on');
set(handles.editd2,'Enable','on');
set(handles.editd3,'Enable','on');
set(handles.editPX,'Enable','off');
set(handles.editPY,'Enable','off');
set(handles.editPZ,'Enable','off');
set(handles.edittetaf,'Enable','off');
set(handles.edittetap,'Enable','off');
% --- Executes on button press in rbjoyistick.
function rbjoyistick_Callback(hObject, eventdata, handles)
% hObject handle to rbjoyistick (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of rbjoyistick
global flag_cinematicainversa flag_cinematicadirecta flag_joystick flag_joyInver
flag_joystick=1;%%%assim sei q este radio buttom est selecionado
flag_cinematicainversa=0;
flag_cinematicadirecta=0;
flag_joyInver=0;
set(handles.editteta1,'Enable','off');
set(handles.editteta4,'Enable','off');
set(handles.editteta5,'Enable','off');
set(handles.editteta6,'Enable','off');
set(handles.editd2,'Enable','off');
set(handles.editd3,'Enable','off');
set(handles.editPX,'Enable','off');
set(handles.editPY,'Enable','off');
set(handles.editPZ,'Enable','off');
set(handles.edittetaf,'Enable','off');
set(handles.edittetap,'Enable','off');
% --- Executes on button press in rbjoyInverso.
function rbjoyInverso_Callback(hObject, eventdata, handles)
% hObject handle to rbjoyInverso (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of rbjoyInverso
global flag_cinematicainversa flag_cinematicadirecta flag_joystick flag_joy flag_joyInver
flag_cinematicainversa=0; %%%assim sei q este radio buttom est selecionado
flag_cinematicadirecta=0;
flag_joystick=0;
flag_joy=0;
flag_joyInver=1;
set(handles.editteta1,'Enable','off');
set(handles.editteta4,'Enable','off');
set(handles.editteta5,'Enable','off');
set(handles.editteta6,'Enable','off');
set(handles.editd2,'Enable','off');
set(handles.editd3,'Enable','off');
set(handles.editPX,'Enable','off');
set(handles.editPY,'Enable','off');
set(handles.editPZ,'Enable','off');
set(handles.edittetaf,'Enable','off');
set(handles.edittetap,'Enable','off');
% -------------------------------------
% --- Executes on button press in rbcineminv.
function rbcineminv_Callback(hObject, eventdata, handles)
% hObject handle to rbcineminv (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of rbcineminv
global flag_cinematicainversa flag_cinematicadirecta flag_joystick flag_joy flag_joyInver
flag_cinematicainversa=1; %%%assim sei q este radio buttom est selecionado
flag_cinematicadirecta=0;
flag_joystick=0;
flag_joy=0;
flag_joyInver=0;
set(handles.editteta1,'Enable','off');
set(handles.editteta4,'Enable','off');
set(handles.editteta5,'Enable','off');
set(handles.editteta6,'Enable','off');
set(handles.editd2,'Enable','off');
set(handles.editd3,'Enable','off');
set(handles.editPX,'Enable','on');
set(handles.editPY,'Enable','on');
set(handles.editPZ,'Enable','on');
set(handles.edittetaf,'Enable','on');
set(handles.edittetap,'Enable','on');
% --------------------------------------------------------------------
function ficheiro_Callback(hObject, eventdata, handles)
% hObject handle to ficheiro (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function imprimir_Callback(hObject, eventdata, handles)
% hObject handle to imprimir (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
printdlg('-setup',handles.figure1);
%printdlg(handles.figure1);%Imprimir Dados
%printdlg('-crossplatform',handles.figure1);
% --------------------------------------------------------------------
function ajuda_Callback(hObject, eventdata, handles)
% hObject handle to ajuda (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Acerca_Callback(hObject, eventdata, handles)
% hObject handle to Acerca (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%openfig('Acerca.fig','new');% Abre novo figure file
Acerca;
function editPX_Callback(hObject, eventdata, handles)
% hObject handle to editPX (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 editPX as text
% str2double(get(hObject,'String')) returns contents of editPX as a double
% --- Executes during object creation, after setting all properties.
function editPX_CreateFcn(hObject, eventdata, handles)
% hObject handle to editPX (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editPY_Callback(hObject, eventdata, handles)
% hObject handle to editPY (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 editPY as text
% str2double(get(hObject,'String')) returns contents of editPY as a double
% --- Executes during object creation, after setting all properties.
function editPY_CreateFcn(hObject, eventdata, handles)
% hObject handle to editPY (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editPZ_Callback(hObject, eventdata, handles)
% hObject handle to editPZ (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 editPZ as text
% str2double(get(hObject,'String')) returns contents of editPZ as a double
pz = str2num(get(handles.editPZ,'String'));
if(pz<0 || pz>180)
errordlg('Distncia Invalida:Digite um valor entre 0 e 180 ','Erro','on')
set(handles.editPZ,'String',' '); %limpar a caixa
end
% --- Executes during object creation, after setting all properties.
function editPZ_CreateFcn(hObject, eventdata, handles)
% hObject handle to editPZ (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit15_Callback(hObject, eventdata, handles)
% hObject handle to edit15 (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 edit15 as text
% str2double(get(hObject,'String')) returns contents of edit15 as a double
% --- Executes during object creation, after setting all properties.
function edit15_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit15 (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit16_Callback(hObject, eventdata, handles)
% hObject handle to edit16 (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 edit16 as text
% str2double(get(hObject,'String')) returns contents of edit16 as a double
% --- Executes during object creation, after setting all properties.
function edit16_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit16 (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit17_Callback(hObject, eventdata, handles)
% hObject handle to edit17 (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 edit17 as text
% str2double(get(hObject,'String')) returns contents of edit17 as a double
% --- Executes during object creation, after setting all properties.
function edit17_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit17 (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in tbrodar.
function tbrodar_Callback(hObject, eventdata, handles)
% hObject handle to tbrodar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of tbrodar
rodar = get(hObject,'Value');
axes(handles.axes1);
if rodar==1
rotate3d on;
[a,map,b]=imread('_Rodar_On.JPG');
set(handles.tbrodar,'CData',a);
else
rotate3d off;
[a,map,b]=imread('_Rodar_Off.JPG');
set(handles.tbrodar,'CData',a);
end
axes(handles.axes1);
% --- Executes on button press in pbrestaurar.
function pbrestaurar_Callback(hObject, eventdata, handles)
% hObject handle to pbrestaurar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global flag_joy
flag_joy=0;
reset(handles.axes1);
axis on
axis([-100 100 -100 100 -100 100]);
Iniciar_variaveis; %%%%%%%%inicia variaveis
Inicia_Matriz_Objecto; %%%%%%%%%%%%Iniciar todas as matirzes referentes as faces dos objectos
set(handles.editteta1,'String','0','Enable','off');
set(handles.editteta4,'String','90','Enable','off');
set(handles.editteta5,'String','0','Enable','off');
set(handles.editteta6,'String','0','Enable','off');
set(handles.editd2,'String','90','Enable','off');
set(handles.editd3,'String','125','Enable','off');
set(handles.editPX,'Enable','off','String','110');
set(handles.editPY,'Enable','off','String','-150');
set(handles.editPZ,'Enable','off','String','90');
set(handles.edittetaf,'Enable','off','String','90');
set(handles.edittetap,'Enable','off','String','0');
set(handles.textd2,'String',get(handles.editd2,'String'));
set(handles.textd3,'String',get(handles.editd3,'String'));
set(handles.textteta1,'String',get(handles.editteta1,'String'));
set(handles.textteta4,'String',get(handles.editteta4,'String'));
set(handles.textteta5,'String',get(handles.editteta5,'String'));
set(handles.textteta6,'String',get(handles.editteta6,'String'));
set(handles.textpx,'String','110');
set(handles.textpy,'String','-150');
set(handles.textpz,'String','90');
set(handles.texttetaf,'String','90');
set(handles.texttetap,'String','0');
[a,map,b]=imread('_Rodar_Off.JPG');
set(handles.tbrodar,'CData',a);
[a,map,b]=imread('_Reset_.JPG');
set(handles.pbrestaurar,'CData',a);
[a,map,b]=imread('_Zoom_Off.JPG');
set(handles.tbzoom,'CData',a);
[a,map,b]=imread('_Cursor_Off.JPG');
set(handles.tbDataCursor,'CData',a);
set(handles.rbjoyistick,'Value',1);
Desenha_robo(hObject, eventdata,handles); %Matlab 7.3
%SimuladorCs('Desenha_robo',hObject, eventdata,handles); %Matlab 7.1
% --- Executes on button press in tbzoom.
function tbzoom_Callback(hObject, eventdata, handles)
% hObject handle to tbzoom (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of tbzoom
zoomx = get(hObject,'Value');
axes(handles.axes1);
if zoomx==1
zoom on;
[a,map,b]=imread('_Zoom_On.JPG');
set(handles.tbzoom,'CData',a);
else
zoom off;
[a,map,b]=imread('_Zoom_Off.JPG');
set(handles.tbzoom,'CData',a);
end
axes(handles.axes1);
% --- Executes on button press in tbDataCursor.
function tbDataCursor_Callback(hObject, eventdata, handles)
% hObject handle to tbDataCursor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of tbDataCursor
datacursorx = get(hObject,'Value');
axes(handles.axes1);
if datacursorx==1
datacursormode on;
[a,map,b]=imread('_Cursor_On.JPG');
set(handles.tbDataCursor,'CData',a);
else
datacursormode off;
[a,map,b]=imread('_Cursor_Off.JPG');
set(handles.tbDataCursor,'CData',a);
end
axes(handles.axes1);
function edittetaf_Callback(hObject, eventdata, handles)
% hObject handle to edittetaf (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 edittetaf as text
% str2double(get(hObject,'String')) returns contents of edittetaf as a double
Tetaf = str2num(get(handles.edittetaf,'String'));
if(Tetaf<-360 || Tetaf>360)
errordlg('ngulo Invalido:Digite um valor entre -360 e 360 ','Erro','on')
set(handles.edittetaf,'String',' '); %limpar a caixa
end
% --- Executes during object creation, after setting all properties.
function edittetaf_CreateFcn(hObject, eventdata, handles)
% hObject handle to edittetaf (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 edittetap_Callback(hObject, eventdata, handles)
% hObject handle to edittetap (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 edittetap as text
% str2double(get(hObject,'String')) returns contents of edittetap as a double
Tetap = str2num(get(handles.edittetap,'String'));
if(Tetap<-90 || Tetap>90)
errordlg('ngulo Invalido:Digite um valor entre -90 e 90 ','Erro','on')
set(handles.edittetap,'String',' '); %limpar a caixa
end
% --- Executes during object creation, after setting all properties.
function edittetap_CreateFcn(hObject, eventdata, handles)
% hObject handle to edittetap (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 editVx_Callback(hObject, eventdata, handles)
% hObject handle to editVx (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 editVx as text
% str2double(get(hObject,'String')) returns contents of editVx as a double
% --- Executes during object creation, after setting all properties.
function editVx_CreateFcn(hObject, eventdata, handles)
% hObject handle to editVx (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 editVy_Callback(hObject, eventdata, handles)
% hObject handle to editVy (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 editVy as text
% str2double(get(hObject,'String')) returns contents of editVy as a double
% --- Executes during object creation, after setting all properties.
function editVy_CreateFcn(hObject, eventdata, handles)
% hObject handle to editVy (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 editVz_Callback(hObject, eventdata, handles)
% hObject handle to editVz (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 editVz as text
% str2double(get(hObject,'String')) returns contents of editVz as a double
% --- Executes during object creation, after setting all properties.
function editVz_CreateFcn(hObject, eventdata, handles)
% hObject handle to editVz (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
% --- Executes on button press in pbjacobiano.
function pbjacobiano_Callback(hObject, eventdata, handles)
% hObject handle to pbjacobiano (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.output = hObject;
global teta1 d2 d3 teta4 teta5 teta6 Vx Vy Vz
%%%%%%%%%Guardar valores da posio do rob
teta1deg=str2num(get(handles.textteta1,'String'));
d2=str2num(get(handles.textd2,'String'));
d3=str2num(get(handles.textd3,'String'));
teta4deg=str2num(get(handles.textteta4,'String'));
teta5deg=str2num(get(handles.textteta5,'String'));
teta6deg=str2num(get(handles.textteta6,'String'));
Vx=str2num(get(handles.editVx,'String'));
Vy=str2num(get(handles.editVy,'String'));
Vz=str2num(get(handles.editVz,'String'));
teta1=(teta1deg*pi)/180;
teta4=(teta4deg*pi)/180;
teta5=(teta5deg*pi)/180;
teta6=(teta6deg*pi)/180;
Jacobiano(hObject, eventdata,handles);
%Jacobiano(hObject, eventdata,handles); %Matlab 7.3
%SimuladorCs('Desenha_robo',hObject, eventdata,handles); %Matlab 7.1
% --- Executes on selection change in listboxPos.
function listboxPos_Callback(hObject, eventdata, handles)
% hObject handle to listboxPos (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns listboxPos contents as cell array
% contents{get(hObject,'Value')} returns selected item from listboxPos
% --- Executes during object creation, after setting all properties.
function listboxPos_CreateFcn(hObject, eventdata, handles)
% hObject handle to listboxPos (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox 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
% --- Executes on button press in pbGuarda.
function pbGuarda_Callback(hObject, eventdata, handles)
% hObject handle to pbGuarda (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global tabela_pos;
str_Px=get(handles.textpx,'String');
str_Py=get(handles.textpy,'String');
str_Pz=get(handles.textpz,'String');
str_listbox=get(handles.listboxPos,'String');
if(strcmp(str_listbox,' ')~=0)
[c,l]=size(str_listbox);
str_listbox{c}=['PX:',str_Px,';','PY:',str_Py,';','PZ:',str_Pz,';'];
set(handles.listboxPos,'String',str_listbox);
set(handles.listboxPos,'Value',c);
tabela_pos(c,1)=str2num(get(handles.textpx,'String'));
tabela_pos(c,2)=str2num(get(handles.textpy,'String'));
tabela_pos(c,3)=str2num(get(handles.textpz,'String'));
else
[c,l]=size(str_listbox);
str_listbox{c+1}=['PX:',str_Px,';','PY:',str_Py,';','PZ:',str_Pz,';'];
set(handles.listboxPos,'String',str_listbox);
set(handles.listboxPos,'Value',c+1);
%%Guardar valores numa tabela
tabela_pos(c+1,1)=str2num(get(handles.textpx,'String'));
tabela_pos(c+1,2)=str2num(get(handles.textpy,'String'));
tabela_pos(c+1,3)=str2num(get(handles.textpz,'String'));
end
% s{list_i,1}=strcat('PX:',str_Px,';','PY:',str_Py,';','PZ:',str_Pz,';');
% set(handles.listboxPos,'String',s);
%
% list_i=list_i+1;
%[' datestr(now,13) '] retorna data e hora
% --- Executes on button press in pbDEL.
function pbDEL_Callback(hObject, eventdata, handles)
% hObject handle to pbDEL (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
xx{1}=[' '];
%set(handles.listboxPos,'String',str_listbox);
set(handles.listboxPos,'String',xx);
set(handles.listboxPos,'Value',1);
clear global tabela_pos
% --- Executes on button press in pbtrajectoria.
function pbtrajectoria_Callback(hObject, eventdata, handles)
% hObject handle to pbtrajectoria (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.output = hObject;
global tabela_pos teta1 d2 d3 d4 l1
%%%%%%Velocidades
Vx=str2num(get(handles.editVx,'String'));
Vy=str2num(get(handles.editVy,'String'));
Vz=str2num(get(handles.editVz,'String'));
Vmodulo=sqrt((Vx^2)+(Vy^2)+(Vz^2));
str_listbox=get(handles.listboxPos,'String');
[c,l]=size(str_listbox);
% Pxantes=str2num(get(handles.textpx,'String'));
% Pyantes=str2num(get(handles.textpy,'String'));
% Pzantes=str2num(get(handles.textpz,'String'));
i=1;
while(i<=c)
Px=tabela_pos(i,1);
Py=tabela_pos(i,2);
Pz=tabela_pos(i,3);
teta1=atan2(Py,Px)+atan2(sqrt(Px^2+Py^2-l1^2),l1);
d2=Pz;
d3=sin(teta1)*Px-cos(teta1)*Py-d4;
pause(0.5);
Desenha_robo(hObject, eventdata,handles); %Matlab 7.3
%SimuladorCs('Desenha_robo',hObject, eventdata,handles); %Matlab 7.1
% if(i>1)
% Pxantes=tabela_pos(i-1,1);
% Pyantes=tabela_pos(i-1,2);
% Pzantes=tabela_pos(i-1,3);
% end
% d=sqrt((Px-Pxantes)^2+(Py-Pyantes)^2+(Pz-Pzantes)^2);
% tempoPercurso=d/Vmodulo;
% tempoIntermedio=tempoPercurso/20;
%
% k=1;%20 iteraes
% while(k<=20)
% Pxpos=Pxantes+((Px-Pxantes)/20);
% Pypos=Pyantes+((Py-Pyantes)/20);
% Pzpos=Pzantes+((Pz-Pzantes)/20);
% teta1=atan2(Pypos,Pxpos)+atan2(sqrt(Pxpos^2+Pypos^2-l1^2),l1);
% d2=Pzpos;
% d3=sin(teta1)*Pxpos-cos(teta1)*Pypos-d4;
% pause(0.05);
% SimuladorCs('Desenha_robo',hObject, eventdata,handles);
% k=k+1;
% end
i=i+1;
end
% --- Executes on button press in NomeSumulador.
function NomeSumulador_Callback(hObject, eventdata, handles)
% hObject handle to NomeSumulador (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function detectar_Mov_Callback(hObject, eventdata, handles)
% hObject handle to detectar_Mov (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
WebCam;
% --------------------------------------------------------------------
function Manual_Callback(hObject, eventdata, handles)
% hObject handle to Manual (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
open Manual_Cs_Simulator.pdf;
% --- Executes on button press in GuardaDados.
function GuardaDados_Callback(hObject, eventdata, handles)
% hObject handle to GuardaDados (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
GuardarDados;
% --- Executes on button press in LerDados.
function LerDados_Callback(hObject, eventdata, handles)
% hObject handle to LerDados (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.output = hObject;
xx{1}=[' '];
%set(handles.listboxPos,'String',str_listbox);
set(handles.listboxPos,'String',xx);
set(handles.listboxPos,'Value',1);
clear global tabela_pos
global tabela_pos;
global hObjectx evendatax handlesx
hObjectx=hObject;
handlesx=handles;
%SimuladorCs('LerDados',hObject,eventdata,handles);
LerDados;