function robot = get_baseParams(robot,opt) % Seed the random number generator based on the current time rng('shuffle'); ndof = robot.ndof; includeMotorDynamics = false; % ------------------------------------------------------------------------ % Set limits on posistion and velocities % ------------------------------------------------------------------------ q_min = -pi*ones(ndof,1); q_max = pi*ones(ndof,1); qd_max = 3*pi*ones(ndof,1); q2d_max = 6*pi*ones(ndof,1); % ----------------------------------------------------------------------- % Find relation between independent columns and dependent columns % ----------------------------------------------------------------------- % Get observation matrix of identifiable paramters W = []; for i = 1:250 q_rnd = q_min + (q_max - q_min).*rand(ndof,1); qd_rnd = -qd_max + 2*qd_max.*rand(ndof,1); q2d_rnd = -q2d_max + 2*q2d_max.*rand(ndof,1); if includeMotorDynamics % Y = regressorWithMotorDynamics(q_rnd,qd_rnd,q2d_rnd); else standard_regressor_func = sprintf('standard_regressor_%s',opt.robotName); Y = feval(standard_regressor_func, q_rnd,qd_rnd,q2d_rnd); %FIXME: better compute standard_regressor % Y = standard_regressor_func(q_rnd,qd_rnd,q2d_rnd); end W = vertcat(W,Y); end % QR decomposition with pivoting: W*E = Q*R % R is upper triangular matrix % Q is unitary matrix % E is permutation matrix [Q, R, E] = qr(W); % matrix W has rank qr_rank which is number number of base parameters qr_rank = rank(W); % R = [R1 R2; % 0 0] % R1 is bbxbb upper triangular and regu ar matrix % R2 is bbx(c-qr_rank) matrix where c is number of standard parameters R1 = R(1:qr_rank,1:qr_rank); R2 = R(1:qr_rank,qr_rank+1:end); beta = R1\R2; % the zero rows of K correspond to independent columns of WP beta(abs(beta)