标题:
机械臂运动学动力学及轨迹规划GUI界面MATLAB源码
[打印本页]
作者:
汪lele
时间:
2018-4-25 15:33
标题:
机械臂运动学动力学及轨迹规划GUI界面MATLAB源码
基于MATLAB的机械臂运动学动力学及轨迹规划GUI界面
0.png
(50.43 KB, 下载次数: 49)
下载附件
2018-4-25 19:02 上传
单片机源程序如下:
function varargout = jacobface(varargin)
% JACOBFACE MATLAB code for jacobface.fig
% JACOBFACE, by itself, creates a new JACOBFACE or raises the existing
% singleton*.
%
% H = JACOBFACE returns the handle to a new JACOBFACE or the handle to
% the existing singleton*.
%
% JACOBFACE('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in JACOBFACE.M with the given input arguments.
%
% JACOBFACE('Property','Value',...) creates a new JACOBFACE or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before jacobface_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to jacobface_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
% Edit the above text to modify the response to help jacobface
% Last Modified by GUIDE v2.5 16-Nov-2011 20:35:50
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @jacobface_OpeningFcn, ...
'gui_OutputFcn', @jacobface_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 jacobface is made visible.
function jacobface_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 jacobface (see VARARGIN)
% Choose default command line output for jacobface
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes jacobface wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = jacobface_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;
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu 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 edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (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 edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (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 pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%从外部文件导入关节速度数据
global Q6;
Q6=csvread('关节速度.txt');
set(handles.uitable1,'data',Q6);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%将关节速度数据导入外部文件进行保存
global Q6;
csvwrite('关节速度.txt',get(handles.uitable1,'data'));
% --- Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu2
% --- Executes during object creation, after setting all properties.
function popupmenu2_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu 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 edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (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 edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (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 pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%将末端操作器速度数据导入外部文件进行保存
global Q7;
Q7=csvread('末端速度.txt');
set(handles.uitable2,'data',Q7);
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%将末端操作器速度数据导入外部文件进行保存
global Q7;
csvwrite('末端速度.txt',get(handles.uitable2,'data'));
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%正向雅克比:由关节速度推算末端操作器的速度
global L Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q QD QDD ICAN DH JACOB;
Q7=Q6*JACOB';
set(handles.uitable2,'data',Q7);%将关节速度写入表格2
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global L Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q QD QDD ICAN DH JACOB;
Q6=Q7/JACOB';
set(handles.uitable1,'data',Q6);%将关节速度写入表格2
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%该界面消失返回主界面
set(jacobface,'visible','off');
% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%计算雅克比矩阵
global L Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q QD QDD ICAN DH JACOB;
JACOB=jacob0(ICAN,Q);
set(handles.uitable3,'data',JACOB);%将雅克比矩阵写入表格一
% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global L Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q QD QDD ICAN DH JACOB;
%写入各个关节的速度
i=get(handles.popupmenu1,'value');%选择输入第I个关节的速度
Q6(i)=str2num(get(handles.edit1,'string'));
set(handles.uitable1,'data',Q6);%将关节速度写入表格2
% --- Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global L Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q QD QDD ICAN DH JACOB;
%写入末端操作器各个方向的速度和角速度
i=get(handles.popupmenu2,'value');%选择输入第I个关节的速度
Q7(i)=str2num(get(handles.edit2,'string'));
set(handles.uitable2,'data',Q7);%将关节速度写入表格2
复制代码
所有资料51hei提供下载:
机器臂运动学、动力学轨迹规划界面.rar
(58.23 KB, 下载次数: 80)
2018-4-25 15:33 上传
点击文件名下载附件
下载积分: 黑币 -5
作者:
fq123f
时间:
2020-7-10 12:18
代码显示回调函数错误?
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1