Skip to content

Commit

Permalink
Fixes/improvements (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
pattacini committed Jun 23, 2024
1 parent 1e0bc54 commit 3514c23
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 36 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ Run the test suite to verify that the system is working as expected.

https://github.com/icub-tech-iit/training-systemcomposer-pendulum/assets/3738070/806964fd-47a4-47af-8a7e-4d485ba7d0b5

> [!warning]
> To correctly render the simulation outputs, always run all the test cases at once.
### 🎓 Assignment
- Create a further requirement to verify the safety properties of the system when the pendulum gets
in contact with an external obstacle while being driven by the controller at a constant velocity: <br>
Expand Down
Binary file modified architectures/arch_logical.slx
Binary file not shown.
Binary file modified architectures/arch_logical~mdl.slmx
Binary file not shown.
Binary file modified assets/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file renamed models/Motor.slx → models/Actuation.slx
Binary file not shown.
Binary file modified models/Controller.slx
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<?xml version="1.0" ?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design"/>
<Label UUID="design"></Label>
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info location="Actuation.slx" type="File"></Info>

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/cleanup.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
% Copyright (C) 2024 Fondazione Istitito Italiano di Tecnologia (IIT)
% All Rights Reserved.

% Close all open models discarding pending changes
bdclose('all');

% Clear test file from Test Manager
sltest.testmanager.clear;

Expand All @@ -16,5 +13,8 @@
% Close Requirement sets and editor discarding pending changes
slreq.clear();

% Close all open models discarding pending changes
bdclose('all');

% Close all dictionaries discarding pending changes
Simulink.data.dictionary.closeAll('-discard');
52 changes: 26 additions & 26 deletions scripts/run_mech_explorer.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,40 @@ function run_mech_explorer(pendulum_type, obstacle_enable, varargin)
%#ok<*AGROW>
%#ok<*NASGU>

if nargin == 2
S1 = dir('./cache');
S1 = S1(~[S1.isdir]);
S2 = [];
for i = 1:length(S1)
if contains(S1(i).name, 'voltage')
S2 = [S2; S1(i)];
if nargin == 2
S1 = dir('./cache');
S1 = S1(~[S1.isdir]);
S2 = [];
for i = 1:length(S1)
if contains(S1(i).name, 'voltage')
S2 = [S2; S1(i)];
end
end
[~, idx] = sort([S2.datenum]);
filename = ['./cache/' S2(idx(end)).name];
else
filename = varargin{1};
end
[~, idx] = sort([S2.datenum]);
filename = ['./cache/' S2(idx(end)).name];
else
filename = varargin{1};
end

data = load(filename);
Tend = data.voltage.Time(end);
data = load(filename);
Tend = data.voltage.Time(end);

mdl = 'playback_mech_explorer';
load_system(mdl);
mdl = 'playback_mech_explorer';
load_system(mdl);

set_param(mdl, 'StopTime', num2str(Tend));
set_param(mdl, 'StopTime', num2str(Tend));

mdlws = get_param(mdl, 'ModelWorkspace');
setVariablePart(mdlws, 'pendulum_type.Value', pendulum_type);
setVariablePart(mdlws, 'obstacle_enable.Value', obstacle_enable);
set_param([mdl '/From File'], 'FileName', filename);
mdlws = get_param(mdl, 'ModelWorkspace');
setVariablePart(mdlws, 'pendulum_type.Value', pendulum_type);
setVariablePart(mdlws, 'obstacle_enable.Value', obstacle_enable);
set_param([mdl '/From File'], 'FileName', filename);

set_param(mdl, 'SimulationCommand', 'Update');
pause(3);
set_param(mdl, 'SimulationCommand', 'Update');
pause(3);

sim(mdl);
pause(3);
sim(mdl);
pause(3);

close_system(mdl, 0);
close_system(mdl, 0);

end
Binary file modified tests/playback_mech_explorer.slx
Binary file not shown.

0 comments on commit 3514c23

Please sign in to comment.