Home > compassGaitSimulator > EnvGene.m

EnvGene

PURPOSE ^

EnvGene Function

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 EnvGene Function
 [x,y] profile of rough terrain

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % EnvGene Function
0002 % [x,y] profile of rough terrain
0003 
0004 clear all;
0005 
0006 stepno=1000;
0007 %env_prof=[0.0, 0.0, 0.2, 0.01, 0.3, 0.0, 0.5, 0.01, 0.8, 0.02];
0008 
0009 % % Flat Terrain
0010 env_prof(1:2)=0.0;
0011 for i=1:stepno
0012     env_prof(i*2+1)=i*0.01;
0013     env_prof(i*2+2)=0.0;
0014 end
0015 env=[stepno, env_prof];
0016 envFileName = ['env' filesep 'env00']; % env\env00.mat in Windows, env/env00.mat in Linux
0017 save (envFileName, 'env');
0018 
0019 % % Uphill Terrain
0020 gamma=3.0*pi/180;
0021 env_prof(1:2)=0.0;
0022 for i=1:stepno
0023     env_prof(i*2+1)=i*0.01;
0024     env_prof(i*2+2)=gamma*(i*0.01+1)+ gamma;
0025 end
0026 env=[stepno, env_prof];
0027 envFileName = ['env' filesep 'env01']; % env\env01.mat in Windows, env/env01.mat in Linux
0028 save (envFileName, 'env');
0029 
0030 % % Downhill Terrain
0031 env_prof(1:2)=0.0;
0032 gamma=3.0*pi/180;
0033 for i=1:stepno
0034     env_prof(i*2+1)=i*0.01;
0035     env_prof(i*2+2)=-gamma*(i*0.01+1) + gamma;
0036 end
0037 env=[stepno, env_prof];
0038 envFileName = ['env' filesep 'env02']; % env\env02.mat in Windows, env/env02.mat in Linux
0039 save (envFileName, 'env');
0040 
0041 % % One Step Terrain
0042 env_prof(1:2)=0.0;
0043 for i=1:stepno
0044     env_prof(i*2+1)=i*0.01;
0045     env_prof(i*2+2)=0.0;
0046 end
0047 for i=101:110
0048     env_prof(i*2+1)=i*0.01;
0049     env_prof(i*2+2)=0.001;
0050 end
0051 env=[stepno, env_prof];
0052 envFileName = ['env' filesep 'env11']; % env\env11.mat in Windows, env/env11.mat in Linux
0053 save (envFileName, 'env');
0054     
0055 % % Complex Terrain
0056 env_prof(1:2)=0.0;
0057 for i=1:100
0058     env_prof(i*2+1)=i*0.01;
0059     env_prof(i*2+2)=0.0;
0060 end
0061 
0062 for i=101:120
0063     env_prof(i*2+1)=i*0.01;
0064     env_prof(i*2+2)=0.001;
0065 end
0066 
0067 for i=121:150
0068     env_prof(i*2+1)=i*0.01;
0069     env_prof(i*2+2)=0.0;
0070 end
0071 
0072 for i=151:2:200
0073     env_prof((i:i+2)*2+1)=(i:i+2)*0.01;
0074     env_prof((i:i+2)*2+2)=rand()*0.02-0.01;
0075 end
0076 
0077 for i=201:250
0078     env_prof(i*2+1)=i*0.01;
0079     env_prof(i*2+2)=0.01;
0080 end
0081 
0082 for i=250:stepno
0083     env_prof(i*2+1)=i*0.01;
0084     env_prof(i*2+2)=0.0;
0085 end
0086 env=[stepno, env_prof];
0087 envFileName = ['env' filesep 'env12']; % env\env12.mat in Windows, env/env12.mat in Linux
0088 save (envFileName, 'env');
0089 
0090

Generated on Tue 09-Jun-2009 23:31:31 by m2html © 2003