📄 rrrproject3.asv
字号:
% This Project is to simulate the 3RRR robot% Created by Gan Tao taogan@eng.buffalo.edu% Graduate Student of SUNY Buffalo% Date: Jan.2004% rrrproject3.m is the main programme.% Contain the subfunctions : angledisply.m % varmakeup.m % emptycheck.m% RRRdrawing.m% clickInverse.m% pathtrack.m% startpathtrack.m% stoppathtrack.m% nothingfcn.m% RRRproject3.figfunction varargout = RRRproject3(varargin)global figglobal CC kglobal InVS% global Rec_Movie% global Rec_Movie% RRRPROJECT3 Application M-file for RRRproject3.fig% FIG = RRRPROJECT3 launch RRRproject3 GUI.% RRRPROJECT3('callback_name', ...) invoke the named callback.% Last Modified by GUIDE v2.5 13-Feb-2004 13:15:30% global frameADCC = 0;k = 1;InVS= 0;% Rec_Movie = 0;if nargin == 0 % LAUNCH GUI % fig = figure(1) fig = openfig(mfilename,'reuse'); set(fig,'WindowButtonDownFcn',@startpathtrack);% set(fig,'WindowButtonMotionFcn',@pathtrack); set(fig,'WindowButtonUpFcn',@stoppathtrack); % Generate a structure of handles to pass to callbacks, and store it. handles = guihandles(fig); handles.number_errors = 0; guidata(fig, handles); if nargout > 0 varargout{1} = fig; endelseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK try if (nargout) [varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard else feval(varargin{:}); % FEVAL switchyard end catch disp(lasterr); endend% frameAD =uicontrol(fig,'Style','frame','Units','characters', ...% 'Position',[9.8 0.9 91.8 7.54],'visible','off');% frameAD =uicontrol(fig,'Style','frame','Units','characters', ...% 'visible','off');%| ABOUT CALLBACKS:%| GUIDE automatically appends subfunction prototypes to this file, and %| sets objects' callback properties to call them through the FEVAL %| switchyard above. This comment describes that mechanism.%|%| Each callback subfunction declaration has the following form:%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)%|%| The subfunction name is composed using the object's Tag and the %| callback type separated by '_', e.g. 'slider2_Callback',%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.%|%| h is the callback object's handle (obtained using GCBO).%|%| EVENTDATA is empty, but reserved for future use.%|%| HANDLES is a structure containing handles of components in GUI using%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This%| structure is created at GUI startup using GUIHANDLES and stored in%| the figure's application data using GUIDATA. A copy of the structure%| is passed to each callback. You can store additional information in%| this structure at GUI startup, and you can change the structure%| during callbacks. Call guidata(h, handles) after changing your%| copy to replace the stored original so that subsequent callbacks see%| the updates. Type "help guihandles" and "help guidata" for more%| information.%|%| VARARGIN contains any extra arguments you have passed to the%| callback. Specify the extra arguments by editing the callback%| property in the inspector. By default, GUIDE sets the property to:%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))%| Add any extra arguments after the last argument, before the final%| closing parenthesis.% --------------------------------------------------------------------function varargout = sliderbase1x_Callback(h, eventdata, handles, varargin)global Xp Ypglobal S1 S2 S3global Ypb Ypc Xpb Xpc global Xg Yg faiglobal H a1 b1set(handles.editbase1x,'String',num2str(get(handles.sliderbase1x,'Value')));Xp = get(handles.sliderbase1x,'Value');if emptycheck varmakeup; RRRdrawing(S1,S2,S3)else RRRdrawing(S1,S2,S3)end% --------------------------------------------------------------------function varargout = sliderbase1y_Callback(h, eventdata, handles, varargin)global Xp Yp k12 % coordinates of each point of the limb1global S1 S2 S3global ADset(handles.editbase1y,'String',num2str(get(handles.sliderbase1y,'Value')));Yp = get(handles.sliderbase1y,'Value');if emptycheck varmakeup; RRRdrawing(S1,S2,S3)else RRRdrawing(S1,S2,S3)end% --------------------------------------------------------------------function varargout = sliderbase2x_Callback(h, eventdata, handles, varargin)global Xpb Ypb k21global S1 S2 S3set(handles.editbase2x,'String',num2str(get(handles.sliderbase2x,'Value')));Xpb = get(handles.sliderbase2x,'Value');if emptycheck varmakeup; RRRdrawing(S1,S2,S3)else RRRdrawing(S1,S2,S3)end% --------------------------------------------------------------------function varargout = slider4_Callback(h, eventdata, handles, varargin)global Xpb Ypb k22global S1 S2 S3set(handles.editbase2y,'String',num2str(get(handles.sliderbase2y,'Value')));Ypb = get(handles.sliderbase2y,'Value');if emptycheck varmakeup; RRRdrawing(S1,S2,S3)else RRRdrawing(S1,S2,S3)endk22 =1;% --------------------------------------------------------------------function varargout = slider5_Callback(h, eventdata, handles, varargin)global Xpc Ypc k31global S1 S2 S3set(handles.editbase3x,'String',num2str(get(handles.sliderbase3x,'Value')));Xpc = get(handles.sliderbase3x,'Value');if emptycheck varmakeup; RRRdrawing(S1,S2,S3)else RRRdrawing(S1,S2,S3)endk31 = 1;% --------------------------------------------------------------------function varargout = slider6_Callback(h, eventdata, handles, varargin)global Xpc Ypc k32global S1 S2 S3set(handles.editbase3y,'String',num2str(get(handles.sliderbase3y,'Value')));Ypc = get(handles.sliderbase3y,'Value');if emptycheck varmakeup; RRRdrawing(S1,S2,S3)else RRRdrawing(S1,S2,S3)endk32 = 1;% --------------------------------------------------------------------function varargout = editbase1x_Callback(h, eventdata, handles, varargin)global Xp Yp Xa Ya Xd Yd k11 % coordinates of each point of the limb1global S1 S2 S3k11 = 1;val = str2double(get(handles.editbase1x,'String'));if isnumeric(val) & length(val)==1 & val >= get(handles.sliderbase1x,'Min') & val <= get(handles.sliderbase1x,'Max') set(handles.sliderbase1x,'Value',val); Xp = val; if emptycheck varmakeup; RRRdrawing(S1,S2,S3) else RRRdrawing(S1,S2,S3) endelse Warnd = text(-10,10,'\fontsize{16} The input is out of range. Try again!','color','r'); set(Warnd,'visible','on') end% --------------------------------------------------------------------function varargout = editbase1y_Callback(h, eventdata, handles, varargin)global Xp Yp Xa Ya Xd Yd k12 % coordinates of each point of the limb1global S1 S2 S3k12 = 1;val = str2double(get(handles.editbase1y,'String'));if isnumeric(val) & length(val)==1 & val >= get(handles.sliderbase1y,'Min') & val <= get(handles.sliderbase1y,'Max') set(handles.sliderbase1y,'Value',val); Yp = val; if emptycheck varmakeup; RRRdrawing(S1,S2,S3) else RRRdrawing(S1,S2,S3) endelse Warnd = text(-10,10,'\fontsize{16} The input is out of range. Try again!','color','r'); set(Warnd,'visible','on') end% --------------------------------------------------------------------function varargout = edit3_Callback(h, eventdata, handles, varargin)global Xpb Ypb k21global S1 S2 S3k21 = 1;val = str2double(get(handles.editbase2x,'String'));if isnumeric(val) & length(val)==1 & val >= get(handles.sliderbase2x,'Min') & val <= get(handles.sliderbase2x,'Max') set(handles.sliderbase2x,'Value',val); Xpb = val; if emptycheck varmakeup; RRRdrawing(S1,S2,S3) else RRRdrawing(S1,S2,S3) endelse Warnd = text(-10,10,'\fontsize{16} The input is out of range. Try again!','color','r'); set(Warnd,'visible','on') end% --------------------------------------------------------------------function varargout = edit4_Callback(h, eventdata, handles, varargin)global Xpb Ypb k22global S1 S2 S3k22 = 1;val = str2double(get(handles.editbase2y,'String'));if isnumeric(val) & length(val)==1 & val >= get(handles.sliderbase2y,'Min') & val <= get(handles.sliderbase2y,'Max') set(handles.sliderbase2y,'Value',val); Ypb = val; if emptycheck varmakeup; RRRdrawing(S1,S2,S3) else RRRdrawing(S1,S2,S3) endelse Warnd = text(-10,10,'\fontsize{16} The input is out of range. Try again!','color','r'); set(Warnd,'visible','on') end% --------------------------------------------------------------------function varargout = edit5_Callback(h, eventdata, handles, varargin)global Xpc Ypc k31global S1 S2 S3k31 = 1;val = str2double(get(handles.editbase3x,'String'));if isnumeric(val) & length(val)==1 & val >= get(handles.sliderbase3x,'Min') & val <= get(handles.sliderbase3x,'Max') set(handles.sliderbase3x,'Value',val); Xpc = val; if emptycheck varmakeup; RRRdrawing(S1,S2,S3) else RRRdrawing(S1,S2,S3) endelse Warnd = text(-10,10,'\fontsize{16} The input is out of range. Try again!','color','r'); set(Warnd,'visible','on') end% --------------------------------------------------------------------function varargout = edit6_Callback(h, eventdata, handles, varargin)global Xpc Ypc k32global S1 S2 S3k32 = 1;val = str2double(get(handles.editbase3y,'String'));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -