function varargout = A_4RRR_Gui(varargin)
% A_4RRR_GUI M-file for A_4RRR_Gui.fig
% A_4RRR_GUI, by itself, creates a new A_4RRR_GUI or raises the existing
% singleton*.
%
% H = A_4RRR_GUI returns the handle to a new A_4RRR_GUI or the handle to
% the existing singleton*.
%
% A_4RRR_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in A_4RRR_GUI.M with the given input arguments.
%
% A_4RRR_GUI('Property','Value',...) creates a new A_4RRR_GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before A_4RRR_Gui_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to A_4RRR_Gui_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 A_4RRR_Gui
% Last Modified by GUIDE v2.5 28-May-2009 03:40:59
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @A_4RRR_Gui_OpeningFcn, ...
'gui_OutputFcn', @A_4RRR_Gui_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 A_4RRR_Gui is made visible.
function A_4RRR_Gui_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 A_4RRR_Gui (see VARARGIN)
% Choose default command line output for A_4RRR_Gui
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes A_4RRR_Gui wait for user response (see UIRESUME)
% uiwait(handles.figure1);
clc;
setappdata(0, 'MainGui' , gcf);
setappdata(0, 'MouseButtonDown', 0);
DefaultValues(handles);
% --- Outputs from this function are returned to the command line.
function varargout = A_4RRR_Gui_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 button press in TraceEllipse.
function TraceEllipse_Callback(hObject, eventdata, handles)
% hObject handle to TraceEllipse (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%%
MainGui=getappdata(0, 'MainGui');
d2r=pi/180;
set(handles.Status,'BackgroundColor',[0 0 1] );
set(handles.Status,'String' ,'Tracing...' );
%% Ellipse Parameters
radiusx = get(handles.Radiusx_Slider, 'Value');
ell_angle = get(handles.Ell_Angle_Slider, 'Value')*d2r;
Sim_Angle = get(handles.Simu_Angle_Slider, 'Value')*d2r;
%% Platform Parameters
phi = get(handles.Phi_Slider,'Value')*pi/180;
side_angle = get(handles.Side_Angle_Slider, 'Value')*d2r; % angle between adjascent platform sides(deg)*d2r
%% Base Parameters
bxs = get(handles.Bxs_Slider, 'Value' );
bys = get(handles.Bys_Slider, 'Value' );
Base_Loc = get(handles.AltBaseLoc, 'Value' );
lengths = getappdata(MainGui, 'lengths' );
%% Link Parameters
AltLink1 = get(handles.AltLink1 , 'Value' );
AltLink2 = get(handles.AltLink2 , 'Value' );
AltLink3 = get(handles.AltLink3 , 'Value' );
AltLink4 = get(handles.AltLink4 , 'Value' );
%% Calculations
x=radiusx*cos(ell_angle);%-radiusy*sin(ell_angle);
y=radiusx*sin(ell_angle);%+radiusy*sin(ell_angle);
if Base_Loc==0
bases=[bxs bys; -bxs bys; -bxs -bys; bxs -bys]; % alternate base locations
else
bases=[bxs 0; 0 bys; -bxs 0; 0 -bys]; % alternate base locations
end
j_vars=zeros(2,12);
feasible=1;
ends=myfunc(x,y,phi,side_angle);
for i=1:4
j_vars(1:2,i*3-2:i*3-1)=myrevkin1(bases(i,:),ends(i,:),lengths(i,1:2));
if(j_vars(1,i*2-1)==10)
j_vars(1,i*3)=10;
j_vars(2,i*3)=10;
feasible=0;
else
j_vars(1,i*3)=(i+1)*pi/2+phi;
j_vars(2,i*3)=j_vars(1,i*3);
end
end
if(feasible~=1)
disp('no feasible soln in parallel');
set(handles.indicator,'BackgroundColor',[1 0 0]);
else
set(handles.indicator,'BackgroundColor',[0 1 0]);
end
tspan=0:0.05:Sim_Angle;
j_vars1=[j_vars(AltLink1+1,1:3),j_vars(AltLink2+1,4:6),...
j_vars(AltLink3+1,7:9),j_vars(AltLink4+1,10:12)];
% [T Y]=ode45(@Mydiff,tspan,j_vars1(1,:)); % variable time step solver
Y=ode4(@Mydiff,0:0.05:Sim_Angle,j_vars1(1,:)); T=tspan;
span=length(T);
x=zeros(span,4);
y=zeros(span,4);
axes(handles.plotaxes);
plot(bases(:,1),bases(:,2),'or');
platformplot = getappdata(MainGui,'platformplot');
serplot = getappdata(MainGui,'serplot' );
curveplot = getappdata(MainGui,'curveplot' );
for i=1:length(T)
for i2=1:4
x(i,i2)=bases(i2,1)+lengths(i2,1)*cos(Y(i,i2*3-2))+lengths(i2,2)*cos(Y(i,i2*3-1)+Y(i,i2*3-2))+lengths(i2,3)*cos(Y(i,i2*3));%+Y(i,2)+Y(i,1));
y(i,i2)=bases(i2,2)+lengths(i2,1)*sin(Y(i,i2*3-2))+lengths(i2,2)*sin(Y(i,i2*3-1)+Y(i,i2*3-2))+lengths(i2,3)*sin(Y(i,i2*3));%+Y(i,2)+Y(i,1));
end
set(curveplot,'Xdata',x(1:i,2),'Ydata',y(1:i,2));
parallelplot1(Y(i,:),bases,lengths, platformplot, serplot);
end
set(handles.Status,'BackgroundColor',[0 1 0]);
set(handles.Status,'String' ,'Idle' );
function UpdateDisp(handles,x,y) % Update with new positions
%%
MainGui=getappdata(0, 'MainGui');
d2r=pi/180;
%% Ellipse Parameters
radiusx = get(handles.Radiusx_Slider, 'Value');
ell_angle = get(handles.Ell_Angle_Slider, 'Value')*d2r;
%% Platform Parameters
phi = get(handles.Phi_Slider,'Value')*pi/180;
side_angle = get(handles.Side_Angle_Slider, 'Value')*d2r; % angle between adjascent platform sides(deg)*d2r
%% Base Parameters
bxs = get(handles.Bxs_Slider, 'Value' );
bys = get(handles.Bys_Slider, 'Value' );
Base_Loc = get(handles.AltBaseLoc, 'Value' );
lengths = getappdata(MainGui, 'lengths' );
%% Link Parameters
AltLink1 = get(handles.AltLink1 , 'Value' );
AltLink2 = get(handles.AltLink2 , 'Value' );
AltLink3 = get(handles.AltLink3 , 'Value' );
AltLink4 = get(handles.AltLink4 , 'Value' );
%% Calculations
if(nargin<2)
x=radiusx*cos(ell_angle);%-radiusy*sin(ell_angle);
y=radiusx*sin(ell_angle);%+radiusy*sin(ell_angle);
end
if Base_Loc==0
bases=[bxs bys; -bxs bys; -bxs -bys; bxs -bys]; % alternate base locations
else
bases=[bxs 0; 0 bys; -bxs 0; 0 -bys]; % alternate base locations
end
j_vars=zeros(2,12);
feasible=1;
ends=myfunc(x,y,phi,side_angle);
for i=1:4
j_vars(1:2,i*3-2:i*3-1)=myrevkin1(bases(i,:),ends(i,:),lengths(i,1:2));
if(j_vars(1,i*3-1)==10)
j_vars(1,i*3)=10;
j_vars(2,i*3)=10;
feasible=0;
else
j_vars(1,i*3)=(i+1)*pi/2+phi;
j_vars(2,i*3)=j_vars(1,i*3);
end
end
if(feasible~=1)
disp('no feasible soln in parallel');
set(handles.indicator,'BackgroundColor',[1 0 0]);
else
set(handles.indicator,'BackgroundColor',[0 1 0]);
end
serplot=[];
j_vars1=[j_vars(AltLink1+1,1:3),j_vars(AltLink2+1,4:6),...
j_vars(AltLink3+1,7:9),j_vars(AltLink4+1,10:12)];
[platformplot serplot curveplot]=parallelplot1init(j_vars1(1,:),bases,lengths, serplot);
setappdata(MainGui, 'serplot' , serplot );
setappdata(MainGui, 'platformplot', platformplot);
setappdata(MainGui, 'curveplot' , curveplot );
%%
function DefaultValues(handles)
MainGui=getappdata(0,'MainGui');
setappdata(MainGui, 'radiusx' , 1 );
setappdata(MainGui, 'radiusy' , 2.5 );
setappdata(MainGui, 'ell_angle' , pi/6 );
setappdata(MainGui, 'Sim_Angle' , 6*pi/3);
setappdata(MainGui, 'phi' , 0 );
setappdata(MainGui, 'phidot' , pi/10 );
setappdata(MainGui, 'side_angle', pi/3 );
setappdata(MainGui, 'l' , 2.5 );
setappdata(MainGui, 'bxs' , 4 );
setappdata(MainGui, 'bys' , 4 );
setappdata(MainGui, 'l1a' , 5 );
setappdata(MainGui, 'l2a' , 5 );
setappdata(MainGui, 'Base_Loc' , 0 );
UpdatePlatform(handles);
UpdateDisp(handles);
function UpdatePlatform(handles)
MainGui=getappdata(0,'MainGui');
l1a = getappdata(MainGui, 'l1a' );
l2a = getappdata(MainGui, 'l2a' );
side_angle = getappdata(MainGui, 'side_angle');
l = getappdata(MainGui, 'l' );
l3a=l*cos(side_angle/2); l3b=l*sin(side_angle/2);
len=[l1a l2a l3a; l1a l2a l3b; l1a l2a l3a; l1a l2a l3b];
setappdata(MainGui, 'lengths' , len );
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%% UI CONTROLS START FROM HERE %%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in AltBaseLoc.
function AltBaseLoc_Callback(hObject, eventdata, handles)
MainGui = getappdata(0, 'MainGui');
Base_Loc = get(handles.AltBaseLoc,'Value');
setappdata(MainGui, 'Base_Loc', Base_Loc);
UpdateDisp(handles);
% --- Executes on slider movement.
function Phi_Slider_Callback(hObject, eventdata, handles)
phi=round(get(hObject,'Value'));
set(handles.Phi_EditBox,'String',phi);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'phi',phi*pi/180);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Phi_Slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function Phi_EditBox_Callback(hObject, eventdata, handles)
phi=round(str2double(get(hObject,'String')));
set(handles.Phi_Slider,'Value',phi);
MainGui=getappdata(0, 'MainGui');
setappdata(MainGui,'phi',phi*pi/180);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Phi_EditBox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function Side_Angle_Slider_Callback(hObject, eventdata, handles)
side_angle=round(get(hObject,'Value'));
set(handles.Side_Angle_EditBox,'String',side_angle);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'side_angle',side_angle*pi/180);
UpdatePlatform(handles);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Side_Angle_Slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function Side_Angle_EditBox_Callback(hObject, eventdata, handles)
side_angle=round(str2double(get(hObject,'String')));
set(handles.Side_Angle_Slider,'Value',side_angle);
MainGui=getappdata(0, 'MainGui');
setappdata(MainGui,'side_angle',side_angle*pi/180);
UpdatePlatform(handles);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Side_Angle_EditBox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function l1a_Slider_Callback(hObject, eventdata, handles)
l1a=round(get(hObject,'Value')*10)/10;
set(handles.l1a_EditBox,'String',l1a);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'l1a',l1a);
UpdatePlatform(handles);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function l1a_Slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function l1a_EditBox_Callback(hObject, eventdata, handles)
l1a=round(str2double(get(hObject,'String'))*10)/10;
set(handles.l1a_Slider,'Value',l1a);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'l1a',l1a);
UpdatePlatform(handles);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function l1a_EditBox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function l2a_Slider_Callback(hObject, eventdata, handles)
l2a=round(get(hObject,'Value')*10)/10;
set(handles.l2a_EditBox,'String',l2a);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'l2a',l2a);
UpdatePlatform(handles);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function l2a_Slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function l2a_EditBox_Callback(hObject, eventdata, handles)
l2a=round(str2double(get(hObject,'String'))*10)/10;
set(handles.l2a_Slider,'Value',l2a);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'l2a',l2a);
UpdatePlatform(handles);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function l2a_EditBox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function l_slider_Callback(hObject, eventdata, handles)
l=round(get(hObject,'Value')*10)/10;
set(handles.l_EditBox,'String',l);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'l',l);
UpdatePlatform(handles);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function l_slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function l_EditBox_Callback(hObject, eventdata, handles)
l=round(str2double(get(hObject,'String'))*10)/10;
set(handles.l_Slider,'Value',l);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'l',l);
UpdatePlatform(handles);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function l_EditBox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function Bxs_Slider_Callback(hObject, eventdata, handles)
bxs=round(get(hObject,'Value')*10)/10;
set(handles.Bxs_EditBox,'String',bxs);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'bxs',bxs);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Bxs_Slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function Bxs_EditBox_Callback(hObject, eventdata, handles)
bxs=round(str2double(get(hObject,'String'))*10)/10;
set(handles.Bxs_Slider,'Value',bxs);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'bxs',bxs);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Bxs_EditBox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function Bys_Slider_Callback(hObject, eventdata, handles)
bys=round(get(hObject,'Value')*10)/10;
set(handles.Bys_EditBox,'String',bys);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'bys',bys);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Bys_Slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function Bys_EditBox_Callback(hObject, eventdata, handles)
bys=round(str2double(get(hObject,'String'))*10)/10;
set(handles.Bys_Slider,'Value',bys);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'bys',bys);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Bys_EditBox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function PhiDot_Slider_Callback(hObject, eventdata, handles)
phidot=round(get(hObject,'Value'));
set(handles.PhiDot_EditBox,'String',phidot);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'phidot',phidot*pi/180);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function PhiDot_Slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function PhiDot_EditBox_Callback(hObject, eventdata, handles)
phidot=round(str2double(get(hObject,'String')));
set(handles.PhiDot_Slider,'Value',phidot);
MainGui=getappdata(0, 'MainGui');
setappdata(MainGui,'phidot',phidot*pi/180);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function PhiDot_EditBox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function Ell_Angle_Slider_Callback(hObject, eventdata, handles)
ell_angle=round(get(hObject,'Value'));
set(handles.Ell_Angle_EditBox,'String',ell_angle);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'ell_angle',ell_angle*pi/180);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Ell_Angle_Slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function Ell_Angle_EditBox_Callback(hObject, eventdata, handles)
ell_angle=round(str2double(get(hObject,'String')));
set(handles.Ell_Angle_Slider,'Value',ell_angle);
MainGui=getappdata(0, 'MainGui');
setappdata(MainGui,'ell_angle',ell_angle*pi/180);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Ell_Angle_EditBox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function Radiusx_Slider_Callback(hObject, eventdata, handles)
radiusx=round(get(hObject,'Value')*10)/10;
set(handles.Radiusx_EditBox,'String',radiusx);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'radiusx',radiusx);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Radiusx_Slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function Radiusx_EditBox_Callback(hObject, eventdata, handles)
radiusx=round(str2double(get(hObject,'String'))*10)/10;
set(handles.Radiusx_Slider,'Value',radiusx);
MainGui=getappdata(0, 'MainGui');
setappdata(MainGui,'radiusx',radiusx);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Radiusx_EditBox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function Radiusy_Slider_Callback(hObject, eventdata, handles)
radiusy=round(get(hObject,'Value')*10)/10;
set(handles.Radiusy_EditBox,'String',radiusy);
MainGui = getappdata(0, 'MainGui');
setappdata(MainGui,'radiusy',radiusy);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Radiusy_Slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function Radiusy_EditBox_Callback(hObject, eventdata, handles)
radiusy=round(str2double(get(hObject,'String'))*10)/10;
set(handles.Radiusy_Slider,'Value',radiusy);
MainGui=getappdata(0, 'MainGui');
setappdata(MainGui,'radiusy',radiusy);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Radiusy_EditBox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function Simu_Angle_Slider_Callback(hObject, eventdata, handles)
Sim_Angle=round(get(hObject,'Value'));
set(handles.Simu_Angle_EditBox,'String',Sim_Angle);
MainGui=getappdata(0, 'MainGui');
setappdata(MainGui,'Sim_Angle',Sim_Angle);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Simu_Angle_Slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function Simu_Angle_EditBox_Callback(hObject, eventdata, handles)
Sim_Angle=round(str2double(get(hObject,'String')));
set(handles.Simu_Angle_Slider,'Value',Sim_Angle);
MainGui=getappdata(0, 'MainGui');
setappdata(MainGui,'Sim_Angle',Sim_Angle);
UpdateDisp(handles);
% --- Executes during object creation, after setting all properties.
function Simu_Angle_EditBox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on mouse press over figure background, over a disabled or
% --- inactive control, or over an axes background.
function figure1_WindowButtonDownFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
setappdata(0, 'MouseButtonDown', 1);
set(handles.Status,'BackgroundColor',[0 0 1] );
set(handles.Status,'String' ,'Tracking...' );
% --- Executes on mouse press over figure background, over a disabled or
% --- inactive control, or over an axes background.
function figure1_WindowButtonUpFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
setappdata(0, 'MouseButtonDown', 0);
set(handles.Status,'BackgroundColor',[0 1 0]);
set(handles.Status,'String' ,'Idle' );
X=get(hObject,'CurrentPoint');
% axis x center coordinate = [5(left placement of axes)+0.5*100(width of axes)]*[20(range of axes -10 to 10)/width of axes(100)]
x=(X(1)-55)*0.2;
% axis x center coordinate = [15(bottom placement of axes)+0.5*30(width of axes)]*[20(range of axes -10 to 10)/height of axes(30)]
y=(X(2)-30)*2/3;
UpdateDisp(handles,x,y);
% --- Executes on mouse motion over figure - except title and menu.
function figure1_WindowButtonMotionFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
MouseButtonDown = getappdata(0, 'MouseButtonDown');
if MouseButtonDown==1
X=get(hObject,'CurrentPoint');
x=(X(1)-55)*0.2;
y=(X(2)-30)*2/3;
UpdateDisp(handles,x,y);
end
% --- Executes on button press in LoadDefaults.
function LoadDefaults_Callback(hObject, eventdata, handles)
% hObject handle to LoadDefaults (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.Phi_Slider,'Value',0);
set(handles.Phi_EditBox,'String',0);
set(handles.PhiDot_Slider,'Value',10);
set(handles.PhiDot_EditBox,'String',10);
set(handles.Side_Angle_Slider,'Value',60);
set(handles.Side_Angle_EditBox,'String',60);
set(handles.l1a_Slider,'Value',5);
set(handles.l1a_EditBox,'String',5);
set(handles.l2a_Slider,'Value',5);
set(handles.l2a_EditBox,'String',5);
set(handles.l_slider,'Value',3.5);
set(handles.l_EditBox,'String',3.5);
set(handles.Bxs_Slider,'Value',4);
set(handles.Bxs_EditBox,'String',4);
set(handles.Bys_Slider,'Value',4);
set(handles.Bys_EditBox,'String',4);
set(handles.Ell_Angle_Slider,'Value',30);
set(handles.Ell_Angle_EditBox,'String',30);
set(handles.Radiusx_Slider,'Value',1.5);
set(handles.Radiusx_EditBox,'String',1.5);
set(handles.Radiusy_Slider,'Value',2.5);
set(handles.Radiusy_EditBox,'String',2.5);
set(handles.Simu_Angle_Slider,'Value',270);
set(handles.Simu_Angle_EditBox,'String',270);
UpdateDisp(handles);
% --- Executes on button press in AltLink1.
function AltLink1_Callback(hObject, eventdata, handles)
% hObject handle to AltLink1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of AltLink1
UpdateDisp(handles);
% --- Executes on button press in AltLink2.
function AltLink2_Callback(hObject, eventdata, handles)
% hObject handle to AltLink2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of AltLink2
UpdateDisp(handles);
% --- Executes on button press in AltLink3.
function AltLink3_Callback(hObject, eventdata, handles)
% hObject handle to AltLink3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of AltLink3
UpdateDisp(handles);
% --- Executes on button press in AltLink4.
function AltLink4_Callback(hObject, eventdata, handles)
% hObject handle to AltLink4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of AltLink4
UpdateDisp(handles);