Skip to content
Dr. Juan Rojas edited this page Jun 7, 2016 · 3 revisions
Welcome to the SS_matlab_offline_coder wiki!

%*************************** Documentation *******************************
% snapVerification()
%
% Is the main program to execute the relative-change-based hierarchical
% taxonomy (RCBHT). Also includes a probabilistic version called
% probabilistic RCBHT or pRCBHT. 
%
% This is currently done offline. 
%
% This function does the following:
% 1) Loads Force, Angles, Cartesian Positions, and State Transition
% information from either of the following experiments: 
% - PA10 Simulation Straight Line Approach
% - PA10 Simulation Pivot Approach
% - HIRO Simulation/Real Side Approach
% - HIRO Simulation/Real Error Characterization
% - Baxter Simulation/Real Side Approach
%
% Then, for each separate force axis do the following:
% 2) Primitives Level: 
% Perform a linear regression fit of the force data using a correlation
% parameter. Then, assign a "Primitive" label to each segment based on the
% magnitude of the gradent. There are 11 possible classifications. Then, do
% filtering at this level using primitivesCleanUp.
%
% Note:
% There is a possibility to run an optimization algorithm here by turning
% on the optimization flag. This routines optimizes the gradient thresholds
% used in the regressionFit that labels the segments based on gradient
% value. 
%
% 3) Motion Compositions (MCs) Level:
% Combine 2 neighboring primitives to abstract complexity and call these
% motion compositions. Motion compositions can be of 9 different
% types according to the types of primitives that are combined. There are
% rules to label according to primitive type. There is also a filtering
% stage here called cleanUp.m
%
% 4) Low-Level Behaviors (LLBs) Level:
% Combines neighboring compositions to abstract complexity. There are also
% 9 different types of LLBs according to the types of compositions
% combines. There is also a filtering stage here called Refinement.
%
% 5) High-Level Behaviors (HLBs) Level:
% This function is designed to study whether failure is likely in the
% Approach stage or if the whole assembly has been successful. To do so it
% looks for specific characteristics outlined in more detailed in those
% functions or in the documentation.
%
% 6) Bayes Filtering or pRCBHT
% This function converts data found in the MC/LLB/HLB layers into a
% probabilistic rendition and uses that information to study whether
% failure is likely or success has happened.
%
% 7) Save Learning Data
% After the analysis has finished, data that is required for probabilistic
% learning or for failure characterization is performed.
%
%--------------------------------------------------------------------------
% For Reference: Structures and Labels
%--------------------------------------------------------------------------
% Primitives = [bpos,mpos,spos,bneg,mneg,sneg,cons,pimp,nimp,none]      % Represented by integers: [1,2,3,4,5,6,7,8,9,10]  
% statData   = [dAvg dMax dMin dStart dFinish dGradient dLabel]
%--------------------------------------------------------------------------
% actionLbl  = ['a','i','d','k','pc','nc','c','u','n','z'];             % Represented by integers: [1,2,3,4,5,6,7,8,9,10]  
% motComps   = [nameLabel,avgVal,rmsVal,amplitudeVal,
%               p1lbl,p2lbl,
%               t1Start,t1End,t2Start,t2End,tAvgIndex]
%--------------------------------------------------------------------------
% llbehLbl   = ['FX' 'CT' 'PS' 'PL' 'AL' 'SH' 'U' 'N'];                 % Represented by integers: [1,2,3,4,5,6,7,8]
% llbehStruc:  [actnClass,...
%              avgMagVal1,avgMagVal2,AVG_MAG_VAL,
%              rmsVal1,rmsVal2,AVG_RMS_VAL,
%              ampVal1,ampVal2,AVG_AMP_VAL,
%              mc1,mc2,
%              T1S,T1_END,T2S,T2E,TAVG_INDEX]
%--------------------------------------------------------------------------
%
% Inputs:
% StrategyType  : the number of strategy types vary according to assembly
%                 technique, or robot used, or number of arms used. Below is
%                 a list of current strategies. These can be best
%                 organized/selected through the strategySelector.m func.
%                   - SLA ----------------------------
%                   SIM_HIRO_SLA
%                   SIM_HIRO_SLA_NOISE
%                   SIM_PA10_ONE_SL_SUCCESS
%                   - PA ----------------------------   
%                   SIM_HIRO_ONE_PA_SUCCESS,
%                   SIM_HIRO_ONE_PA_NOISE
%                   SIM_PA10_ONE_PA_SUCCESS,
%                   - SA ----------------------------
%                   % --- Simulated HIRO
%                   SIM_HIRO_ONE_SA_SUCCESS
%                   SIM_HIRO_ONE_SA_ERROR_CHARAC_LoopBack_x
%                   SIM_HIRO_ONE_SA_ERROR_CHARAC_LoopBack_y
%                   SIM_HIRO_ONE_SA_ERROR_CHARAC_Prob
%                   SIM_HIRO_ONE_SA_ERROR_CHARAC_SVM
%                   SIM_HIRO_TWO_SA_SUCCESS
%                   % --- Real HIRO
%                   REAL_HIRO_ONE_SA_SUCCESS
%                   % --- Real HIRO Error Charac
%                   REAL_HIRO_ONE_SA_ERROR_CHARAC
%                   % --- Simulated Baxter
%                   SIM_BAXTER_SA_SUCCES
%                   SIM_BAXTER_SA_DUAL
%                   % --- Real Baxter
%                   REAL_BAXTER_ONE_SA_SUCCESS
%                   REAL_BAXTER_TWO_SA_SUCCESS
% FolderName    : Name of folder where results are stored, user based.
% first         : which plot do you want to segment first
% last          : which plot do you want to segment last
%                 where first:last is a vector list.
%
% Outputs:
% hlbBelief     : the belief or posterior probability about the success
%                 rate of the task.
% llbBelief     : the belief about all the different LLBs found throughout
%                 the task
% stateTimes    : col vector of automata state transition times
% hlbehStruc    : boolean row vec containing one element per automata state
%                 indicating whether state was successful based on 
%                 pre-probabilistic analysis.
% fcAvgData     : contains the actual means or averages of all computed
%                 values in fc
% boolFCData    : boolean structure that contains data for each
%                 of the tests carried out. 

Clone this wiki locally