No BSD License  

Highlights from
Gantry robot simulation

image thumbnail

Gantry robot simulation

by

 

11 Oct 2007 (Updated )

Supervisory and low level robot tracking control of a 5-bar or articulated gantry using desired posi

gantry_gui(varargin)
function varargout = gantry_gui(varargin)
% GANTRY_GUI M-file for gantry_gui.fig
%      GANTRY_GUI, by itself, creates a new GANTRY_GUI or raises the existing
%      singleton*.
%
%      H = GANTRY_GUI returns the handle to a new GANTRY_GUI or the handle to
%      the existing singleton*.
%
%      GANTRY_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in GANTRY_GUI.M with the given input arguments.
%
%      GANTRY_GUI('Property','Value',...) creates a new GANTRY_GUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before gantry_gui_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to gantry_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 gantry_gui

% Last Modified by GUIDE v2.5 24-Jan-2005 19:44:28

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @gantry_gui_OpeningFcn, ...
                   'gui_OutputFcn',  @gantry_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 gantry_gui is made visible.
function gantry_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 gantry_gui (see VARARGIN)

% Choose default command line output for gantry_gui
handles.output = hObject;
handles.modelname='gantry';
handles.gui_signal_path='/supervisory controller/gui_button_signals/';
handles.gui_object_path='/Video position input/Video derived pos/Object of Interest/Image From File';
%062805
%set_param([handles.modelname,handles.gui_object_path],'Filename','tri.png')

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes gantry_gui wait for user response (see UIRESUME)
% uiwait(handles.figure1);

assignin('base','handles',handles);

% --- Outputs from this function are returned to the command line.
function varargout = gantry_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 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)
%track
temp=str2num(get_param([handles.modelname, handles.gui_signal_path, 'u_track_source'], 'Value'));
if temp < .5
    set_param([handles.modelname, handles.gui_signal_path, 'u_track_source'], 'Value', '1')
else
    set_param([handles.modelname, handles.gui_signal_path, 'u_track_source'], 'Value', '0')
end




% --- 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)
%pickup
temp=str2num(get_param([handles.modelname, handles.gui_signal_path, 'u_pickup_source'], 'Value'));
if temp < .5
    set_param([handles.modelname, handles.gui_signal_path, 'u_pickup_source'], 'Value', '1')
else
    set_param([handles.modelname, handles.gui_signal_path, 'u_pickup_source'], 'Value', '0')
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)
%return
temp=str2num(get_param([handles.modelname, handles.gui_signal_path, 'u_return_source'], 'Value'));
if temp < .5
    set_param([handles.modelname, handles.gui_signal_path, 'u_return_source'], 'Value', '1')
else
    set_param([handles.modelname, handles.gui_signal_path, 'u_return_source'], 'Value', '0')
end


% --- Executes on button press in dropbutton.
function dropbutton_Callback(hObject, eventdata, handles)
% hObject    handle to dropbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
temp=str2num(get_param([handles.modelname, handles.gui_signal_path, 'u_drop_source'], 'Value'));
if temp < .5
    set_param([handles.modelname, handles.gui_signal_path, 'u_drop_source'], 'Value', '1')
else
    set_param([handles.modelname, handles.gui_signal_path, 'u_drop_source'], 'Value', '0')
end


% --- Executes on button press in offbutton.
function offbutton_Callback(hObject, eventdata, handles)
% hObject    handle to offbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
temp=str2num(get_param([handles.modelname, handles.gui_signal_path, 'u_off_source'], 'Value'));
if temp < .5
    set_param([handles.modelname, handles.gui_signal_path, 'u_off_source'], 'Value', '1')
else
    set_param([handles.modelname, handles.gui_signal_path, 'u_off_source'], 'Value', '0')
end


% --- Executes on button press in autopickbutton.
function autopickbutton_Callback(hObject, eventdata, handles)
% hObject    handle to autopickbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
temp=str2num(get_param([handles.modelname, handles.gui_signal_path, 'u_autopick_source'], 'Value'));
if temp < .5
    set_param([handles.modelname, handles.gui_signal_path, 'u_autopick_source'], 'Value', '1')
else
    set_param([handles.modelname, handles.gui_signal_path, 'u_autopick_source'], 'Value', '0')
end


% --- Executes on selection change in shapeselector.
function shapeselector_Callback(hObject, eventdata, handles)
% hObject    handle to shapeselector (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns shapeselector contents as cell array
%        contents{get(hObject,'Value')} returns selected item from shapeselector

val=get(hObject, 'Value');
switch val
  case 1
    set_param([handles.modelname,handles.gui_object_path],'Filename','green_rectangle320_240.JPG')
  case 2
    set_param([handles.modelname,handles.gui_object_path],'Filename','red_triangle320_240.JPG')
  case 3
    set_param([handles.modelname,handles.gui_object_path],'Filename','yellow_square320_240.JPG')
end



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


% --- Executes on button press in manualbutton.
function manualbutton_Callback(hObject, eventdata, handles)
% hObject    handle to manualbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject    handle to slider1 (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 slider1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider1 (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 slider2_Callback(hObject, eventdata, handles)
% hObject    handle to slider2 (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 slider2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider2 (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 button press in sim_off.
function sim_off_Callback(hObject, eventdata, handles)
% hObject    handle to sim_off (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set_param(handles.modelname, 'SimulationCommand', 'stop')
set(handles.dynamic_plant_state, 'String', 'sim stopped')



% --- Executes on button press in start_button.
function start_button_Callback(hObject, eventdata, handles)
% hObject    handle to start_button (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set_param(handles.modelname, 'SimulationCommand', 'start')
set(handles.dynamic_plant_state, 'String', 'sim started')

Contact us