Script file: MainScript.m Purpose: Simulation of Compass Gait Model Revisions: Date Programmer Description 2009.05.02 Fumiya Iida Original code
0001 % Script file: 0002 % MainScript.m 0003 % 0004 % Purpose: 0005 % Simulation of Compass Gait Model 0006 % 0007 % Revisions: 0008 % Date Programmer Description 0009 % 0010 % 2009.05.02 Fumiya Iida Original code 0011 % 0012 0013 %%%% Clear Previous Values %%%% 0014 %warning off all; 0015 clear all; 0016 0017 global hx; 0018 global env; 0019 global SWSTFlag 0020 global qHist2; 0021 qHist2=[]; 0022 0023 namestr='Fig1'; 0024 [existFlag,hx] = figflag(namestr); 0025 if ~existFlag, 0026 hx=figure('Color', [1 1 1],'Name',namestr,'Position', [1 600 1000 600]); 0027 set(hx,'DoubleBuffer','on'); 0028 end 0029 0030 maxWindow; 0031 0032 clf; 0033 0034 %%%% Set Parameters %%%% 0035 % envxx.mat files are generated by running EnvGene.m or the GUI version 0036 % (generateTerrain.m) 0037 0038 % envFileName = ['env' filesep 'env00']; % flat ground 0039 % envFileName = ['env' filesep 'env01']; % uphill 0040 % envFileName = ['env' filesep 'env02']; % downhill 0041 % envFileName = ['env' filesep 'env11']; % one small step 0042 envFileName = ['env' filesep 'env12']; % randomly generated rough terrain 0043 0044 load(envFileName); % Load environmental parameters 0045 0046 MorphologyParam; % Load morphological parameters 0047 ControlParam; % Load control parameters 0048 InitCondition; % Initial conditions 0049 0050 SWSTFlag=0; 0051 %%%% Simulation Start %%%% 0052 for LegStep=1:10 0053 0054 [xo1 to]=ContinuousDynamics(xi,phi); 0055 0056 [xo2]=CollisionModel(xo1); 0057 0058 xi=xo2; 0059 phi=phi-(PER/2-to)*2*pi/PER; 0060 0061 end