diff --git a/README.md b/README.md index 3605b2f..b741dbd 100644 --- a/README.md +++ b/README.md @@ -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:
diff --git a/architectures/arch_logical.slx b/architectures/arch_logical.slx index d3d4b58..d8be938 100644 Binary files a/architectures/arch_logical.slx and b/architectures/arch_logical.slx differ diff --git a/architectures/arch_logical~mdl.slmx b/architectures/arch_logical~mdl.slmx index d5a19fa..dfaeb84 100644 Binary files a/architectures/arch_logical~mdl.slmx and b/architectures/arch_logical~mdl.slmx differ diff --git a/assets/architecture.png b/assets/architecture.png index ed1c435..5e64551 100644 Binary files a/assets/architecture.png and b/assets/architecture.png differ diff --git a/models/Motor.slx b/models/Actuation.slx similarity index 64% rename from models/Motor.slx rename to models/Actuation.slx index 3ae55d1..909674e 100644 Binary files a/models/Motor.slx and b/models/Actuation.slx differ diff --git a/models/Controller.slx b/models/Controller.slx index 124cf49..d7fb9b5 100644 Binary files a/models/Controller.slx and b/models/Controller.slx differ diff --git a/resources/project/aPSZTDXRjCsxkLD0Rd1_fiBDTLQ/rOdbhaVAOjehS8iTXfkxXNBMoUUd.xml b/resources/project/aPSZTDXRjCsxkLD0Rd1_fiBDTLQ/itRMsrufNsvOBuj39ePmMVQzZ48d.xml similarity index 50% rename from resources/project/aPSZTDXRjCsxkLD0Rd1_fiBDTLQ/rOdbhaVAOjehS8iTXfkxXNBMoUUd.xml rename to resources/project/aPSZTDXRjCsxkLD0Rd1_fiBDTLQ/itRMsrufNsvOBuj39ePmMVQzZ48d.xml index 7a6326b..fda6c04 100644 --- a/resources/project/aPSZTDXRjCsxkLD0Rd1_fiBDTLQ/rOdbhaVAOjehS8iTXfkxXNBMoUUd.xml +++ b/resources/project/aPSZTDXRjCsxkLD0Rd1_fiBDTLQ/itRMsrufNsvOBuj39ePmMVQzZ48d.xml @@ -1,6 +1,6 @@ - + - \ No newline at end of file diff --git a/resources/project/aPSZTDXRjCsxkLD0Rd1_fiBDTLQ/itRMsrufNsvOBuj39ePmMVQzZ48p.xml b/resources/project/aPSZTDXRjCsxkLD0Rd1_fiBDTLQ/itRMsrufNsvOBuj39ePmMVQzZ48p.xml new file mode 100644 index 0000000..5534c7a --- /dev/null +++ b/resources/project/aPSZTDXRjCsxkLD0Rd1_fiBDTLQ/itRMsrufNsvOBuj39ePmMVQzZ48p.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/aPSZTDXRjCsxkLD0Rd1_fiBDTLQ/rOdbhaVAOjehS8iTXfkxXNBMoUUp.xml b/resources/project/aPSZTDXRjCsxkLD0Rd1_fiBDTLQ/rOdbhaVAOjehS8iTXfkxXNBMoUUp.xml deleted file mode 100644 index a6c92f5..0000000 --- a/resources/project/aPSZTDXRjCsxkLD0Rd1_fiBDTLQ/rOdbhaVAOjehS8iTXfkxXNBMoUUp.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/scripts/cleanup.m b/scripts/cleanup.m index 781bb75..a95c18e 100644 --- a/scripts/cleanup.m +++ b/scripts/cleanup.m @@ -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; @@ -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'); \ No newline at end of file diff --git a/scripts/run_mech_explorer.m b/scripts/run_mech_explorer.m index 9772411..217bc91 100644 --- a/scripts/run_mech_explorer.m +++ b/scripts/run_mech_explorer.m @@ -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 diff --git a/tests/playback_mech_explorer.slx b/tests/playback_mech_explorer.slx index 91b30ab..02995f8 100644 Binary files a/tests/playback_mech_explorer.slx and b/tests/playback_mech_explorer.slx differ