From e02d16c590d69e01c598c53854edaf48a6d3ec3f Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Mon, 30 Sep 2024 16:10:24 -0700 Subject: [PATCH 01/24] Replace Doxygen download with choco install; upgrade Mac runners to macOS 14 now that 12 is deprecated --- .github/workflows/continuous_integration.yml | 29 +++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index f8c222f5d7..1668f367aa 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -26,9 +26,10 @@ jobs: - name: Install Doxygen # choco install doxygen.portable # <-- too unreliable. run: | - (New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/myosin/files/doxygen-1.8.14.windows.x64.bin.zip/download", "doxygen.zip") - 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen - echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH + choco install doxygen.portable + # (New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/myosin/files/doxygen-1.8.14.windows.x64.bin.zip/download", "doxygen.zip") + # 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen + # echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH - name: Install Python packages uses: actions/setup-python@v4 @@ -166,9 +167,10 @@ jobs: - name: Install Doxygen # choco install doxygen.portable # <-- too unreliable. run: | - (New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/myosin/files/doxygen-1.8.14.windows.x64.bin.zip/download", "doxygen.zip") - 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen - echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH + choco install doxygen.portable + # (New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/myosin/files/doxygen-1.8.14.windows.x64.bin.zip/download", "doxygen.zip") + # 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen + # echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH - name: Install Python packages uses: actions/setup-python@v4 @@ -274,9 +276,10 @@ jobs: - name: Install Doxygen # choco install doxygen.portable # <-- too unreliable. run: | - (New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/myosin/files/doxygen-1.8.14.windows.x64.bin.zip/download", "doxygen.zip") - 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen - echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH + choco install doxygen.portable + # (New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/myosin/files/doxygen-1.8.14.windows.x64.bin.zip/download", "doxygen.zip") + # 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen + # echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH - name: Install Python packages uses: actions/setup-python@v4 @@ -370,7 +373,7 @@ jobs: mac_target: name: Mac [target] - runs-on: macos-12 + runs-on: macos-14 if: ${{ contains(github.event.pull_request.title, '[perf-mac]') || contains(github.event.pull_request.body, '[perf-mac]') }} @@ -498,7 +501,7 @@ jobs: mac_source: - runs-on: macos-12 + runs-on: macos-14 name: ${{ (contains(github.event.pull_request.title, '[perf-mac]') || contains(github.event.pull_request.body, '[perf-mac]')) && 'Mac [source]' || 'Mac' }} @@ -635,7 +638,7 @@ jobs: - windows2022_target - windows2022_source - runs-on: macos-12 + runs-on: macos-14 if: ${{ contains(github.event.pull_request.title, '[perf-win]') || contains(github.event.pull_request.body, '[perf-win]') }} @@ -719,7 +722,7 @@ jobs: - mac_target - mac_source - runs-on: macos-12 + runs-on: macos-14 if: ${{ contains(github.event.pull_request.title, '[perf-mac]') || contains(github.event.pull_request.body, '[perf-mac]') }} From 394fad0471ccc9bc180c7f11f1fbbdde98188fc2 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Tue, 1 Oct 2024 09:55:52 -0700 Subject: [PATCH 02/24] Use ubuntu-latest for perf jobs --- .github/workflows/continuous_integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 1668f367aa..c47540f39e 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -638,7 +638,7 @@ jobs: - windows2022_target - windows2022_source - runs-on: macos-14 + runs-on: ubuntu-latest if: ${{ contains(github.event.pull_request.title, '[perf-win]') || contains(github.event.pull_request.body, '[perf-win]') }} @@ -722,7 +722,7 @@ jobs: - mac_target - mac_source - runs-on: macos-14 + runs-on: ubuntu-latest if: ${{ contains(github.event.pull_request.title, '[perf-mac]') || contains(github.event.pull_request.body, '[perf-mac]') }} From 678a86e633ede6244cb484c5343a8f4e9803ae6f Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Tue, 1 Oct 2024 10:09:07 -0700 Subject: [PATCH 03/24] Fix Mac build failures --- .../Test/testDeGrooteFregly2016Muscle.cpp | 17 ++++++++++------- Vendors/tropter/tests/test_derivatives.cpp | 5 +++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp index 07d6951a1c..2565ef232f 100644 --- a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp +++ b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp @@ -597,13 +597,16 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { CHECK(muscle.getFiberVelocityAlongTendon(state) == -1 * Vmax); CHECK(muscle.getPennationAngularVelocity(state) == 0); CHECK(muscle.getTendonVelocity(state) == 0); - CHECK(muscle.getForceVelocityMultiplier(state) == 0); + CHECK_THAT(muscle.getForceVelocityMultiplier(state), + Catch::Matchers::WithinRel(0.0, 1e-10)); model.realizeDynamics(state); const auto Fmax = muscle.getMaxIsometricForce(); const auto fpass = muscle.calcPassiveForceMultiplier(1.0); - CHECK(muscle.getActiveFiberForce(state) == 0); - CHECK(muscle.getActiveFiberForceAlongTendon(state) == 0); + CHECK_THAT(muscle.getActiveFiberForce(state), + Catch::Matchers::WithinRel(0.0, 1e-10)); + CHECK_THAT(muscle.getActiveFiberForceAlongTendon(state), + Catch::Matchers::WithinRel(0.0, 1e-10)); CHECK(muscle.getPassiveFiberForce(state) == Approx(Fmax * fpass)); CHECK(muscle.getPassiveFiberForceAlongTendon(state) == Approx(Fmax * fpass)); @@ -635,10 +638,10 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { SimTK::Real tendonStiffness = SimTK::Infinity; CHECK(muscle.getTendonStiffness(state) == SimTK::Infinity); - CHECK(muscle.getMuscleStiffness(state) == - Approx(muscle.calcMuscleStiffness( - tendonStiffness, fiberStiffnessAlongTendon))); - + SimTK::Real muscleStiffness = muscle.calcMuscleStiffness( + tendonStiffness, fiberStiffnessAlongTendon); + CHECK_THAT(muscle.getMuscleStiffness(state), + Catch::Matchers::WithinRel(muscleStiffness, 1e-10)); CHECK(muscle.getFiberActivePower(state) == Approx(0.0)); CHECK(muscle.getFiberPassivePower(state) == Approx(Vmax * Fmax * fpass)); diff --git a/Vendors/tropter/tests/test_derivatives.cpp b/Vendors/tropter/tests/test_derivatives.cpp index b20979ab38..187574fd0f 100644 --- a/Vendors/tropter/tests/test_derivatives.cpp +++ b/Vendors/tropter/tests/test_derivatives.cpp @@ -656,8 +656,9 @@ TEST_CASE("User-supplied sparsity of Hessian of Lagrangian") const auto& i = hes_sparsity.row[inz]; const auto& j = hes_sparsity.col[inz]; INFO(inz << " (" << i << " " << j << ")"); - REQUIRE(analytical_hessian(i, j) == - Approx(actual_hessian_values[inz]).epsilon(1e-5)); + REQUIRE_THAT(analytical_hessian(i, j), + Catch::Matchers::WithinRel( + actual_hessian_values[inz], 1e-5)); } } { From 25be1b38a346ac6253e17d341506bad6a8cb4811 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Tue, 1 Oct 2024 11:17:40 -0700 Subject: [PATCH 04/24] Reduce tolerances on failing tests --- .../Actuators/Test/testDeGrooteFregly2016Muscle.cpp | 11 ++++++----- Vendors/tropter/tests/test_derivatives.cpp | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp index 2565ef232f..f556a09ee0 100644 --- a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp +++ b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp @@ -598,15 +598,15 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { CHECK(muscle.getPennationAngularVelocity(state) == 0); CHECK(muscle.getTendonVelocity(state) == 0); CHECK_THAT(muscle.getForceVelocityMultiplier(state), - Catch::Matchers::WithinRel(0.0, 1e-10)); + Catch::Matchers::WithinRel(0.0, 1e-8)); model.realizeDynamics(state); const auto Fmax = muscle.getMaxIsometricForce(); const auto fpass = muscle.calcPassiveForceMultiplier(1.0); CHECK_THAT(muscle.getActiveFiberForce(state), - Catch::Matchers::WithinRel(0.0, 1e-10)); + Catch::Matchers::WithinRel(0.0, 1e-8)); CHECK_THAT(muscle.getActiveFiberForceAlongTendon(state), - Catch::Matchers::WithinRel(0.0, 1e-10)); + Catch::Matchers::WithinRel(0.0, 1e-8)); CHECK(muscle.getPassiveFiberForce(state) == Approx(Fmax * fpass)); CHECK(muscle.getPassiveFiberForceAlongTendon(state) == Approx(Fmax * fpass)); @@ -641,8 +641,9 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { SimTK::Real muscleStiffness = muscle.calcMuscleStiffness( tendonStiffness, fiberStiffnessAlongTendon); CHECK_THAT(muscle.getMuscleStiffness(state), - Catch::Matchers::WithinRel(muscleStiffness, 1e-10)); - CHECK(muscle.getFiberActivePower(state) == Approx(0.0)); + Catch::Matchers::WithinRel(muscleStiffness, 1e-8)); + CHECK_THAT(muscle.getFiberActivePower(state), + Catch::Matchers::WithinRel(0.0, 1e-8)); CHECK(muscle.getFiberPassivePower(state) == Approx(Vmax * Fmax * fpass)); CHECK(muscle.getTendonPower(state) == Approx(0.0)); diff --git a/Vendors/tropter/tests/test_derivatives.cpp b/Vendors/tropter/tests/test_derivatives.cpp index 187574fd0f..e85d31c73d 100644 --- a/Vendors/tropter/tests/test_derivatives.cpp +++ b/Vendors/tropter/tests/test_derivatives.cpp @@ -658,7 +658,7 @@ TEST_CASE("User-supplied sparsity of Hessian of Lagrangian") INFO(inz << " (" << i << " " << j << ")"); REQUIRE_THAT(analytical_hessian(i, j), Catch::Matchers::WithinRel( - actual_hessian_values[inz], 1e-5)); + actual_hessian_values[inz], 1e-4)); } } { From a8f706162a3028acbc4968c23fda9f1745e4620f Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Tue, 1 Oct 2024 18:01:18 -0700 Subject: [PATCH 05/24] Use WithinAbs over WithinRel --- .../Actuators/Test/testDeGrooteFregly2016Muscle.cpp | 10 +++++----- Vendors/tropter/tests/test_derivatives.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp index f556a09ee0..c55a4c34e9 100644 --- a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp +++ b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp @@ -598,15 +598,15 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { CHECK(muscle.getPennationAngularVelocity(state) == 0); CHECK(muscle.getTendonVelocity(state) == 0); CHECK_THAT(muscle.getForceVelocityMultiplier(state), - Catch::Matchers::WithinRel(0.0, 1e-8)); + Catch::Matchers::WithinAbs(0.0)); model.realizeDynamics(state); const auto Fmax = muscle.getMaxIsometricForce(); const auto fpass = muscle.calcPassiveForceMultiplier(1.0); CHECK_THAT(muscle.getActiveFiberForce(state), - Catch::Matchers::WithinRel(0.0, 1e-8)); + Catch::Matchers::WithinAbs(0.0)); CHECK_THAT(muscle.getActiveFiberForceAlongTendon(state), - Catch::Matchers::WithinRel(0.0, 1e-8)); + Catch::Matchers::WithinAbs(0.0)); CHECK(muscle.getPassiveFiberForce(state) == Approx(Fmax * fpass)); CHECK(muscle.getPassiveFiberForceAlongTendon(state) == Approx(Fmax * fpass)); @@ -641,9 +641,9 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { SimTK::Real muscleStiffness = muscle.calcMuscleStiffness( tendonStiffness, fiberStiffnessAlongTendon); CHECK_THAT(muscle.getMuscleStiffness(state), - Catch::Matchers::WithinRel(muscleStiffness, 1e-8)); + Catch::Matchers::WithinAbs(muscleStiffness)); CHECK_THAT(muscle.getFiberActivePower(state), - Catch::Matchers::WithinRel(0.0, 1e-8)); + Catch::Matchers::WithinAbs(0.0)); CHECK(muscle.getFiberPassivePower(state) == Approx(Vmax * Fmax * fpass)); CHECK(muscle.getTendonPower(state) == Approx(0.0)); diff --git a/Vendors/tropter/tests/test_derivatives.cpp b/Vendors/tropter/tests/test_derivatives.cpp index e85d31c73d..2dfa55c4cd 100644 --- a/Vendors/tropter/tests/test_derivatives.cpp +++ b/Vendors/tropter/tests/test_derivatives.cpp @@ -657,8 +657,8 @@ TEST_CASE("User-supplied sparsity of Hessian of Lagrangian") const auto& j = hes_sparsity.col[inz]; INFO(inz << " (" << i << " " << j << ")"); REQUIRE_THAT(analytical_hessian(i, j), - Catch::Matchers::WithinRel( - actual_hessian_values[inz], 1e-4)); + Catch::Matchers::WithinAbs( + actual_hessian_values[inz], 1e-5)); } } { From fc851e1eaafebdb89750dcf14d9ded46c8498707 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Tue, 1 Oct 2024 18:38:26 -0700 Subject: [PATCH 06/24] Add tolerances for WithinAbs usages --- .github/workflows/continuous_integration.yml | 21 ++++++++----------- .../Test/testDeGrooteFregly2016Muscle.cpp | 10 ++++----- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index c47540f39e..6b22fca9e2 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -26,10 +26,9 @@ jobs: - name: Install Doxygen # choco install doxygen.portable # <-- too unreliable. run: | - choco install doxygen.portable - # (New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/myosin/files/doxygen-1.8.14.windows.x64.bin.zip/download", "doxygen.zip") - # 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen - # echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH + (New-Object System.Net.WebClient).DownloadFile("https://github.com/doxygen/doxygen/releases/download/Release_1_12_0/doxygen-1.12.0.windows.x64.bin.zip/download", "doxygen.zip") + 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen + echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH - name: Install Python packages uses: actions/setup-python@v4 @@ -167,10 +166,9 @@ jobs: - name: Install Doxygen # choco install doxygen.portable # <-- too unreliable. run: | - choco install doxygen.portable - # (New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/myosin/files/doxygen-1.8.14.windows.x64.bin.zip/download", "doxygen.zip") - # 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen - # echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH + (New-Object System.Net.WebClient).DownloadFile("https://github.com/doxygen/doxygen/releases/download/Release_1_12_0/doxygen-1.12.0.windows.x64.bin.zip/download", "doxygen.zip") + 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen + echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH - name: Install Python packages uses: actions/setup-python@v4 @@ -276,10 +274,9 @@ jobs: - name: Install Doxygen # choco install doxygen.portable # <-- too unreliable. run: | - choco install doxygen.portable - # (New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/myosin/files/doxygen-1.8.14.windows.x64.bin.zip/download", "doxygen.zip") - # 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen - # echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH + (New-Object System.Net.WebClient).DownloadFile("https://github.com/doxygen/doxygen/releases/download/Release_1_12_0/doxygen-1.12.0.windows.x64.bin.zip/download", "doxygen.zip") + 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen + echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH - name: Install Python packages uses: actions/setup-python@v4 diff --git a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp index c55a4c34e9..ca7cb0049f 100644 --- a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp +++ b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp @@ -598,15 +598,15 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { CHECK(muscle.getPennationAngularVelocity(state) == 0); CHECK(muscle.getTendonVelocity(state) == 0); CHECK_THAT(muscle.getForceVelocityMultiplier(state), - Catch::Matchers::WithinAbs(0.0)); + Catch::Matchers::WithinAbs(0.0, 1e-10)); model.realizeDynamics(state); const auto Fmax = muscle.getMaxIsometricForce(); const auto fpass = muscle.calcPassiveForceMultiplier(1.0); CHECK_THAT(muscle.getActiveFiberForce(state), - Catch::Matchers::WithinAbs(0.0)); + Catch::Matchers::WithinAbs(0.0, 1e-10)); CHECK_THAT(muscle.getActiveFiberForceAlongTendon(state), - Catch::Matchers::WithinAbs(0.0)); + Catch::Matchers::WithinAbs(0.0, 1e-10)); CHECK(muscle.getPassiveFiberForce(state) == Approx(Fmax * fpass)); CHECK(muscle.getPassiveFiberForceAlongTendon(state) == Approx(Fmax * fpass)); @@ -641,9 +641,9 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { SimTK::Real muscleStiffness = muscle.calcMuscleStiffness( tendonStiffness, fiberStiffnessAlongTendon); CHECK_THAT(muscle.getMuscleStiffness(state), - Catch::Matchers::WithinAbs(muscleStiffness)); + Catch::Matchers::WithinAbs(muscleStiffness, 1e-10)); CHECK_THAT(muscle.getFiberActivePower(state), - Catch::Matchers::WithinAbs(0.0)); + Catch::Matchers::WithinAbs(0.0, 1e-10)); CHECK(muscle.getFiberPassivePower(state) == Approx(Vmax * Fmax * fpass)); CHECK(muscle.getTendonPower(state) == Approx(0.0)); From 0ea8583cf6229e965b70ec586d86442a5f38e959 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Tue, 1 Oct 2024 19:27:10 -0700 Subject: [PATCH 07/24] Try using checkout@v4 to avoid temp HOME directory issue --- .github/workflows/continuous_integration.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 6b22fca9e2..108aa79b69 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -21,7 +21,7 @@ jobs: runs-on: windows-2019 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Doxygen # choco install doxygen.portable # <-- too unreliable. @@ -159,7 +159,7 @@ jobs: runs-on: windows-2022 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.base.ref }} @@ -269,7 +269,7 @@ jobs: version: ${{ steps.configure.outputs.version }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Doxygen # choco install doxygen.portable # <-- too unreliable. @@ -375,7 +375,7 @@ jobs: if: ${{ contains(github.event.pull_request.title, '[perf-mac]') || contains(github.event.pull_request.body, '[perf-mac]') }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.base.ref }} @@ -506,7 +506,7 @@ jobs: version: ${{ steps.configure.outputs.version }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Python packages uses: actions/setup-python@v4 @@ -798,7 +798,7 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Python packages uses: actions/setup-python@v4 @@ -912,7 +912,7 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Python packages uses: actions/setup-python@v4 @@ -1060,7 +1060,7 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check for tabs # Ensure that there are no tabs in source code. From 4c1e2beaa64324042dda464110c4331299ad714f Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Tue, 1 Oct 2024 19:32:45 -0700 Subject: [PATCH 08/24] Use correct URL for doxygen download --- .github/workflows/continuous_integration.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 108aa79b69..fce0367436 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -26,7 +26,7 @@ jobs: - name: Install Doxygen # choco install doxygen.portable # <-- too unreliable. run: | - (New-Object System.Net.WebClient).DownloadFile("https://github.com/doxygen/doxygen/releases/download/Release_1_12_0/doxygen-1.12.0.windows.x64.bin.zip/download", "doxygen.zip") + (New-Object System.Net.WebClient).DownloadFile("https://github.com/doxygen/doxygen/releases/download/Release_1_12_0/doxygen-1.12.0.windows.x64.bin.zip", "doxygen.zip") 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH @@ -166,7 +166,7 @@ jobs: - name: Install Doxygen # choco install doxygen.portable # <-- too unreliable. run: | - (New-Object System.Net.WebClient).DownloadFile("https://github.com/doxygen/doxygen/releases/download/Release_1_12_0/doxygen-1.12.0.windows.x64.bin.zip/download", "doxygen.zip") + (New-Object System.Net.WebClient).DownloadFile("https://github.com/doxygen/doxygen/releases/download/Release_1_12_0/doxygen-1.12.0.windows.x64.bin.zip", "doxygen.zip") 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH @@ -274,7 +274,7 @@ jobs: - name: Install Doxygen # choco install doxygen.portable # <-- too unreliable. run: | - (New-Object System.Net.WebClient).DownloadFile("https://github.com/doxygen/doxygen/releases/download/Release_1_12_0/doxygen-1.12.0.windows.x64.bin.zip/download", "doxygen.zip") + (New-Object System.Net.WebClient).DownloadFile("https://github.com/doxygen/doxygen/releases/download/Release_1_12_0/doxygen-1.12.0.windows.x64.bin.zip", "doxygen.zip") 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH From 38ede67dff0b401e2ed58b39ed8b63dd27c3b66f Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Tue, 1 Oct 2024 20:15:44 -0700 Subject: [PATCH 09/24] Add some debugging print out statements --- OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp index ca7cb0049f..a58fe7f20f 100644 --- a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp +++ b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp @@ -640,6 +640,12 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { CHECK(muscle.getTendonStiffness(state) == SimTK::Infinity); SimTK::Real muscleStiffness = muscle.calcMuscleStiffness( tendonStiffness, fiberStiffnessAlongTendon); + CAPTURE(muscleStiffness); + CAPTURE(tendonStiffness); + CAPTURE(fiberStiffnessAlongTendon); + const MuscleDynamicsInfo& mdi = getMuscleDynamicsInfo(s) + CAPTURE(mdi.tendonStiffness); + CAPTURE(mdi.fiberStiffnessAlongTendon); CHECK_THAT(muscle.getMuscleStiffness(state), Catch::Matchers::WithinAbs(muscleStiffness, 1e-10)); CHECK_THAT(muscle.getFiberActivePower(state), From 93c571f50504a05b025622ca7e69ef1782470f2d Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Tue, 1 Oct 2024 20:36:04 -0700 Subject: [PATCH 10/24] Add missing semicolon --- OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp index a58fe7f20f..f05d6b733a 100644 --- a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp +++ b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp @@ -643,7 +643,7 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { CAPTURE(muscleStiffness); CAPTURE(tendonStiffness); CAPTURE(fiberStiffnessAlongTendon); - const MuscleDynamicsInfo& mdi = getMuscleDynamicsInfo(s) + const MuscleDynamicsInfo& mdi = getMuscleDynamicsInfo(s); CAPTURE(mdi.tendonStiffness); CAPTURE(mdi.fiberStiffnessAlongTendon); CHECK_THAT(muscle.getMuscleStiffness(state), From e6c3e8e2f1024bab1dd01a8d4e7601f41883b202 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Tue, 1 Oct 2024 22:25:41 -0700 Subject: [PATCH 11/24] Fix typo --- OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp index f05d6b733a..d5df9adfde 100644 --- a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp +++ b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp @@ -643,7 +643,7 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { CAPTURE(muscleStiffness); CAPTURE(tendonStiffness); CAPTURE(fiberStiffnessAlongTendon); - const MuscleDynamicsInfo& mdi = getMuscleDynamicsInfo(s); + const MuscleDynamicsInfo& mdi = muscle.getMuscleDynamicsInfo(s); CAPTURE(mdi.tendonStiffness); CAPTURE(mdi.fiberStiffnessAlongTendon); CHECK_THAT(muscle.getMuscleStiffness(state), From 8d67de218ca483e441270bc090cc8009bf2acd27 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Wed, 2 Oct 2024 08:25:27 -0700 Subject: [PATCH 12/24] Fix debugging outputs --- OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp index d5df9adfde..d69788f140 100644 --- a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp +++ b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -643,9 +644,8 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { CAPTURE(muscleStiffness); CAPTURE(tendonStiffness); CAPTURE(fiberStiffnessAlongTendon); - const MuscleDynamicsInfo& mdi = muscle.getMuscleDynamicsInfo(s); - CAPTURE(mdi.tendonStiffness); - CAPTURE(mdi.fiberStiffnessAlongTendon); + CAPTURE(muscle.getTendonStiffness(state)); + CAPTURE(muscle.getFiberStiffnessAlongTendon(state)); CHECK_THAT(muscle.getMuscleStiffness(state), Catch::Matchers::WithinAbs(muscleStiffness, 1e-10)); CHECK_THAT(muscle.getFiberActivePower(state), From 3587789cce52fe54c05aebb0683f732106203623 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Wed, 2 Oct 2024 08:28:27 -0700 Subject: [PATCH 13/24] Remove unused timing code from testOutputReporter --- OpenSim/Analyses/Test/testOutputReporter.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/OpenSim/Analyses/Test/testOutputReporter.cpp b/OpenSim/Analyses/Test/testOutputReporter.cpp index 13eb7791e5..47bb36c027 100644 --- a/OpenSim/Analyses/Test/testOutputReporter.cpp +++ b/OpenSim/Analyses/Test/testOutputReporter.cpp @@ -27,6 +27,7 @@ #include #include +#include "OpenSim/Common/Logger.h" #include using namespace OpenSim; @@ -197,16 +198,11 @@ void simulateMuscle( state.setTime(initialTime); manager.initialize(state); - cout << "\nIntegrating from " << initialTime << " to " << finalTime << endl; + log_info("Integrating from {} to {}", initialTime, finalTime); - // Start timing the simulation - const clock_t start = clock(); // simulate state = manager.integrate(finalTime); - // how long did it take? - double comp_time = (double)(clock() - start) / CLOCKS_PER_SEC; - //========================================================================== // 4. Print the results //========================================================================== From 5f3a5e76ead444dff96bc6430e6378f5429435d2 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Wed, 2 Oct 2024 09:29:24 -0700 Subject: [PATCH 14/24] Use WithinRel comparison for fiber stiffness since were using a finite-differenced estimate --- .../Actuators/Test/testDeGrooteFregly2016Muscle.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp index d69788f140..79f35cd9d1 100644 --- a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp +++ b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp @@ -634,8 +634,10 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { SimTK::Real fiberStiffnessAlongTendon = diffFiberStiffnessAlongTendon.calcDerivative( muscle.get_optimal_fiber_length()); - CHECK(muscle.getFiberStiffnessAlongTendon(state) == - Approx(fiberStiffnessAlongTendon)); + CAPTURE(muscle.getFiberStiffnessAlongTendon(state)); + CAPTURE(fiberStiffnessAlongTendon); + CHECK_THAT(muscle.getFiberStiffnessAlongTendon(state), + Catch::Matchers::WithinRel(fiberStiffnessAlongTendon, 1e-6)); SimTK::Real tendonStiffness = SimTK::Infinity; CHECK(muscle.getTendonStiffness(state) == SimTK::Infinity); @@ -643,11 +645,9 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { tendonStiffness, fiberStiffnessAlongTendon); CAPTURE(muscleStiffness); CAPTURE(tendonStiffness); - CAPTURE(fiberStiffnessAlongTendon); CAPTURE(muscle.getTendonStiffness(state)); - CAPTURE(muscle.getFiberStiffnessAlongTendon(state)); CHECK_THAT(muscle.getMuscleStiffness(state), - Catch::Matchers::WithinAbs(muscleStiffness, 1e-10)); + Catch::Matchers::WithinRel(muscleStiffness, 1e-6)); CHECK_THAT(muscle.getFiberActivePower(state), Catch::Matchers::WithinAbs(0.0, 1e-10)); CHECK(muscle.getFiberPassivePower(state) == From bc3545f26cbe697e4142a5162609eeab2c0ed74e Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Wed, 2 Oct 2024 09:39:40 -0700 Subject: [PATCH 15/24] Add some debug print outs --- OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp | 5 ----- OpenSim/Analyses/OutputReporter.cpp | 4 ++++ OpenSim/Simulation/Model/AnalysisSet.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp index 79f35cd9d1..5e947ccc06 100644 --- a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp +++ b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp @@ -634,8 +634,6 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { SimTK::Real fiberStiffnessAlongTendon = diffFiberStiffnessAlongTendon.calcDerivative( muscle.get_optimal_fiber_length()); - CAPTURE(muscle.getFiberStiffnessAlongTendon(state)); - CAPTURE(fiberStiffnessAlongTendon); CHECK_THAT(muscle.getFiberStiffnessAlongTendon(state), Catch::Matchers::WithinRel(fiberStiffnessAlongTendon, 1e-6)); @@ -643,9 +641,6 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { CHECK(muscle.getTendonStiffness(state) == SimTK::Infinity); SimTK::Real muscleStiffness = muscle.calcMuscleStiffness( tendonStiffness, fiberStiffnessAlongTendon); - CAPTURE(muscleStiffness); - CAPTURE(tendonStiffness); - CAPTURE(muscle.getTendonStiffness(state)); CHECK_THAT(muscle.getMuscleStiffness(state), Catch::Matchers::WithinRel(muscleStiffness, 1e-6)); CHECK_THAT(muscle.getFiberActivePower(state), diff --git a/OpenSim/Analyses/OutputReporter.cpp b/OpenSim/Analyses/OutputReporter.cpp index 772dcfc4dd..585e52507e 100644 --- a/OpenSim/Analyses/OutputReporter.cpp +++ b/OpenSim/Analyses/OutputReporter.cpp @@ -130,23 +130,27 @@ int OutputReporter::printResults(const std::string& baseName, return 0; } + log_info("OutputReporter checking extension is .sto: {}", extension); OPENSIM_THROW_IF_FRMOBJ(IO::Lowercase(extension) != ".sto", Exception, "Only writing results to '.sto' format is supported."); std::string prefix = dir.empty() ? "" : dir + "/"; + log_info("OutputReporter.printResults: Writing double results to {}.", prefix); auto& tableD = _tableReporterDouble->getTable(); if (tableD.getNumColumns()) { STOFileAdapter_::write(tableD, prefix + baseName + "_Outputs" + extension); } + log_info("OutputReporter.printResults: Writing Vec3 results to {}.", prefix); auto& tableV3 = _tableReporterVec3->getTable(); if (tableV3.getNumColumns()) { STOFileAdapter_::write(tableV3, prefix + baseName + "_OutputsVec3" + extension); } + log_info("OutputReporter.printResults: Writing SpatialVec results to {}.", prefix); auto& tableSV = _tableReporterSpatialVec->getTable(); if (tableSV.getNumColumns()) { STOFileAdapter_::write(tableSV, diff --git a/OpenSim/Simulation/Model/AnalysisSet.cpp b/OpenSim/Simulation/Model/AnalysisSet.cpp index 094593d232..59fb4f6bc9 100644 --- a/OpenSim/Simulation/Model/AnalysisSet.cpp +++ b/OpenSim/Simulation/Model/AnalysisSet.cpp @@ -254,11 +254,11 @@ void AnalysisSet:: printResults(const string &aBaseName,const string &aDir,double aDT, const string &aExtension) { - int i; - int size = getSize(); - for(i=0;i Date: Wed, 2 Oct 2024 10:27:18 -0700 Subject: [PATCH 16/24] Fix indexing typo and add more debug statements --- OpenSim/Analyses/Test/testOutputReporter.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenSim/Analyses/Test/testOutputReporter.cpp b/OpenSim/Analyses/Test/testOutputReporter.cpp index 47bb36c027..e4118cca3e 100644 --- a/OpenSim/Analyses/Test/testOutputReporter.cpp +++ b/OpenSim/Analyses/Test/testOutputReporter.cpp @@ -211,20 +211,24 @@ void simulateMuscle( //========================================================================== // 5. Verify files were written with correct values //========================================================================== + log_info("Loading the results from file"); TimeSeriesTable tableD("testOutputReporter_Outputs.sto"); TimeSeriesTable_ tableV3("testOutputReporter_OutputsVec3.sto"); TimeSeriesTable_ tableSV("testOutputReporter_OutputsSpatialVec.sto"); + log_info("Indexing initial values"); double val_t0 = tableD.getIndependentColumn()[0]; const SimTK::Real& val_ke0 = tableD.getRowAtIndex(0)[0]; - const Vec3& val_omega0 = tableV3.getRowAtIndex(01)[1]; + const Vec3& val_omega0 = tableV3.getRowAtIndex(0)[1]; const SimTK::SpatialVec& val_jrf0 = tableSV.getRowAtIndex(0)[1]; + log_info("Checking initial values"); ASSERT_EQUAL(t0, val_t0, SimTK::Eps); ASSERT_EQUAL(ke0, val_ke0, SimTK::Eps); ASSERT_EQUAL(ang_acc0, val_omega0, SimTK::Eps); ASSERT_EQUAL(reaction0, val_jrf0, SimTK::Eps); + log_info("Indexing final values"); double val_tf = tableD.getIndependentColumn()[tableD.getNumRows() - 1]; const SimTK::Real& val_ke = tableD.getRowAtIndex(tableD.getNumRows() - 1)[0]; const Vec3& val_omega = tableV3.getRowAtIndex(tableV3.getNumRows() - 1)[1]; @@ -236,6 +240,7 @@ void simulateMuscle( auto ang_acc = ball->getAngularAccelerationInGround(state); auto reaction = slider->calcReactionOnChildExpressedInGround(state); + log_info("Checking final values"); ASSERT_EQUAL(state.getTime(), val_tf, SimTK::Eps); ASSERT_EQUAL(ke, val_ke, SimTK::Eps); ASSERT_EQUAL(ang_acc, val_omega, SimTK::Eps); From 94db2012895d9725baa4eace9be1906542d4f192 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Wed, 2 Oct 2024 11:04:28 -0700 Subject: [PATCH 17/24] Even more debug statements --- OpenSim/Analyses/Test/testOutputReporter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenSim/Analyses/Test/testOutputReporter.cpp b/OpenSim/Analyses/Test/testOutputReporter.cpp index e4118cca3e..d7b77d8e8b 100644 --- a/OpenSim/Analyses/Test/testOutputReporter.cpp +++ b/OpenSim/Analyses/Test/testOutputReporter.cpp @@ -245,6 +245,8 @@ void simulateMuscle( ASSERT_EQUAL(ke, val_ke, SimTK::Eps); ASSERT_EQUAL(ang_acc, val_omega, SimTK::Eps); ASSERT_EQUAL(reaction, val_jrf, SimTK::Eps); + + log_info("Exiting simulateMuscle"); } TEST_CASE("Output Reporter") @@ -261,4 +263,6 @@ TEST_CASE("Output Reporter") simulateMuscle( muscle, IntegrationAccuracy, true); + + log_info("Exiting testOutputReporter"); } From bfc635b62d29cd771aa0fb59de0dca817f702f96 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Wed, 2 Oct 2024 12:07:18 -0700 Subject: [PATCH 18/24] Try using Catch2 comparisons --- OpenSim/Analyses/Test/testOutputReporter.cpp | 40 ++++++++++++++++---- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/OpenSim/Analyses/Test/testOutputReporter.cpp b/OpenSim/Analyses/Test/testOutputReporter.cpp index d7b77d8e8b..eaad9474d9 100644 --- a/OpenSim/Analyses/Test/testOutputReporter.cpp +++ b/OpenSim/Analyses/Test/testOutputReporter.cpp @@ -223,10 +223,21 @@ void simulateMuscle( const SimTK::SpatialVec& val_jrf0 = tableSV.getRowAtIndex(0)[1]; log_info("Checking initial values"); - ASSERT_EQUAL(t0, val_t0, SimTK::Eps); - ASSERT_EQUAL(ke0, val_ke0, SimTK::Eps); - ASSERT_EQUAL(ang_acc0, val_omega0, SimTK::Eps); - ASSERT_EQUAL(reaction0, val_jrf0, SimTK::Eps); + // ASSERT_EQUAL(t0, val_t0, SimTK::Eps); + // ASSERT_EQUAL(ke0, val_ke0, SimTK::Eps); + // ASSERT_EQUAL(ang_acc0, val_omega0, SimTK::Eps); + // ASSERT_EQUAL(reaction0, val_jrf0, SimTK::Eps); + + CHECK_THAT(t0, Catch::Matchers::WithinAbs(val_t0, SimTK::Eps)); + CHECK_THAT(ke0, Catch::Matchers::WithinAbs(val_ke0, SimTK::Eps)); + for (int i = 0; i < 3; ++i) { + CHECK_THAT(ang_acc0[i], + Catch::Matchers::WithinAbs(val_omega0[i], SimTK::Eps)); + for (int j = 0; j < 2; ++j) { + CHECK_THAT(reaction0[j][i], + Catch::Matchers::WithinAbs(val_jrf0[j][i], SimTK::Eps)); + } + } log_info("Indexing final values"); double val_tf = tableD.getIndependentColumn()[tableD.getNumRows() - 1]; @@ -240,11 +251,24 @@ void simulateMuscle( auto ang_acc = ball->getAngularAccelerationInGround(state); auto reaction = slider->calcReactionOnChildExpressedInGround(state); + log_info("Checking final time {}: ", state.getTime()); + log_info("Checking final values"); - ASSERT_EQUAL(state.getTime(), val_tf, SimTK::Eps); - ASSERT_EQUAL(ke, val_ke, SimTK::Eps); - ASSERT_EQUAL(ang_acc, val_omega, SimTK::Eps); - ASSERT_EQUAL(reaction, val_jrf, SimTK::Eps); + // ASSERT_EQUAL(state.getTime(), val_tf, SimTK::Eps); + // ASSERT_EQUAL(ke, val_ke, SimTK::Eps); + // ASSERT_EQUAL(ang_acc, val_omega, SimTK::Eps); + // ASSERT_EQUAL(reaction, val_jrf, SimTK::Eps); + + CHECK_THAT(state.getTime(), Catch::Matchers::WithinAbs(val_tf, SimTK::Eps)); + CHECK_THAT(ke, Catch::Matchers::WithinAbs(val_ke, SimTK::Eps)); + for (int i = 0; i < 3; ++i) { + CHECK_THAT(ang_acc[i], + Catch::Matchers::WithinAbs(val_omega[i], SimTK::Eps)); + for (int j = 0; j < 2; ++j) { + CHECK_THAT(reaction[j][i], + Catch::Matchers::WithinAbs(val_jrf[j][i], SimTK::Eps)); + } + } log_info("Exiting simulateMuscle"); } From 5398b4600c861b09d8e1231dae50b86a8a6cd4c9 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Wed, 2 Oct 2024 12:57:04 -0700 Subject: [PATCH 19/24] Loosen tolerance on kinetic energy check --- OpenSim/Analyses/Test/testOutputReporter.cpp | 23 +------------------- OpenSim/Simulation/Model/AnalysisSet.cpp | 8 +++---- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/OpenSim/Analyses/Test/testOutputReporter.cpp b/OpenSim/Analyses/Test/testOutputReporter.cpp index eaad9474d9..dec5f1eb10 100644 --- a/OpenSim/Analyses/Test/testOutputReporter.cpp +++ b/OpenSim/Analyses/Test/testOutputReporter.cpp @@ -211,23 +211,15 @@ void simulateMuscle( //========================================================================== // 5. Verify files were written with correct values //========================================================================== - log_info("Loading the results from file"); TimeSeriesTable tableD("testOutputReporter_Outputs.sto"); TimeSeriesTable_ tableV3("testOutputReporter_OutputsVec3.sto"); TimeSeriesTable_ tableSV("testOutputReporter_OutputsSpatialVec.sto"); - log_info("Indexing initial values"); double val_t0 = tableD.getIndependentColumn()[0]; const SimTK::Real& val_ke0 = tableD.getRowAtIndex(0)[0]; const Vec3& val_omega0 = tableV3.getRowAtIndex(0)[1]; const SimTK::SpatialVec& val_jrf0 = tableSV.getRowAtIndex(0)[1]; - log_info("Checking initial values"); - // ASSERT_EQUAL(t0, val_t0, SimTK::Eps); - // ASSERT_EQUAL(ke0, val_ke0, SimTK::Eps); - // ASSERT_EQUAL(ang_acc0, val_omega0, SimTK::Eps); - // ASSERT_EQUAL(reaction0, val_jrf0, SimTK::Eps); - CHECK_THAT(t0, Catch::Matchers::WithinAbs(val_t0, SimTK::Eps)); CHECK_THAT(ke0, Catch::Matchers::WithinAbs(val_ke0, SimTK::Eps)); for (int i = 0; i < 3; ++i) { @@ -239,7 +231,6 @@ void simulateMuscle( } } - log_info("Indexing final values"); double val_tf = tableD.getIndependentColumn()[tableD.getNumRows() - 1]; const SimTK::Real& val_ke = tableD.getRowAtIndex(tableD.getNumRows() - 1)[0]; const Vec3& val_omega = tableV3.getRowAtIndex(tableV3.getNumRows() - 1)[1]; @@ -251,16 +242,8 @@ void simulateMuscle( auto ang_acc = ball->getAngularAccelerationInGround(state); auto reaction = slider->calcReactionOnChildExpressedInGround(state); - log_info("Checking final time {}: ", state.getTime()); - - log_info("Checking final values"); - // ASSERT_EQUAL(state.getTime(), val_tf, SimTK::Eps); - // ASSERT_EQUAL(ke, val_ke, SimTK::Eps); - // ASSERT_EQUAL(ang_acc, val_omega, SimTK::Eps); - // ASSERT_EQUAL(reaction, val_jrf, SimTK::Eps); - CHECK_THAT(state.getTime(), Catch::Matchers::WithinAbs(val_tf, SimTK::Eps)); - CHECK_THAT(ke, Catch::Matchers::WithinAbs(val_ke, SimTK::Eps)); + CHECK_THAT(ke, Catch::Matchers::WithinAbs(val_ke, 1e-10)); for (int i = 0; i < 3; ++i) { CHECK_THAT(ang_acc[i], Catch::Matchers::WithinAbs(val_omega[i], SimTK::Eps)); @@ -269,8 +252,6 @@ void simulateMuscle( Catch::Matchers::WithinAbs(val_jrf[j][i], SimTK::Eps)); } } - - log_info("Exiting simulateMuscle"); } TEST_CASE("Output Reporter") @@ -287,6 +268,4 @@ TEST_CASE("Output Reporter") simulateMuscle( muscle, IntegrationAccuracy, true); - - log_info("Exiting testOutputReporter"); } diff --git a/OpenSim/Simulation/Model/AnalysisSet.cpp b/OpenSim/Simulation/Model/AnalysisSet.cpp index 59fb4f6bc9..e8d0f4e54f 100644 --- a/OpenSim/Simulation/Model/AnalysisSet.cpp +++ b/OpenSim/Simulation/Model/AnalysisSet.cpp @@ -254,11 +254,11 @@ void AnalysisSet:: printResults(const string &aBaseName,const string &aDir,double aDT, const string &aExtension) { - for(int i = 0; i < getSize(); i++) { + int i; + int size = getSize(); + for(i=0;i Date: Wed, 2 Oct 2024 12:57:56 -0700 Subject: [PATCH 20/24] Revert AnalysisSet changes --- OpenSim/Simulation/Model/AnalysisSet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Simulation/Model/AnalysisSet.cpp b/OpenSim/Simulation/Model/AnalysisSet.cpp index e8d0f4e54f..094593d232 100644 --- a/OpenSim/Simulation/Model/AnalysisSet.cpp +++ b/OpenSim/Simulation/Model/AnalysisSet.cpp @@ -256,9 +256,9 @@ printResults(const string &aBaseName,const string &aDir,double aDT, { int i; int size = getSize(); - for(i=0;i Date: Wed, 2 Oct 2024 12:58:41 -0700 Subject: [PATCH 21/24] Revert OutputReporter.cpp changes --- OpenSim/Analyses/OutputReporter.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/OpenSim/Analyses/OutputReporter.cpp b/OpenSim/Analyses/OutputReporter.cpp index 585e52507e..772dcfc4dd 100644 --- a/OpenSim/Analyses/OutputReporter.cpp +++ b/OpenSim/Analyses/OutputReporter.cpp @@ -130,27 +130,23 @@ int OutputReporter::printResults(const std::string& baseName, return 0; } - log_info("OutputReporter checking extension is .sto: {}", extension); OPENSIM_THROW_IF_FRMOBJ(IO::Lowercase(extension) != ".sto", Exception, "Only writing results to '.sto' format is supported."); std::string prefix = dir.empty() ? "" : dir + "/"; - log_info("OutputReporter.printResults: Writing double results to {}.", prefix); auto& tableD = _tableReporterDouble->getTable(); if (tableD.getNumColumns()) { STOFileAdapter_::write(tableD, prefix + baseName + "_Outputs" + extension); } - log_info("OutputReporter.printResults: Writing Vec3 results to {}.", prefix); auto& tableV3 = _tableReporterVec3->getTable(); if (tableV3.getNumColumns()) { STOFileAdapter_::write(tableV3, prefix + baseName + "_OutputsVec3" + extension); } - log_info("OutputReporter.printResults: Writing SpatialVec results to {}.", prefix); auto& tableSV = _tableReporterSpatialVec->getTable(); if (tableSV.getNumColumns()) { STOFileAdapter_::write(tableSV, From a08f3bae6677b7b7efa5a400947a46a695bd16f3 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Wed, 2 Oct 2024 17:14:16 -0700 Subject: [PATCH 22/24] Remove unused header includes --- OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp | 1 - OpenSim/Analyses/Test/testOutputReporter.cpp | 3 --- 2 files changed, 4 deletions(-) diff --git a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp index 5e947ccc06..bd0c3533f0 100644 --- a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp +++ b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/OpenSim/Analyses/Test/testOutputReporter.cpp b/OpenSim/Analyses/Test/testOutputReporter.cpp index dec5f1eb10..c1451df6a4 100644 --- a/OpenSim/Analyses/Test/testOutputReporter.cpp +++ b/OpenSim/Analyses/Test/testOutputReporter.cpp @@ -27,7 +27,6 @@ #include #include -#include "OpenSim/Common/Logger.h" #include using namespace OpenSim; @@ -198,8 +197,6 @@ void simulateMuscle( state.setTime(initialTime); manager.initialize(state); - log_info("Integrating from {} to {}", initialTime, finalTime); - // simulate state = manager.integrate(finalTime); From d0852c157eade382cb15dfe5d3bd3b5ec47ec1a0 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Thu, 3 Oct 2024 09:31:16 -0700 Subject: [PATCH 23/24] Use SimTK::Eps over custom tolerances; add TODO about failing testOutputReporter test --- OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp index bd0c3533f0..c266322837 100644 --- a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp +++ b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp @@ -598,15 +598,15 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { CHECK(muscle.getPennationAngularVelocity(state) == 0); CHECK(muscle.getTendonVelocity(state) == 0); CHECK_THAT(muscle.getForceVelocityMultiplier(state), - Catch::Matchers::WithinAbs(0.0, 1e-10)); + Catch::Matchers::WithinAbs(0.0, SimTK::Eps)); model.realizeDynamics(state); const auto Fmax = muscle.getMaxIsometricForce(); const auto fpass = muscle.calcPassiveForceMultiplier(1.0); CHECK_THAT(muscle.getActiveFiberForce(state), - Catch::Matchers::WithinAbs(0.0, 1e-10)); + Catch::Matchers::WithinAbs(0.0, SimTK::Eps)); CHECK_THAT(muscle.getActiveFiberForceAlongTendon(state), - Catch::Matchers::WithinAbs(0.0, 1e-10)); + Catch::Matchers::WithinAbs(0.0, SimTK::Eps)); CHECK(muscle.getPassiveFiberForce(state) == Approx(Fmax * fpass)); CHECK(muscle.getPassiveFiberForceAlongTendon(state) == Approx(Fmax * fpass)); @@ -643,7 +643,7 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { CHECK_THAT(muscle.getMuscleStiffness(state), Catch::Matchers::WithinRel(muscleStiffness, 1e-6)); CHECK_THAT(muscle.getFiberActivePower(state), - Catch::Matchers::WithinAbs(0.0, 1e-10)); + Catch::Matchers::WithinAbs(0.0, SimTK::Eps)); CHECK(muscle.getFiberPassivePower(state) == Approx(Vmax * Fmax * fpass)); CHECK(muscle.getTendonPower(state) == Approx(0.0)); From a05e4dbd660843889dfb293e08e5f3acb0039e1f Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Thu, 3 Oct 2024 16:34:04 -0700 Subject: [PATCH 24/24] Revert usages of SimTK::Eps --- OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp index c266322837..bd0c3533f0 100644 --- a/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp +++ b/OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp @@ -598,15 +598,15 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { CHECK(muscle.getPennationAngularVelocity(state) == 0); CHECK(muscle.getTendonVelocity(state) == 0); CHECK_THAT(muscle.getForceVelocityMultiplier(state), - Catch::Matchers::WithinAbs(0.0, SimTK::Eps)); + Catch::Matchers::WithinAbs(0.0, 1e-10)); model.realizeDynamics(state); const auto Fmax = muscle.getMaxIsometricForce(); const auto fpass = muscle.calcPassiveForceMultiplier(1.0); CHECK_THAT(muscle.getActiveFiberForce(state), - Catch::Matchers::WithinAbs(0.0, SimTK::Eps)); + Catch::Matchers::WithinAbs(0.0, 1e-10)); CHECK_THAT(muscle.getActiveFiberForceAlongTendon(state), - Catch::Matchers::WithinAbs(0.0, SimTK::Eps)); + Catch::Matchers::WithinAbs(0.0, 1e-10)); CHECK(muscle.getPassiveFiberForce(state) == Approx(Fmax * fpass)); CHECK(muscle.getPassiveFiberForceAlongTendon(state) == Approx(Fmax * fpass)); @@ -643,7 +643,7 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") { CHECK_THAT(muscle.getMuscleStiffness(state), Catch::Matchers::WithinRel(muscleStiffness, 1e-6)); CHECK_THAT(muscle.getFiberActivePower(state), - Catch::Matchers::WithinAbs(0.0, SimTK::Eps)); + Catch::Matchers::WithinAbs(0.0, 1e-10)); CHECK(muscle.getFiberPassivePower(state) == Approx(Vmax * Fmax * fpass)); CHECK(muscle.getTendonPower(state) == Approx(0.0));