I got rid of GlobalVars, added comments, and made "step" plot every time

release/4.3a0
Frank Dellaert 2012-06-10 03:31:09 +00:00
parent 80e2179a8d
commit 44530b2291
9 changed files with 203 additions and 231 deletions

View File

@ -1,2 +1,15 @@
VisualISAMGlobalVars % VisualISAMDemo: runs VisualSLAM iSAM demo in a GUI
% Authors: Duy Nguyen Ta
% Make sure global variables are visible on command prompt
% so you can examine how they change as you step through
global TRIANGLE NCAMERAS SHOW_IMAGES
global HARD_CONSTRAINT POINT_PRIORS BATCH_INIT REORDER_INTERVAL ALWAYS_RELINEARIZE
global SAVE_GRAPH PRINT_STATS DRAW_INTERVAL CAMERA_INTERVAL DRAW_TRUE_POSES
global SAVE_FIGURES SAVE_GRAPHS SHOW_TIMING
global points K cameras odometry
global poseNoise pointNoise odometryNoise measurementNoise
global frame_i isam newFactors initialEstimates result
% Start GUI
VisualISAM_gui VisualISAM_gui

View File

@ -10,12 +10,14 @@
% @author Duy-Nguyen Ta % @author Duy-Nguyen Ta
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear
%% Global variables used in VisualISAMExample %% Global variables used in VisualISAMExample
VisualISAMGlobalVars global TRIANGLE NCAMERAS SHOW_IMAGES
global HARD_CONSTRAINT POINT_PRIORS BATCH_INIT REORDER_INTERVAL ALWAYS_RELINEARIZE
global SAVE_GRAPH PRINT_STATS DRAW_INTERVAL CAMERA_INTERVAL DRAW_TRUE_POSES
global SAVE_FIGURES SAVE_GRAPHS
%% Setting data options %% Setting data options
TRIANGLE = true; TRIANGLE = false;
NCAMERAS = 20; NCAMERAS = 20;
SHOW_IMAGES = false; SHOW_IMAGES = false;
@ -28,8 +30,8 @@ ALWAYS_RELINEARIZE = false;
%% Display Options %% Display Options
SAVE_GRAPH = false; SAVE_GRAPH = false;
PRINT_STATS = true; PRINT_STATS = false;
DRAW_INTERVAL = 4; DRAW_INTERVAL = 5;
CAMERA_INTERVAL = 1; CAMERA_INTERVAL = 1;
DRAW_TRUE_POSES = false; DRAW_TRUE_POSES = false;
SAVE_FIGURES = false; SAVE_FIGURES = false;

View File

