⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cinematicadirecta2.m

📁 Simulador de orientacion posicion de un brazo robotico de cuatro grados de libertad, en GUI de matla
💻 M
📖 第 1 页 / 共 3 页
字号:
function Q3_Callback(hObject, eventdata, handles)

handles.Q3=get(hObject,'Value');                            %captura el valor del slider Q1 
set(handles.Q3edit,'String',(round(handles.Q3*100))/100);    %colocar el valor del slider en el edit le hace un redondeo

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);

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function Q3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Q3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on slider movement.
function Q4_Callback(hObject, eventdata, handles)
% hObject    handle to Q4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.Q4=get(hObject,'Value');                            %captura el valor del slider Q1 
set(handles.Q4edit,'String',(round(handles.Q4*100))/100);    %colocar el valor del slider en el edit le hace un redondeo

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);

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function Q4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Q4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



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


% --- Executes during object creation, after setting all properties.
function sx_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sx (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 sy_Callback(hObject, eventdata, handles)
% hObject    handle to sy (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 sy as text
%        str2double(get(hObject,'String')) returns contents of sy as a double


% --- Executes during object creation, after setting all properties.
function sy_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sy (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 sz_Callback(hObject, eventdata, handles)
% hObject    handle to sz (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 sz as text
%        str2double(get(hObject,'String')) returns contents of sz as a double


% --- Executes during object creation, after setting all properties.
function sz_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sz (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 ax_Callback(hObject, eventdata, handles)
% hObject    handle to ax (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 ax as text
%        str2double(get(hObject,'String')) returns contents of ax as a double


% --- Executes during object creation, after setting all properties.
function ax_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ax (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 ay_Callback(hObject, eventdata, handles)
% hObject    handle to ay (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 ay as text
%        str2double(get(hObject,'String')) returns contents of ay as a double


% --- Executes during object creation, after setting all properties.
function ay_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ay (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 az_Callback(hObject, eventdata, handles)
% hObject    handle to az (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 az as text
%        str2double(get(hObject,'String')) returns contents of az as a double


% --- Executes during object creation, after setting all properties.
function az_CreateFcn(hObject, eventdata, handles)
% hObject    handle to az (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 slider movement.
function Q5_Callback(hObject, eventdata, handles)
% hObject    handle to Q5 (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,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function Q5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Q5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



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


% --- Executes during object creation, after setting all properties.
function Q5edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Q5edit (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 + -