
% Create the initial structure
params = InitSimSect;
params = AddHexapodFields( params );

% -------------------------------------------
% Add the embedding controller related fields

% Adjust stopping conditions
params.final_time = 10.0;

% Do not use Geomview for this simulation
params.useGeomview = 1;
params.controller = 'open-loop';

% Sweep the touchdown angle
speedvars = linspace( 0.5, 1.5, 10 );

results = [];

RCname = 'samplesweep.rc';
dataName = 'hexaped';

params.dataBaseName   =  dataName;
for ind = 1:length( speedvars );
  disp( sprintf( 'Proceeding with execution %i', ind ) );
  
  params.v_y = speedvars(ind);

  CreateRCFile( params, RCname );

  [s,w] = RunSimSect( [' -c ' RCname ] );

  datatypes = HexapodDatatypes;
  hex = LoadSimSectData( dataName, datatypes );

  figure(1);
  clf;
  plot(hex.t, hex.rd(:,2));
  disp('Press a key');
  pause;
end

