📄 simuladorcs.m
字号:
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 06-Feb-2008 04:56:05
% 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','Posi玢o X');
set(handles.PY,'String','Posi玢o Y');
set(handles.PZ,'String','Posi玢o Z');
set(handles.rbcinemdirect,'String','Cinem醫ica Directa');
set(handles.rbcineminv,'String','Cinem醫ica Inversa');
set(handles.uipanelCineDirect,'Title','Cinem醫ica Directa');
set(handles.uipanel10,'Title','Traject髍ias');
set(handles.uipCinInv,'Title','Cinem醫ica Inversa');
set(handles.text28,'String','Posi玢o X =');
set(handles.text29,'String','Posi玢o Y =');
set(handles.text30,'String','Posi玢o Z =');
set(handles.uipanel7,'Title','Posi玢o 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('耼gulo 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('Dist鈔cia 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('Dist鈔cia 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('耼gulo 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('耼gulo 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');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -