36 lines
824 B
Mathematica
36 lines
824 B
Mathematica
|
function [] = initializeSimConf(opts_param)
|
||
|
%% Default values for opts
|
||
|
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 [m/s^2]
|
||
|
);
|
||
|
|
||
|
%% Populate opts with input parameters
|
||
|
if exist('opts_param','var')
|
||
|
for opt = fieldnames(opts_param)'
|
||
|
opts.(opt{1}) = opts_param.(opt{1});
|
||
|
end
|
||
|
end
|
||
|
|
||
|
%%
|
||
|
sim_conf = struct();
|
||
|
|
||
|
%%
|
||
|
sim_conf.Ts = opts.Ts;
|
||
|
sim_conf.Tsim = opts.Tsim;
|
||
|
sim_conf.cl_time = opts.cl_time;
|
||
|
|
||
|
%% Gravity
|
||
|
if opts.gravity
|
||
|
sim_conf.g = -9.8;
|
||
|
else
|
||
|
sim_conf.g = 0;
|
||
|
end
|
||
|
|
||
|
%% Save
|
||
|
save('./mat/sim_conf.mat', 'sim_conf');
|
||
|
|
||
|
end
|
||
|
|