Skip to content

Commit

Permalink
Extend PR #7 to test_ci.m
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioBergonti committed Jul 6, 2022
1 parent 64eb586 commit b1cceda
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/test_ci.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@
run(fullfile(src_full_path,'setup_sim.m'))

%% Prepare Morphing Cover Model with Motors and its Initial Configuration
fprintf(' ========= script TEST_CI ========= \n')
fprintf('- script TEST_CI: start\n')

% 1) create model.
fprintf('- script TEST_CI: creating model\n')
model = mystica.model.getModelCoverSquareLinks('n',3,'m',3,'restConfiguration','flat','linkDimension',0.0482);
% 2) evaluate morphing cover initial configuration.
% initial configuration is computed running a controlled simulation starting from flat configuration. `mBodyTwist_0` is the control variable.
fprintf('- script TEST_CI: evaluating initial configuration\n')
stgs = mystica.stgs.getDefaultSettingsSimKinAbs(model,'stgs_integrator_limitMaximumTime',4);
stgs.desiredShape.fun = @(x,y,t) -5*x.^2 -5*y.^2;
[data,stateKin] = mystica.runSimKinAbs('model',model,'mBodyPosQuat_0',model.getMBodyPosQuatRestConfiguration,'stgs',stgs,'nameControllerClass','ControllerKinAbs');
% 3) solve the motors placement problem.
fprintf('- script TEST_CI: solving motors placement problem\n')
[model,sensitivity,genAlgrthm] = selectMotorPositioning('model',model,'state',stateKin,'stgs',stgs);
mBodyPosQuat_0 = data.mBodyPosQuat_0(:,end);

Expand All @@ -33,6 +38,8 @@

%% Simulation

fprintf('- script TEST_CI: simulating the kinematics\n')

% stgs: get default values
stgs = mystica.stgs.getDefaultSettingsSimKinRel(model,'startFile',stgs.saving.workspace.name,'stgs_integrator_limitMaximumTime',6);
% stgs: controller parameters
Expand All @@ -54,3 +61,5 @@
% Verify results kinematic simulation
assert(max(abs(data.errorPositionNormals(:,end)))<1e-2,'errorPositionNormals is bigger than expected')
assert(max(abs(data.errorOrientationNormals(:,end)))<10,'errorOrientationNormals is bigger than expected')

fprintf(' ========= TEST_CI ended ========= \n')

0 comments on commit b1cceda

Please sign in to comment.