% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% function paramsout = AddHexapodFields( params );
%
% Inserts SimSect++ Hexapod model related defaults into the supplied
% parameter struct.
%
% The parameter struct must be initialized with InitSimSect function 
% call.
%
% See also:
%
% InitSimSect, CreateRCFile, RunSimSect and LoadSimSectData
%

function paramsout = AddHexapodFields( params );

paramsout = params;

paramsout.finalTime = 1.0;

% Basic initial conditions
paramsout.r_x = 0;
paramsout.r_y = 0;
paramsout.r_z = 0.18;
paramsout.v_x = 0.0;
paramsout.v_y = 0.0;
paramsout.v_z = 0.0;
paramsout.w_x = 0.0;
paramsout.w_y = 0.0;
paramsout.w_z = 0.0;

% Integrator configuration
paramsout.recordPeriod   = 0.01;
paramsout.measurePeriod  = 0.5;
paramsout.dataBaseName   = 'hexapod';
paramsout.dataOutputType = 'matlab';
paramsout.useGeomview    = 1;
paramsout.framerate      = 120;

paramsout.systemName = 'hexapod';
paramsout.controller = 'open-loop';

% Hexapod structural parameters
paramsout.friction_coeff = 5000.8;
paramsout.max_torque = 7;
paramsout.max_speed = 10000;
paramsout.g = 9.8;
paramsout.q_rt = 0.17;
paramsout.q_rl = 0.171;
paramsout.body_mass = 7;
paramsout.leg_mass = 0.003;

paramsout.cycle_time = 0.6;
paramsout.sweep_angle = 0.4;
paramsout.flight_time = 0.25;
paramsout.leg_offset = -0.1;

paramsout.KP = 50;
paramsout.KD = 0.1;

paramsout.theta0_k = 300;
paramsout.theta1_k = 400;
paramsout.theta2_k = 300;
paramsout.theta3_k = 300;
paramsout.theta4_k = 400;
paramsout.theta5_k = 300;

paramsout.theta0_r0 = 0.0;
paramsout.theta1_r0 = 0.0;
paramsout.theta2_r0 = 0.0;
paramsout.theta3_r0 = -0.0;
paramsout.theta4_r0 = -0.0;
paramsout.theta5_r0 = -0.0;

paramsout.theta0_d = 1.2;
paramsout.theta1_d = 1.6;
paramsout.theta2_d = 1.2;
paramsout.theta3_d = 1.2;
paramsout.theta4_d = 1.6;
paramsout.theta5_d = 1.2;

paramsout.rho0_k = 1500;
paramsout.rho1_k = 2000;
paramsout.rho2_k = 1500;
paramsout.rho3_k = 1500;
paramsout.rho4_k = 2000;
paramsout.rho5_k = 1500;

paramsout.rho0_r0 = 0.17;
paramsout.rho1_r0 = 0.17;
paramsout.rho2_r0 = 0.17;
paramsout.rho3_r0 = 0.17;
paramsout.rho4_r0 = 0.17;
paramsout.rho5_r0 = 0.17;

paramsout.rho0_d = 12;
paramsout.rho1_d = 16;
paramsout.rho2_d = 12;
paramsout.rho3_d = 12;
paramsout.rho4_d = 16;
paramsout.rho5_d = 12;

paramsout.attach0_x = 0.1;
paramsout.attach0_y = -0.2;
paramsout.attach0_z = 0;
paramsout.attach1_x = 0.15;
paramsout.attach1_y = 0;
paramsout.attach1_z = 0;
paramsout.attach2_x = 0.1;
paramsout.attach2_y = 0.2;
paramsout.attach2_z = 0;
paramsout.attach3_x = -0.1;
paramsout.attach3_y = -0.2;
paramsout.attach3_z = 0;
paramsout.attach4_x = -0.15;
paramsout.attach4_y = 0;
paramsout.attach4_z = 0;
paramsout.attach5_x = -0.1;
paramsout.attach5_y = 0.2;
paramsout.attach5_z = 0;

paramsout.J_11 = 0.1;
paramsout.J_22 = 0.02917;
paramsout.J_33 = 0.11700;

paramsout.terrain = 'flat';
paramsout.terrain_arg1 = 0.05;
paramsout.terrain_arg2 = 10;
paramsout.terrain_arg3 = 10;

paramsout.grid_xsteps = 50;
paramsout.grid_ysteps = 150;
paramsout.grid_xsize = 5.0;
paramsout.grid_ysize = 15.0;

