You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

158 lines
6.3 KiB

function varargout = gui_motion(varargin)
% GUI_MOTION MATLAB code for gui_motion.fig
% GUI_MOTION, by itself, creates a new GUI_MOTION or raises the existing
% singleton*.
%
% H = GUI_MOTION returns the handle to a new GUI_MOTION or the handle to
% the existing singleton*.
%
% GUI_MOTION('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI_MOTION.M with the given input arguments.
%
% GUI_MOTION('Property','Value',...) creates a new GUI_MOTION or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before gui_motion_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to gui_motion_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 gui_motion
% Last Modified by GUIDE v2.5 28-Apr-2015 14:51:33
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @gui_motion_OpeningFcn, ...
'gui_OutputFcn', @gui_motion_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 gui_motion is made visible.
function gui_motion_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 gui_motion (see VARARGIN)
% Choose default command line output for gui_motion
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
update_Labels(hObject, eventdata, handles);
eventdata; % unused
% UIWAIT makes gui_motion wait for user response (see UIRESUME)
% uiwait(handles.figure1);
function varargout = gui_motion_OutputFcn(~, ~, handles)
varargout{1} = handles.output;
function update_Labels(~, ~, handles)
set(handles.label_delta, 'String', [sprintf('%.4G',get(handles.slider_delta,'Value')),' °']);
set(handles.label_x_start, 'String', [sprintf('%.4G',get(handles.slider_x_start,'Value')),' °']);
set(handles.label_x_end, 'String', [sprintf('%.4G',get(handles.slider_x_end,'Value')),' °']);
set(handles.label_y_start, 'String', [sprintf('%.4G',get(handles.slider_y_start,'Value')),' °']);
set(handles.label_y_end, 'String', [sprintf('%.4G',get(handles.slider_y_end,'Value')),' °']);
set(handles.label_z_start, 'String', [sprintf('%.4G',get(handles.slider_z_start,'Value')),' °']);
set(handles.label_z_end, 'String', [sprintf('%.4G',get(handles.slider_z_end,'Value')),' °']);
set(handles.label_tx_start, 'String', [sprintf('%.4G',get(handles.slider_tx_start,'Value')),' mm']);
set(handles.label_tx_end, 'String', [sprintf('%.4G',get(handles.slider_tx_end,'Value')),' mm']);
set(handles.label_ty_start, 'String', [sprintf('%.4G',get(handles.slider_ty_start,'Value')),' mm']);
set(handles.label_ty_end, 'String', [sprintf('%.4G',get(handles.slider_ty_end,'Value')),' mm']);
set(handles.label_tz_start, 'String', [sprintf('%.4G',get(handles.slider_tz_start,'Value')),' mm']);
set(handles.label_tz_end, 'String', [sprintf('%.4G',get(handles.slider_tz_end,'Value')),' mm']);
set(handles.label_time, 'String', [sprintf('%.4G',get(handles.slider_time,'Value')),' s']);
set(handles.label_resolution,'String', [sprintf('%.4G',get(handles.slider_resolution,'Value')),' ms']);
m = get(handles.start_simulation,'UserData');
% set label of start/stop
if (isempty(m) || m.run == false)
set(handles.start_simulation,'String','Start simulation');
else
set(handles.start_simulation,'String','Stop simulation');
%apply new values
m.rx = [ get(handles.slider_x_start,'Value') get(handles.slider_x_end,'Value') ]/180*pi;
m.ry = [ get(handles.slider_z_start,'Value') get(handles.slider_y_end,'Value') ]/180*pi;
m.rz = [ get(handles.slider_y_start,'Value') get(handles.slider_z_end,'Value') ]/180*pi;
m.tx = [ get(handles.slider_tx_start,'Value') get(handles.slider_tx_end,'Value') ];
m.ty = [ get(handles.slider_tz_start,'Value') get(handles.slider_ty_end,'Value') ];
m.tz = [ get(handles.slider_ty_start,'Value') get(handles.slider_tz_end,'Value') ];
m.delta = [ get(handles.slider_delta,'Value') get(handles.slider_delta,'Value') ]/180*pi;
m.arm = get(handles.arm,'Value');
m.elbow = get(handles.arm,'Value');
m.flip = get(handles.arm,'Value');
m.time = get(handles.slider_time,'Value');
c = get(handles.core,'Value');
s = get(handles.core,'String');
m.core = s{c};
c = get(handles.type,'Value');
s = get(handles.type,'String');
m.type = s{c};
end
function start_simulation_Callback(~, ~, handles)
% generate motion_config
m = get(handles.start_simulation,'UserData');
if (isempty(m))
m = motion_config();
set(handles.start_simulation,'UserData',m);
m.run = false;
end
if (m.run == true)
m.run = false;
update_Labels([], [], handles)
else
m.run = true;
update_Labels([], [], handles)
m.joinsfig = handles.joins;
m.joinsdfig = handles.joinsd;
m.joinsddfig = handles.joinsdd;
m.robofig = handles.robofig;
c = get(handles.core,'Value')
s = get(handles.core,'String')
m.core = s{c};
c = get(handles.type,'Value')
s = get(handles.type,'String')
m.type = s{c};
m
control_motion(m);
end
function Exit_Callback(~, ~, ~)
try
close 1;
end
set(0, 'DefaultFigurePosition', 'factory')
close(gui_motion)