📄 cinematicadirecta2.m
字号:
function varargout = cinematicadirecta2(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @cinematicadirecta2_OpeningFcn, ...
'gui_OutputFcn', @cinematicadirecta2_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 cinematicadirecta2 is made visible.
function cinematicadirecta2_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 cinematicadirecta2 (see VARARGIN)
% Choose default command line output for cinematicadirecta2
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes cinematicadirecta2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
%Q1
set(handles.Q1,'Value',0);
set(handles.Q1edit,'String',0);
%Q2
set(handles.Q2,'Value',0);
set(handles.Q2edit,'String',0);
%Q3
set(handles.Q3,'Value',0);
set(handles.Q3edit,'String',0);
%Q4
set(handles.Q4,'Value',0);
set(handles.Q4edit,'String',0);
q1=str2double(get(handles.Q1edit,'string'));
q2=str2double(get(handles.Q2edit,'string'));
q3=str2double(get(handles.Q3edit,'string'));
q4=str2double(get(handles.Q4edit,'string'));
L1 = 1596;
L2 = 390;
L3 = 1220;
L4 = 1555;
L5 = 172;
dh = [pi/2, L1, L2, -pi/2, 0;
-pi/2, 0, L3, 0, 0;
pi/2, 0, L4, pi/2, 0;
0, -L5, 0, 0, 0];
q=[q1,q2,q3,q4]*pi/180;
A = directa(dh,q);
set(handles.nx,'String',(round((A(1,1))*100))/100);
set(handles.ny,'String',(round((A(2,1))*100))/100);
set(handles.nz,'String',(round((A(3,1))*100))/100);
set(handles.sx,'String',(round((A(1,2))*100))/100);
set(handles.sy,'String',(round((A(2,2))*100))/100);
set(handles.sz,'String',(round((A(3,2))*100))/100);
set(handles.ax,'String',(round((A(1,3))*100))/100);
set(handles.ay,'String',(round((A(2,3))*100))/100);
set(handles.az,'String',(round((A(3,3))*100))/100);
set(handles.Px,'String',(round((A(1,4))*100))/100);
set(handles.Py,'String',(round((A(2,4))*100))/100);
set(handles.Pz,'String',(round((A(3,4))*100))/100);
% --- Outputs from this function are returned to the command line.
function varargout = cinematicadirecta2_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 Px_Callback(hObject, eventdata, handles)
% hObject handle to Px (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 Px as text
% str2double(get(hObject,'String')) returns contents of Px as a double
% --- Executes during object creation, after setting all properties.
function Px_CreateFcn(hObject, eventdata, handles)
% hObject handle to Px (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 Py_Callback(hObject, eventdata, handles)
% hObject handle to Py (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 Py as text
% str2double(get(hObject,'String')) returns contents of Py as a double
% --- Executes during object creation, after setting all properties.
function Py_CreateFcn(hObject, eventdata, handles)
% hObject handle to Py (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 Pz_Callback(hObject, eventdata, handles)
% hObject handle to Pz (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 Pz as text
% str2double(get(hObject,'String')) returns contents of Pz as a double
% --- Executes during object creation, after setting all properties.
function Pz_CreateFcn(hObject, eventdata, handles)
% hObject handle to Pz (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 nx_Callback(hObject, eventdata, handles)
% hObject handle to nx (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 nx as text
% str2double(get(hObject,'String')) returns contents of nx as a double
% --- Executes during object creation, after setting all properties.
function nx_CreateFcn(hObject, eventdata, handles)
% hObject handle to nx (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 ny_Callback(hObject, eventdata, handles)
% hObject handle to ny (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 ny as text
% str2double(get(hObject,'String')) returns contents of ny as a double
% --- Executes during object creation, after setting all properties.
function ny_CreateFcn(hObject, eventdata, handles)
% hObject handle to ny (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 nz_Callback(hObject, eventdata, handles)
% hObject handle to nz (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 nz as text
% str2double(get(hObject,'String')) returns contents of nz as a double
% --- Executes during object creation, after setting all properties.
function nz_CreateFcn(hObject, eventdata, handles)
% hObject handle to nz (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 Q4edit_Callback(hObject, eventdata, handles)
le=str2double(get(hObject,'String'));
if le>180
errordlg('Valor incorrecto o fuera del rango en Q4 "Debe ser un valor entre -180 y 180"','ALERTA');
set(handles.Q4,'Value',180);
set(handles.Q4edit,'string',180);
end
if le<-180
errordlg('Valor incorrecto o fuera del rango en Q4 "Debe ser un valor entre -180 y 180"','ALERTA');
set(handles.Q4,'Value',-180);
set(handles.Q4edit,'string',-180);
end
if le<=180 & le>=-180
set(handles.Q4,'Value',str2double(get(hObject,'String')));
end
q1=str2double(get(handles.Q1edit,'string'));
q2=str2double(get(handles.Q2edit,'string'));
q3=str2double(get(handles.Q3edit,'string'));
q4=str2double(get(handles.Q4edit,'string'));
L1 = 1596;
L2 = 390;
L3 = 1220;
L4 = 1555;
L5 = 172;
dh = [pi/2, L1, L2, -pi/2, 0;
-pi/2, 0, L3, 0, 0;
pi/2, 0, L4, pi/2, 0;
0, -L5, 0, 0, 0];
q=[q1,q2,q3,q4]*pi/180;
A = directa(dh,q);
set(handles.nx,'String',(round((A(1,1))*100))/100);
set(handles.ny,'String',(round((A(2,1))*100))/100);
set(handles.nz,'String',(round((A(3,1))*100))/100);
set(handles.sx,'String',(round((A(1,2))*100))/100);
set(handles.sy,'String',(round((A(2,2))*100))/100);
set(handles.sz,'String',(round((A(3,2))*100))/100);
set(handles.ax,'String',(round((A(1,3))*100))/100);
set(handles.ay,'String',(round((A(2,3))*100))/100);
set(handles.az,'String',(round((A(3,3))*100))/100);
set(handles.Px,'String',(round((A(1,4))*100))/100);
set(handles.Py,'String',(round((A(2,4))*100))/100);
set(handles.Pz,'String',(round((A(3,4))*100))/100);
% --- Executes during object creation, after setting all properties.
function Q4edit_CreateFcn(hObject, eventdata, handles)
% hObject handle to Q4edit (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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -