diff --git a/matlab/CMakeLists.txt b/matlab/CMakeLists.txt index 3e77de602..0b07b51b1 100644 --- a/matlab/CMakeLists.txt +++ b/matlab/CMakeLists.txt @@ -16,10 +16,8 @@ install(FILES ${matlab_tests} DESTINATION ${GTSAM_TOOLBOX_INSTALL_PATH}/gtsam_te # Examples message(STATUS "Installing Matlab Toolbox Examples") # Matlab files: *.m and *.fig -file(GLOB matlab_examples_m "${GTSAM_SOURCE_ROOT_DIR}/matlab/examples/*.m") -file(GLOB matlab_examples_fig "${GTSAM_SOURCE_ROOT_DIR}/matlab/examples/*.fig") -set(matlab_examples ${matlab_examples_m} ${matlab_examples_fig}) -install(FILES ${matlab_examples} DESTINATION ${GTSAM_TOOLBOX_INSTALL_PATH}/gtsam_examples) +install(DIRECTORY "${GTSAM_SOURCE_ROOT_DIR}/matlab/examples/" DESTINATION "${GTSAM_TOOLBOX_INSTALL_PATH}/gtsam_examples" FILES_MATCHING PATTERN "*.m") +install(DIRECTORY "${GTSAM_SOURCE_ROOT_DIR}/matlab/examples/" DESTINATION "${GTSAM_TOOLBOX_INSTALL_PATH}/gtsam_examples" FILES_MATCHING PATTERN "*.fig") message(STATUS "Installing Matlab Toolbox Examples (Data)") # Data files: *.graph and *.txt diff --git a/matlab/VisualISAM_gui.fig b/matlab/VisualISAM_gui.fig deleted file mode 100644 index 7140cbf73..000000000 Binary files a/matlab/VisualISAM_gui.fig and /dev/null differ diff --git a/matlab/VisualISAMGenerateData.m b/matlab/examples/+support/VisualISAMGenerateData.m similarity index 100% rename from matlab/VisualISAMGenerateData.m rename to matlab/examples/+support/VisualISAMGenerateData.m diff --git a/matlab/VisualISAMInitialize.m b/matlab/examples/+support/VisualISAMInitialize.m similarity index 93% rename from matlab/VisualISAMInitialize.m rename to matlab/examples/+support/VisualISAMInitialize.m index cbcb09c5c..90ba1e0c5 100644 --- a/matlab/VisualISAMInitialize.m +++ b/matlab/examples/+support/VisualISAMInitialize.m @@ -8,7 +8,8 @@ isam = visualSLAM.ISAM(options.reorderInterval); %% Set Noise parameters import gtsam.* noiseModels.pose = noiseModel.Diagonal.Sigmas([0.001 0.001 0.001 0.1 0.1 0.1]'); -noiseModels.odometry = noiseModel.Diagonal.Sigmas([0.001 0.001 0.001 0.1 0.1 0.1]'); +%noiseModels.odometry = noiseModel.Diagonal.Sigmas([0.001 0.001 0.001 0.1 0.1 0.1]'); +noiseModels.odometry = noiseModel.Diagonal.Sigmas([0.1 0.1 0.1 1.0 1.0 1.0]'); noiseModels.point = noiseModel.Isotropic.Sigma(3, 0.1); noiseModels.measurement = noiseModel.Isotropic.Sigma(2, 1.0); diff --git a/matlab/VisualISAMPlot.m b/matlab/examples/+support/VisualISAMPlot.m similarity index 100% rename from matlab/VisualISAMPlot.m rename to matlab/examples/+support/VisualISAMPlot.m diff --git a/matlab/VisualISAMStep.m b/matlab/examples/+support/VisualISAMStep.m similarity index 100% rename from matlab/VisualISAMStep.m rename to matlab/examples/+support/VisualISAMStep.m diff --git a/matlab/examples/findExampleDataFile.m b/matlab/examples/+support/findExampleDataFile.m similarity index 76% rename from matlab/examples/findExampleDataFile.m rename to matlab/examples/+support/findExampleDataFile.m index 7719dfcfa..5fd23352e 100644 --- a/matlab/examples/findExampleDataFile.m +++ b/matlab/examples/+support/findExampleDataFile.m @@ -3,8 +3,8 @@ function datafile = findExampleDataFile(datasetName) [ myPath, ~, ~ ] = fileparts(mfilename('fullpath')); searchPath = { ... - fullfile(myPath, [ '../../examples/Data/' datasetName ]) ... - fullfile(myPath, [ 'Data/' datasetName ]) }; + fullfile(myPath, [ '../../../examples/Data/' datasetName ]) ... + fullfile(myPath, [ '../Data/' datasetName ]) }; datafile = []; for path = searchPath if exist(path{:}, 'file') diff --git a/matlab/examples/Pose2SLAMExample_graph.m b/matlab/examples/Pose2SLAMExample_graph.m index 2cfe900a0..f5193a7de 100644 --- a/matlab/examples/Pose2SLAMExample_graph.m +++ b/matlab/examples/Pose2SLAMExample_graph.m @@ -11,7 +11,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Find data file -datafile = findExampleDataFile('w100-odom.graph'); +datafile = support.findExampleDataFile('w100-odom.graph'); %% Initialize graph, initial estimate, and odometry noise import gtsam.* diff --git a/matlab/examples/Pose3SLAMExample_graph.m b/matlab/examples/Pose3SLAMExample_graph.m index 6efb58199..1d33c30e4 100644 --- a/matlab/examples/Pose3SLAMExample_graph.m +++ b/matlab/examples/Pose3SLAMExample_graph.m @@ -16,7 +16,7 @@ N = 2500; % dataset = 'sphere2500_groundtruth.txt'; dataset = 'sphere2500.txt'; -datafile = findExampleDataFile(dataset); +datafile = support.findExampleDataFile(dataset); %% Initialize graph, initial estimate, and odometry noise import gtsam.* diff --git a/matlab/examples/SBAExample.m b/matlab/examples/SBAExample.m index 9d5d22047..a9f101613 100644 --- a/matlab/examples/SBAExample.m +++ b/matlab/examples/SBAExample.m @@ -22,7 +22,7 @@ options.nrCameras = 10; options.showImages = false; %% Generate data -[data,truth] = VisualISAMGenerateData(options); +[data,truth] = support.VisualISAMGenerateData(options); measurementNoiseSigma = 1.0; pointNoiseSigma = 0.1; diff --git a/matlab/examples/VisualISAMExample.m b/matlab/examples/VisualISAMExample.m index dc6a95ae2..7553ed2a4 100644 --- a/matlab/examples/VisualISAMExample.m +++ b/matlab/examples/VisualISAMExample.m @@ -32,17 +32,17 @@ options.saveFigures = false; options.saveDotFiles = false; %% Generate data -[data,truth] = VisualISAMGenerateData(options); +[data,truth] = support.VisualISAMGenerateData(options); %% Initialize iSAM with the first pose and points -[noiseModels,isam,result] = VisualISAMInitialize(data,truth,options); +[noiseModels,isam,result] = support.VisualISAMInitialize(data,truth,options); cla; -VisualISAMPlot(truth, data, isam, result, options) +support.VisualISAMPlot(truth, data, isam, result, options) %% Main loop for iSAM: stepping through all poses for frame_i=3:options.nrCameras - [isam,result] = VisualISAMStep(data,noiseModels,isam,result,truth,options); + [isam,result] = support.VisualISAMStep(data,noiseModels,isam,result,truth,options); if mod(frame_i,options.drawInterval)==0 - VisualISAMPlot(truth, data, isam, result, options) + support.VisualISAMPlot(truth, data, isam, result, options) end end diff --git a/matlab/examples/VisualISAM_gui.fig b/matlab/examples/VisualISAM_gui.fig new file mode 100644 index 000000000..3c8adb46c Binary files /dev/null and b/matlab/examples/VisualISAM_gui.fig differ diff --git a/matlab/VisualISAM_gui.m b/matlab/examples/VisualISAM_gui.m similarity index 94% rename from matlab/VisualISAM_gui.m rename to matlab/examples/VisualISAM_gui.m index cdb2ddbaf..765a6f5ac 100644 --- a/matlab/VisualISAM_gui.m +++ b/matlab/examples/VisualISAM_gui.m @@ -230,12 +230,12 @@ global frame_i truth data noiseModels isam result options initOptions(handles) % Generate Data -[data,truth] = VisualISAMGenerateData(options); +[data,truth] = support.VisualISAMGenerateData(options); % Initialize and plot -[noiseModels,isam,result] = VisualISAMInitialize(data,truth,options); +[noiseModels,isam,result] = support.VisualISAMInitialize(data,truth,options); cla -VisualISAMPlot(truth, data, isam, result, options) +support.VisualISAMPlot(truth, data, isam, result, options) frame_i = 2; showFramei(hObject, handles) @@ -246,10 +246,10 @@ global frame_i truth data noiseModels isam result options while (frame_i