@ -10,100 +10,43 @@
% @author Duy-Nguyen Ta % @author Duy-Nguyen Ta
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Create a triangle target, just 3 points on a plane %% Global variables used in VisualISAMExample
nPoints = 3; global TRIANGLE NCAMERAS SHOW_IMAGES
r = 10; global HARD_CONSTRAINT POINT_PRIORS BATCH_INIT REORDER_INTERVAL ALWAYS_RELINEARIZE
points = {}; global SAVE_GRAPH PRINT_STATS DRAW_INTERVAL CAMERA_INTERVAL DRAW_TRUE_POSES
for j=1:nPoints global SAVE_FIGURES SAVE_GRAPHS
theta = (j-1)*2*pi/nPoints;
points{j} = gtsamPoint3([r*cos(theta), r*sin(theta), 0]');
end
%% Create camera cameras on a circle around the triangle %% Setting data options
nCameras = 10; TRIANGLE = true;
height = 10; NCAMERAS = 10;
r = 30; SHOW_IMAGES = false;
cameras = {};
K = gtsamCal3_S2(500,500,0,640/2,480/2);
for i=1:nCameras
theta = (i-1)*2*pi/nCameras;
t = gtsamPoint3([r*cos(theta), r*sin(theta), height]');
cameras{i} = gtsamSimpleCamera_lookat(t, gtsamPoint3, gtsamPoint3([0,0,1]'), K);
end
odometry = cameras{1}.pose.between(cameras{2}.pose);
posepriorNoise = gtsamSharedNoiseModel_Sigmas([0.001 0.001 0.001 5.0 5.0 5.0]'); %% iSAM Options
odometryNoise = gtsamSharedNoiseModel_Sigmas([0.001 0.001 0.001 2.0 2.0 2.0]'); HARD_CONSTRAINT = false;
pointNoise = gtsamSharedNoiseModel_Sigma(3, 0.1); POINT_PRIORS = false;
measurementNoise = gtsamSharedNoiseModel_Sigma(2, 1.0); BATCH_INIT = true;
REORDER_INTERVAL = 10;
ALWAYS_RELINEARIZE = false;
%% Create an ISAM object for inference %% Display Options
isam = visualSLAMISAM(2); SAVE_GRAPH = false;
PRINT_STATS = false;
DRAW_INTERVAL = 5;
CAMERA_INTERVAL = 1;
DRAW_TRUE_POSES = false;
SAVE_FIGURES = false;
SAVE_GRAPHS = false;
%% Update ISAM %% Generate data and initialize iSAM with the first pose and points
newFactors = visualSLAMGraph; VisualISAMGenerateData
initialEstimates = visualSLAMValues; VisualISAMInitialize
figure(1); clf; figure;
for i=1:nCameras VisualISAMPlot
% Prior for the first pose or odometry for subsequent cameras
if (i==1)
newFactors.addPosePrior(symbol('x',1), cameras{1}.pose, posepriorNoise);
newFactors.addPointPrior(symbol('l',1), points{1}, pointNoise);
else
newFactors.addOdometry(symbol('x',i-1), symbol('x',i), odometry, odometryNoise);
end
% Visual measurement factors %% Main loop for iSAM: stepping through all poses
for j=1:nPoints for frame_i=2:NCAMERAS
zij = cameras{i}.project(points{j}); VisualISAMStep
newFactors.addMeasurement(zij, measurementNoise, symbol('x',i), symbol('l',j), K); if mod(frame_i,DRAW_INTERVAL)==0
end VisualISAMPlot
% Initial estimates for the new pose. Also initialize points while in
% the first frame.
if (i==1)
initialEstimates.insertPose(symbol('x',i), cameras{i}.pose);
for j=1:nPoints
initialEstimates.insertPoint(symbol('l',j), points{j});
end
else
%TODO: this might be suboptimal since "result" is not the fully
%optimized result
if (i==2), prevPose = cameras{1}.pose;
else prevPose = result.pose(symbol('x',i-1)); end
initialEstimates.insertPose(symbol('x',i), prevPose.compose(odometry));
end
% Update ISAM, only update for the second frame onward
% Update the first frame will cause error, since it's under constrained
if (i>=2)
isam.update(newFactors, initialEstimates);
result = isam.estimate();
% Plot results
h=figure(1); clf;
hold on;
for j=1:nPoints
P = isam.marginalCovariance(symbol('l',j));
point_j = result.point(symbol('l',j));
plot3(point_j.x, point_j.y, point_j.z,'marker','o');
covarianceEllipse3D([point_j.x;point_j.y;point_j.z],P);
end
for ii=1:i
P = isam.marginalCovariance(symbol('x',ii));
pose_ii = result.pose(symbol('x',ii));
plotPose3(pose_ii,P,10);
end
axis([-35 35 -35 35 -35 35])
view([36 34])
colormap('hot')
% print(h,'-dpng',sprintf('vISAM_%03d.png',i));
% Reset newFactors and initialEstimates to prepare for the next
% update
newFactors = visualSLAMGraph;
initialEstimates = visualSLAMValues;
end end
end end

View File

@ -1,4 +1,12 @@
VisualISAMGlobalVars % VisualISAMGenerateData: create data for viusalSLAM::iSAM examples
% Authors: Duy Nguyen Ta and Frank Dellaert
% options
global TRIANGLE NCAMERAS SHOW_IMAGES
% global outputs
global points cameras K odometry
global poseNoise odometryNoise pointNoise measurementNoise % data ?
%% Generate simulated data %% Generate simulated data
points = {}; points = {};

View File

@ -1,7 +0,0 @@
global TRIANGLE NCAMERAS SHOW_IMAGES
global HARD_CONSTRAINT POINT_PRIORS BATCH_INIT REORDER_INTERVAL ALWAYS_RELINEARIZE
global SAVE_GRAPH PRINT_STATS DRAW_INTERVAL CAMERA_INTERVAL DRAW_TRUE_POSES
global SAVE_FIGURES SAVE_GRAPHS
global nPoints points K cameras odometry
global poseNoise pointNoise odometryNoise measurementNoise
global frame_i isam newFactors initialEstimates result

View File

@ -1,4 +1,15 @@
VisualISAMGlobalVars function VisualISAMStep
% VisualISAMStep: execute one update step of visualSLAM::iSAM object
% Authors: Duy Nguyen Ta and Frank Dellaert
% global variables, input
global cameras points pointNoise poseNoise measurementNoise K
% global variables, output
global isam newFactors initialEstimates frame_i result
% options
global REORDER_INTERVAL HARD_CONSTRAINT POINT_PRIORS
%% Initialize iSAM %% Initialize iSAM
isam = visualSLAMISAM(REORDER_INTERVAL); isam = visualSLAMISAM(REORDER_INTERVAL);
@ -14,7 +25,7 @@ else
end end
initialEstimates.insertPose(i1,pose1); initialEstimates.insertPose(i1,pose1);
% Add visual measurement factors from first pose % Add visual measurement factors from first pose
for j=1:nPoints for j=1:size(points,2)
jj = symbol('l',j); jj = symbol('l',j);
if POINT_PRIORS % add point priors if POINT_PRIORS % add point priors
newFactors.addPointPrior(jj, points{j}, pointNoise); newFactors.addPointPrior(jj, points{j}, pointNoise);
@ -24,6 +35,6 @@ for j=1:nPoints
initialEstimates.insertPoint(jj, points{j}); initialEstimates.insertPoint(jj, points{j});
end end
frame_i = 1 frame_i = 1;
result = initialEstimates; result = initialEstimates;
cla; cla;

View File

@ -1,13 +1,17 @@
VisualISAMGlobalVars % VisualISAMPlot: plot current state of visualSLAM::iSAM object
% Authors: Duy Nguyen Ta and Frank Dellaert
% global variables, input
global points cameras frame_i isam result
% options
global CAMERA_INTERVAL DRAW_TRUE_POSES SAVE_FIGURES SAVE_GRAPHS
%% Plot results %% Plot results
tic tic
% h=figure(2);clf
% set(1,'NumberTitle','off','Name','Visual iSAM');
h=gca; h=gca;
cla(h); cla(h);
hold on; hold on;
sprintf('Computing marginals and plotting. Please wait...')
for j=1:size(points,2) for j=1:size(points,2)
point_j = result.point(symbol('l',j)); point_j = result.point(symbol('l',j));
plot3(point_j.x, point_j.y, point_j.z,'marker','o'); plot3(point_j.x, point_j.y, point_j.z,'marker','o');
@ -21,7 +25,7 @@ for ii=1:CAMERA_INTERVAL:frame_i
if (frame_i>1) if (frame_i>1)
P = isam.marginalCovariance(symbol('x',ii)); P = isam.marginalCovariance(symbol('x',ii));
else else
P = [] P = [];
end end
plotPose3(pose_ii,P,10); plotPose3(pose_ii,P,10);
if DRAW_TRUE_POSES % show ground truth if DRAW_TRUE_POSES % show ground truth
@ -31,9 +35,7 @@ end
axis([-40 40 -40 40 -10 20]);axis equal axis([-40 40 -40 40 -10 20]);axis equal
view(3) view(3)
colormap('hot') colormap('hot')
sprintf('Done!')
% figure(2);
t=toc; t=toc;
% if DRAW_INTERVAL~=NCAMERAS, plot(frame_i,t,'b.'); end % if DRAW_INTERVAL~=NCAMERAS, plot(frame_i,t,'b.'); end
if SAVE_FIGURES if SAVE_FIGURES

View File

@ -1,24 +1,46 @@
VisualISAMGlobalVars function VisualISAMStep
% VisualISAMStep: execute one update step of visualSLAM::iSAM object
% Authors: Duy Nguyen Ta and Frank Dellaert
% global variables, input
global frame_i odometry odometryNoise newFactors initialEstimates
global points cameras measurementNoise K
% global variables, input/output
global isam
% global variables, output
global result
% options
global BATCH_INIT SHOW_TIMING ALWAYS_RELINEARIZE
global SAVE_GRAPH PRINT_STATS
% iSAM expects us to give it a new set of factors
% along with initial estimates for any new variables introduced.
% We do not clear in frame 2 so we add to the factors added in Initialize
if frame_i > 2
newFactors = visualSLAMGraph;
initialEstimates = visualSLAMValues;
end
%% Add odometry %% Add odometry
newFactors.addOdometry(symbol('x',frame_i-1), symbol('x',frame_i), odometry, odometryNoise); newFactors.addOdometry(symbol('x',frame_i-1), symbol('x',frame_i), odometry, odometryNoise);
%% Add visual measurement factors %% Add visual measurement factors
for j=1:nPoints for j=1:size(points,2)
zij = cameras{frame_i}.project(points{j}); zij = cameras{frame_i}.project(points{j});
newFactors.addMeasurement(zij, measurementNoise, symbol('x',frame_i), symbol('l',j), K); newFactors.addMeasurement(zij, measurementNoise, symbol('x',frame_i), symbol('l',j), K);
end end
%% Initial estimates for the new pose. Also initialize points while in the first frame. %% Initial estimates for the new pose. Also initialize points while in the first frame.
%TODO: this might be suboptimal since "result" is not the fully optimized result
if (frame_i==2), prevPose = cameras{1}.pose; if (frame_i==2), prevPose = cameras{1}.pose;
else, prevPose = result.pose(symbol('x',frame_i-1)); end else, prevPose = result.pose(symbol('x',frame_i-1)); end
initialEstimates.insertPose(symbol('x',frame_i), prevPose.compose(odometry)); initialEstimates.insertPose(symbol('x',frame_i), prevPose.compose(odometry));
%% Update ISAM %% Update ISAM
if BATCH_INIT & (frame_i==2) % Do a full optimize for first two poses if BATCH_INIT & (frame_i==2) % Do a full optimize for first two poses
initialEstimates fullyOptimized = newFactors.optimize(initialEstimates);
fullyOptimized = newFactors.optimize(initialEstimates)
initialEstimates = fullyOptimized; initialEstimates = fullyOptimized;
end end
% figure(1);tic; % figure(1);tic;
@ -30,14 +52,10 @@ if ALWAYS_RELINEARIZE % re-linearize
isam.reorder_relinearize(); isam.reorder_relinearize();
end end
if SAVE_GRAPH if SAVE_GRAPH
isam.saveGraph(sprintf('VisualiSAM.dot',frame_i)); isam.saveGraph(sprintf('VisualiSAM.dot',frame_i));
end end
if PRINT_STATS if PRINT_STATS
isam.printStats(); isam.printStats();
end end
%% Reset newFactors and initialEstimates to prepare for the next update
newFactors = visualSLAMGraph;
initialEstimates = visualSLAMValues;

View File

@ -1,37 +1,20 @@
function varargout = VisualISAM_gui(varargin) function varargout = VisualISAM_gui(varargin)
% VISUALISAM_GUI MATLAB code for VisualISAM_gui.fig % VisualISAM_gui: runs VisualSLAM iSAM demo in GUI
% VISUALISAM_GUI, by itself, creates a new VISUALISAM_GUI or raises the existing % Interface is defined by VisualISAM_gui.fig
% singleton*. % You can run this file directly, but won't have access to globals
% % By running ViusalISAMDemo, you see all variables in command prompt
% H = VISUALISAM_GUI returns the handle to a new VISUALISAM_GUI or the handle to % Authors: Duy Nguyen Ta
% the existing singleton*.
%
% VISUALISAM_GUI('CALLBACK',hObject,~,handles,...) calls the local
% function named CALLBACK in VISUALISAM_GUI.M with the given input arguments.
%
% VISUALISAM_GUI('Property','Value',...) creates a new VISUALISAM_GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before VisualISAM_gui_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to VisualISAM_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 VisualISAM_gui
% Last Modified by GUIDE v2.5 09-Jun-2012 00:56:47 % Last Modified by GUIDE v2.5 09-Jun-2012 00:56:47
% Begin initialization code - DO NOT EDIT % Begin initialization code - DO NOT EDIT
gui_Singleton = 1; gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ... gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ... 'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @VisualISAM_gui_OpeningFcn, ... 'gui_OpeningFcn', @VisualISAM_gui_OpeningFcn, ...
'gui_OutputFcn', @VisualISAM_gui_OutputFcn, ... 'gui_OutputFcn', @VisualISAM_gui_OutputFcn, ...
'gui_LayoutFcn', [] , ... 'gui_LayoutFcn', [] , ...
'gui_Callback', []); 'gui_Callback', []);
if nargin && ischar(varargin{1}) if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1}); gui_State.gui_Callback = str2func(varargin{1});
end end
@ -55,11 +38,8 @@ handles.output = hObject;
% Update handles structure % Update handles structure
guidata(hObject, handles); guidata(hObject, handles);
% UIWAIT makes VisualISAM_gui wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. % --- Outputs from this function are returned to the command line.
function varargout = VisualISAM_gui_OutputFcn(hObject, ~, handles) function varargout = VisualISAM_gui_OutputFcn(hObject, ~, handles)
% varargout cell array for returning output args (see VARARGOUT); % varargout cell array for returning output args (see VARARGOUT);
% Get default command line output from handles structure % Get default command line output from handles structure
varargout{1} = handles.output; varargout{1} = handles.output;
@ -69,49 +49,54 @@ varargout{1} = handles.output;
% Convenient functions % Convenient functions
%---------------------------------------------------------- %----------------------------------------------------------
function showFramei(hObject, handles) function showFramei(hObject, handles)
VisualISAMGlobalVars global frame_i
set(handles.frameStatus, 'String', sprintf('Frame: %d',frame_i)); set(handles.frameStatus, 'String', sprintf('Frame: %d',frame_i));
drawnow drawnow
guidata(hObject, handles); guidata(hObject, handles);
function showWaiting(handles, status) function showWaiting(handles, status)
set(handles.waitingStatus,'String', status); set(handles.waitingStatus,'String', status);
drawnow drawnow
guidata(handles.waitingStatus, handles); guidata(handles.waitingStatus, handles);
function triangle = chooseDataset(handles) function triangle = chooseDataset(handles)
str = cellstr(get(handles.dataset,'String')); str = cellstr(get(handles.dataset,'String'));
sel = get(handles.dataset,'Value'); sel = get(handles.dataset,'Value');
switch str{sel} switch str{sel}
case 'triangle' case 'triangle'
triangle = true; triangle = true;
case 'cube' case 'cube'
triangle = false; triangle = false;
end end
function initOptions(handles) function initOptions(handles)
VisualISAMGlobalVars
% Setting data options
TRIANGLE = chooseDataset(handles)
NCAMERAS = str2num(get(handles.numCamEdit,'String'))
SHOW_IMAGES = get(handles.showImagesCB,'Value')
% iSAM Options global TRIANGLE NCAMERAS SHOW_IMAGES
HARD_CONSTRAINT = get(handles.hardConstraintCB,'Value') global HARD_CONSTRAINT POINT_PRIORS BATCH_INIT REORDER_INTERVAL ALWAYS_RELINEARIZE
POINT_PRIORS = get(handles.pointPriorsCB,'Value') global SAVE_GRAPH PRINT_STATS DRAW_INTERVAL CAMERA_INTERVAL DRAW_TRUE_POSES
BATCH_INIT = get(handles.batchInitCB,'Value') global SAVE_FIGURES SAVE_GRAPHS
REORDER_INTERVAL = str2num(get(handles.numCamEdit,'String'))
ALWAYS_RELINEARIZE = get(handles.alwaysRelinearizeCB,'Value') % Setting data options
TRIANGLE = chooseDataset(handles);
NCAMERAS = str2num(get(handles.numCamEdit,'String'));
SHOW_IMAGES = get(handles.showImagesCB,'Value');
% iSAM Options
HARD_CONSTRAINT = get(handles.hardConstraintCB,'Value');
POINT_PRIORS = get(handles.pointPriorsCB,'Value');
BATCH_INIT = get(handles.batchInitCB,'Value');
REORDER_INTERVAL = str2num(get(handles.numCamEdit,'String'));
ALWAYS_RELINEARIZE = get(handles.alwaysRelinearizeCB,'Value');
% Display Options
SAVE_GRAPH = get(handles.saveGraphCB,'Value');
PRINT_STATS = get(handles.printStatsCB,'Value');
DRAW_INTERVAL = str2num(get(handles.drawInterval,'String'));
CAMERA_INTERVAL = str2num(get(handles.cameraIntervalEdit,'String'));
DRAW_TRUE_POSES = get(handles.drawTruePosesCB,'Value');
SAVE_FIGURES = get(handles.saveFiguresCB,'Value');
SAVE_GRAPHS = get(handles.saveGraphsCB,'Value');
% Display Options
SAVE_GRAPH = get(handles.saveGraphCB,'Value')
PRINT_STATS = get(handles.printStatsCB,'Value')
DRAW_INTERVAL = str2num(get(handles.drawInterval,'String'))
CAMERA_INTERVAL = str2num(get(handles.cameraIntervalEdit,'String'))
DRAW_TRUE_POSES = get(handles.drawTruePosesCB,'Value')
SAVE_FIGURES = get(handles.saveFiguresCB,'Value')
SAVE_GRAPHS = get(handles.saveGraphsCB,'Value')
%---------------------------------------------------------- %----------------------------------------------------------
% Callback functions for GUI elements % Callback functions for GUI elements
@ -130,7 +115,7 @@ end
function dataset_Callback(hObject, ~, handles) function dataset_Callback(hObject, ~, handles)
% Hints: contents = cellstr(get(hObject,'String')) returns dataset contents as cell array % Hints: contents = cellstr(get(hObject,'String')) returns dataset contents as cell array
% contents{get(hObject,'Value')} returns selected item from dataset % contents{get(hObject,'Value')} returns selected item from dataset
% --- Executes during object creation, after setting all properties. % --- Executes during object creation, after setting all properties.
function numCamEdit_CreateFcn(hObject, ~, handles) function numCamEdit_CreateFcn(hObject, ~, handles)
@ -161,13 +146,13 @@ function pointPriorsCB_Callback(hObject, ~, handles)
% --- Executes during object creation, after setting all properties. % --- Executes during object creation, after setting all properties.
function batchInitCB_CreateFcn(hObject, eventdata, handles) function batchInitCB_CreateFcn(hObject, eventdata, handles)
set(hObject,'Value',1); set(hObject,'Value',1);
% --- Executes on button press in batchInitCB. % --- Executes on button press in batchInitCB.
function batchInitCB_Callback(hObject, ~, handles) function batchInitCB_Callback(hObject, ~, handles)
% Hint: get(hObject,'Value') returns toggle state of batchInitCB % Hint: get(hObject,'Value') returns toggle state of batchInitCB
% --- Executes on button press in alwaysRelinearizeCB. % --- Executes on button press in alwaysRelinearizeCB.
function alwaysRelinearizeCB_Callback(hObject, ~, handles) function alwaysRelinearizeCB_Callback(hObject, ~, handles)
% Hint: get(hObject,'Value') returns toggle state of alwaysRelinearizeCB % Hint: get(hObject,'Value') returns toggle state of alwaysRelinearizeCB
@ -242,48 +227,45 @@ function saveGraphsCB_Callback(hObject, ~, handles)
% --- Executes on button press in intializeButton. % --- Executes on button press in intializeButton.
function intializeButton_Callback(hObject, ~, handles) function intializeButton_Callback(hObject, ~, handles)
VisualISAMGlobalVars initOptions(handles)
initOptions(handles) VisualISAMGenerateData
VisualISAMGenerateData VisualISAMInitialize
VisualISAMInitialize VisualISAMPlot
VisualISAMPlot showFramei(hObject, handles)
showFramei(hObject, handles)
% --- Executes on button press in runButton. % --- Executes on button press in runButton.
function runButton_Callback(hObject, ~, handles) function runButton_Callback(hObject, ~, handles)
VisualISAMGlobalVars global frame_i NCAMERAS DRAW_INTERVAL
while (frame_i<NCAMERAS) while (frame_i<NCAMERAS)
frame_i = frame_i+1; frame_i = frame_i+1;
showFramei(hObject, handles) showFramei(hObject, handles)
VisualISAMStep VisualISAMStep
if mod(frame_i,DRAW_INTERVAL)==0 if mod(frame_i,DRAW_INTERVAL)==0
showWaiting(handles, 'Computing marginals...'); showWaiting(handles, 'Computing marginals...');
VisualISAMPlot VisualISAMPlot
showWaiting(handles, ''); showWaiting(handles, '');
end
end end
end
% --- Executes on button press in stepButton. % --- Executes on button press in stepButton.
function stepButton_Callback(hObject, ~, handles) function stepButton_Callback(hObject, ~, handles)
VisualISAMGlobalVars global frame_i NCAMERAS DRAW_INTERVAL
if (frame_i<NCAMERAS) if (frame_i<NCAMERAS)
frame_i = frame_i+1; frame_i = frame_i+1;
showFramei(hObject, handles) showFramei(hObject, handles)
VisualISAMStep VisualISAMStep
if mod(frame_i,DRAW_INTERVAL)==0 showWaiting(handles, 'Computing marginals...');
showWaiting(handles, 'Computing marginals...'); VisualISAMPlot
VisualISAMPlot showWaiting(handles, '');
showWaiting(handles, ''); end
end
end
% --- Executes on button press in plotButton. % --- Executes on button press in plotButton.
function plotButton_Callback(hObject, ~, handles) function plotButton_Callback(hObject, ~, handles)
showWaiting(handles, 'Computing marginals...'); showWaiting(handles, 'Computing marginals...');
VisualISAMPlot; VisualISAMPlot;
showWaiting(handles, ''); showWaiting(handles, '');