2018-06-21 11:42:46 +02:00
|
|
|
function [] = initializeSimConf(opts_param)
|
|
|
|
%% Default values for opts
|
2018-10-07 22:07:21 +02:00
|
|
|
opts = struct('Ts', 1e-4, ... % Sampling time [s]
|
|
|
|
'Tsim', 10, ... % Simulation time [s]
|
|
|
|
'cl_time', 0, ... % Close Loop time [s]
|
|
|
|
'gravity', false ... % Gravity along the z axis
|
2018-06-21 11:42:46 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
%% Populate opts with input parameters
|
|
|
|
if exist('opts_param','var')
|
|
|
|
for opt = fieldnames(opts_param)'
|
|
|
|
opts.(opt{1}) = opts_param.(opt{1});
|
|
|
|
end
|
|
|
|
end
|
2018-10-12 13:22:29 +02:00
|
|
|
|
2018-06-21 11:42:46 +02:00
|
|
|
%%
|
|
|
|
sim_conf = struct();
|
2018-10-12 13:22:29 +02:00
|
|
|
|
2018-06-21 11:42:46 +02:00
|
|
|
%%
|
|
|
|
sim_conf.Ts = opts.Ts;
|
|
|
|
sim_conf.Tsim = opts.Tsim;
|
|
|
|
sim_conf.cl_time = opts.cl_time;
|
|
|
|
|
|
|
|
%% Gravity
|
|
|
|
if opts.gravity
|
2018-10-07 22:07:21 +02:00
|
|
|
sim_conf.g = -9.8; %#ok
|
2018-06-21 11:42:46 +02:00
|
|
|
else
|
2018-10-07 22:07:21 +02:00
|
|
|
sim_conf.g = 0; %#ok
|
2018-06-21 11:42:46 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
%% Save
|
|
|
|
save('./mat/sim_conf.mat', 'sim_conf');
|
|
|
|
end
|