From b192aea041a372c0f851ec56fa1737987b7d264d Mon Sep 17 00:00:00 2001 From: Pariterre Date: Wed, 12 Sep 2018 17:06:51 -0400 Subject: [PATCH 1/8] Dummy modification --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 49775b7c48..6fe47ea402 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,7 @@ Contents: Thank you for contributing! -Ways to Contribute +Ways to Contribute ------------------ There are lots of ways to contribute to the OpenSim project, and people with widely varying skill sets can make meaningful contributions. Please don't think your contribution has to be momentous to be appreciated. See a typo? Tell us about it or fix it! Here are some contribution ideas: From d67901578b2fa17483b52721f028f9af21c254cd Mon Sep 17 00:00:00 2001 From: Pariterre Date: Fri, 11 Jan 2019 17:16:33 -0500 Subject: [PATCH 2/8] Corrected a bug in SO due to the oversimplification on the muscles --- OpenSim/Analyses/StaticOptimization.cpp | 4 +--- OpenSim/Analyses/StaticOptimizationTarget.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Analyses/StaticOptimization.cpp b/OpenSim/Analyses/StaticOptimization.cpp index 8e16bc3390..e38d7e9602 100644 --- a/OpenSim/Analyses/StaticOptimization.cpp +++ b/OpenSim/Analyses/StaticOptimization.cpp @@ -375,11 +375,9 @@ record(const SimTK::State& s) target.setParameterLimits(lowerBounds, upperBounds); - _parameters = 0; // Set initial guess to zeros - // Static optimization _modelWorkingCopy->getMultibodySystem().realize(sWorkingCopy,SimTK::Stage::Velocity); - target.prepareToOptimize(sWorkingCopy, &_parameters[0]); + target.prepareToOptimize(sWorkingCopy, &_parameters[0]); // Use previous solution as initial guess //LARGE_INTEGER start; //LARGE_INTEGER stop; diff --git a/OpenSim/Analyses/StaticOptimizationTarget.cpp b/OpenSim/Analyses/StaticOptimizationTarget.cpp index 09b59a7b44..eb8d3bb81a 100644 --- a/OpenSim/Analyses/StaticOptimizationTarget.cpp +++ b/OpenSim/Analyses/StaticOptimizationTarget.cpp @@ -92,6 +92,7 @@ prepareToOptimize(SimTK::State& s, double *x) // COMPUTE MAX ISOMETRIC FORCE const ForceSet& fSet = _model->getForceSet(); + int imus(0); for(int i=0, j=0;i(&fSet.get(i)); if( act ) { @@ -101,11 +102,12 @@ prepareToOptimize(SimTK::State& s, double *x) //ActivationFiberLengthMuscle *aflmus = dynamic_cast(mus); if(mus && _useMusclePhysiology) { _model->setAllControllersEnabled(true); - fOpt = mus->calcInextensibleTendonActiveFiberForce(s, 1.0); + fOpt = mus->calcInextensibleTendonActiveFiberForce(s, x[imus]) / x[imus]; _model->setAllControllersEnabled(false); } else { fOpt = mus->getMaxIsometricForce(); } + imus++; } else { fOpt = act->getOptimalForce(); } @@ -130,7 +132,7 @@ prepareToOptimize(SimTK::State& s, double *x) for(int p=0; p Date: Fri, 18 Jan 2019 17:22:54 -0500 Subject: [PATCH 3/8] Example of static optimization using old linearisation --- CMakeLists.txt.user | 6166 +++++++++++++++++ OpenSim/Examples/CMakeLists.txt | 2 + .../StaticOptimizationExample/CMakeLists.txt | 32 + .../StaticOptimizationExample.cpp | 17 + .../StaticOptimizationExample/arm26.osim | 1617 +++++ .../arm26_InverseKinematics.mot | 133 + .../arm26_Setup_StaticOptimization.xml | 100 + 7 files changed, 8067 insertions(+) create mode 100644 CMakeLists.txt.user create mode 100644 OpenSim/Examples/StaticOptimizationExample/CMakeLists.txt create mode 100644 OpenSim/Examples/StaticOptimizationExample/StaticOptimizationExample.cpp create mode 100644 OpenSim/Examples/StaticOptimizationExample/arm26.osim create mode 100644 OpenSim/Examples/StaticOptimizationExample/arm26_InverseKinematics.mot create mode 100644 OpenSim/Examples/StaticOptimizationExample/arm26_Setup_StaticOptimization.xml diff --git a/CMakeLists.txt.user b/CMakeLists.txt.user new file mode 100644 index 0000000000..31e178b1d6 --- /dev/null +++ b/CMakeLists.txt.user @@ -0,0 +1,6166 @@ + + + + + + EnvironmentId + {26864590-175a-4720-9ce0-4db157a6a2bd} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.12.0 GCC 64bit + Desktop Qt 5.12.0 GCC 64bit + qt.qt5.5120.gcc_64_kit + 1 + 0 + 101 + + + CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx} + CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} + CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} + OPENSIM_DEPENDENCIES_DIR:PATH=/home/pariterre/Programmation/opensim-core/opensim_dependencies_install + QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + + + all + + true + CMake Build + + CMakeProjectManager.MakeStep + + 1 + Build + + ProjectExplorer.BuildSteps.Build + + + + + + all + + true + CMake Build + + CMakeProjectManager.MakeStep + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Défaut + Défaut + CMakeProjectManager.CMakeBuildConfiguration + + + + CMAKE_BUILD_TYPE:STRING=Debug + CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ + CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + + + all + + true + CMake Build + + CMakeProjectManager.MakeStep + + 1 + Build + + ProjectExplorer.BuildSteps.Build + + + + + + all + + true + CMake Build + + CMakeProjectManager.MakeStep + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + CMakeProjectManager.CMakeBuildConfiguration + + + + CMAKE_BUILD_TYPE:STRING=Release + + /home/pariterre/Programmation/build-opensim-core-Desktop_Qt_5_12_0_GCC_64bit-Release + + + + + all + + true + CMake Build + + CMakeProjectManager.MakeStep + + 1 + Build + + ProjectExplorer.BuildSteps.Build + + + + + + all + + true + CMake Build + + CMakeProjectManager.MakeStep + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + CMakeProjectManager.CMakeBuildConfiguration + + + + CMAKE_BUILD_TYPE:STRING=RelWithDebInfo + + /home/pariterre/Programmation/build-opensim-core-Desktop_Qt_5_12_0_GCC_64bit-Release with Debug Information + + + + + all + + true + CMake Build + + CMakeProjectManager.MakeStep + + 1 + Build + + ProjectExplorer.BuildSteps.Build + + + + + + all + + true + CMake Build + + CMakeProjectManager.MakeStep + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release with Debug Information + Release with Debug Information + CMakeProjectManager.CMakeBuildConfiguration + + + + CMAKE_BUILD_TYPE:STRING=MinSizeRel + + /home/pariterre/Programmation/build-opensim-core-Desktop_Qt_5_12_0_GCC_64bit-Minimum Size Release + + + + + all + + true + CMake Build + + CMakeProjectManager.MakeStep + + 1 + Build + + ProjectExplorer.BuildSteps.Build + + + + + + all + + true + CMake Build + + CMakeProjectManager.MakeStep + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Minimum Size Release + Minimum Size Release + CMakeProjectManager.CMakeBuildConfiguration + + 5 + + + 0 + Déploiement + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy Configuration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testLepton + + CMakeProjectManager.CMakeRunConfiguration.testLepton +/home/pariterre/Programmation/opensim-core/Vendors/lepton/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + ImuStreaming + + CMakeProjectManager.CMakeRunConfiguration.ImuStreaming +/home/pariterre/Programmation/opensim-core/OpenSim/Sandbox/ + + 3768 + false + true + false + false + true + + + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + futureComponents + + CMakeProjectManager.CMakeRunConfiguration.futureComponents +/home/pariterre/Programmation/opensim-core/OpenSim/Sandbox/UsefulComponents/ + + 3768 + false + true + false + false + true + + + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testCommandLineInterface + + CMakeProjectManager.CMakeRunConfiguration.testCommandLineInterface +/home/pariterre/Programmation/opensim-core/Applications/opensim-cmd/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + StaticOptimizationExample + + CMakeProjectManager.CMakeRunConfiguration.StaticOptimizationExample +/home/pariterre/Programmation/opensim-core/OpenSim/Examples/StaticOptimizationExample_Arm26/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testMarkerData + + CMakeProjectManager.CMakeRunConfiguration.testMarkerData +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testTRCFileAdapter + + CMakeProjectManager.CMakeRunConfiguration.testTRCFileAdapter +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testFunctionAdapter + + CMakeProjectManager.CMakeRunConfiguration.testFunctionAdapter +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testComponentInterface + + CMakeProjectManager.CMakeRunConfiguration.testComponentInterface +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testNCSpline + + CMakeProjectManager.CMakeRunConfiguration.testNCSpline +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testSmoothSegmentedFunctionFactory + + CMakeProjectManager.CMakeRunConfiguration.testSmoothSegmentedFunctionFactory +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testSTOFileAdapter + + CMakeProjectManager.CMakeRunConfiguration.testSTOFileAdapter +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testPath + + CMakeProjectManager.CMakeRunConfiguration.testPath +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testRootSolver + + CMakeProjectManager.CMakeRunConfiguration.testRootSolver +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + futureIKListOutputs + + CMakeProjectManager.CMakeRunConfiguration.futureIKListOutputs +/home/pariterre/Programmation/opensim-core/OpenSim/Sandbox/ + + 3768 + false + true + false + false + true + + + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testFunctions + + CMakeProjectManager.CMakeRunConfiguration.testFunctions +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testGCVSpline + + CMakeProjectManager.CMakeRunConfiguration.testGCVSpline +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testSerialization + + CMakeProjectManager.CMakeRunConfiguration.testSerialization +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testStorage + + CMakeProjectManager.CMakeRunConfiguration.testStorage +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testDataTable + + CMakeProjectManager.CMakeRunConfiguration.testDataTable +/home/pariterre/Programmation/opensim-core/OpenSim/Common/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testStatesTrajectory + + CMakeProjectManager.CMakeRunConfiguration.testStatesTrajectory +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testInverseKinematicsSolver + + CMakeProjectManager.CMakeRunConfiguration.testInverseKinematicsSolver +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testInitState + + CMakeProjectManager.CMakeRunConfiguration.testInitState +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testFrames + + CMakeProjectManager.CMakeRunConfiguration.testFrames +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testModelInterface + + CMakeProjectManager.CMakeRunConfiguration.testModelInterface +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + futureRigidContact + + CMakeProjectManager.CMakeRunConfiguration.futureRigidContact +/home/pariterre/Programmation/opensim-core/OpenSim/Sandbox/ + + 3768 + false + true + false + false + true + + + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testForces + + CMakeProjectManager.CMakeRunConfiguration.testForces +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testAssemblySolver + + CMakeProjectManager.CMakeRunConfiguration.testAssemblySolver +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testManager + + CMakeProjectManager.CMakeRunConfiguration.testManager +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testMomentArms + + CMakeProjectManager.CMakeRunConfiguration.testMomentArms +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testReportersWithModel + + CMakeProjectManager.CMakeRunConfiguration.testReportersWithModel +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testPoints + + CMakeProjectManager.CMakeRunConfiguration.testPoints +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testContactGeometry + + CMakeProjectManager.CMakeRunConfiguration.testContactGeometry +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testNestedModelComponents + + CMakeProjectManager.CMakeRunConfiguration.testNestedModelComponents +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testPrescribedForce + + CMakeProjectManager.CMakeRunConfiguration.testPrescribedForce +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testMuscleMetabolicsProbes + + CMakeProjectManager.CMakeRunConfiguration.testMuscleMetabolicsProbes +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + futureMuscleMetabolicsResponse + + CMakeProjectManager.CMakeRunConfiguration.futureMuscleMetabolicsResponse +/home/pariterre/Programmation/opensim-core/OpenSim/Sandbox/ + + 3768 + false + true + false + false + true + + + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testProbes + + CMakeProjectManager.CMakeRunConfiguration.testProbes +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testSimulationUtilities + + CMakeProjectManager.CMakeRunConfiguration.testSimulationUtilities +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testJoints + + CMakeProjectManager.CMakeRunConfiguration.testJoints +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/SimbodyEngine/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testConstraints + + CMakeProjectManager.CMakeRunConfiguration.testConstraints +/home/pariterre/Programmation/opensim-core/OpenSim/Simulation/SimbodyEngine/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testMuscleFirstOrderActivationDynamicModel + + CMakeProjectManager.CMakeRunConfiguration.testMuscleFirstOrderActivationDynamicModel +/home/pariterre/Programmation/opensim-core/OpenSim/Actuators/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testActuators + + CMakeProjectManager.CMakeRunConfiguration.testActuators +/home/pariterre/Programmation/opensim-core/OpenSim/Actuators/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testMuscleFixedWidthPennationModel + + CMakeProjectManager.CMakeRunConfiguration.testMuscleFixedWidthPennationModel +/home/pariterre/Programmation/opensim-core/OpenSim/Actuators/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testMuscles + + CMakeProjectManager.CMakeRunConfiguration.testMuscles +/home/pariterre/Programmation/opensim-core/OpenSim/Actuators/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testSerializableMuscleCurves + + CMakeProjectManager.CMakeRunConfiguration.testSerializableMuscleCurves +/home/pariterre/Programmation/opensim-core/OpenSim/Actuators/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testOutputReporter + + CMakeProjectManager.CMakeRunConfiguration.testOutputReporter +/home/pariterre/Programmation/opensim-core/OpenSim/Analyses/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + futureOrientationInverseKinematics + + CMakeProjectManager.CMakeRunConfiguration.futureOrientationInverseKinematics +/home/pariterre/Programmation/opensim-core/OpenSim/Sandbox/ + + 3768 + false + true + false + false + true + + + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testExternalLoads + + CMakeProjectManager.CMakeRunConfiguration.testExternalLoads +/home/pariterre/Programmation/opensim-core/OpenSim/Tools/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testControllers + + CMakeProjectManager.CMakeRunConfiguration.testControllers +/home/pariterre/Programmation/opensim-core/OpenSim/Tools/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testModelCopy + + CMakeProjectManager.CMakeRunConfiguration.testModelCopy +/home/pariterre/Programmation/opensim-core/OpenSim/Tools/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testSerializeOpenSimObjects + + CMakeProjectManager.CMakeRunConfiguration.testSerializeOpenSimObjects +/home/pariterre/Programmation/opensim-core/OpenSim/Tools/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testVisualization + + CMakeProjectManager.CMakeRunConfiguration.testVisualization +/home/pariterre/Programmation/opensim-core/OpenSim/Tools/Test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + exampleHopperDeviceAnswers + + CMakeProjectManager.CMakeRunConfiguration.exampleHopperDeviceAnswers +/home/pariterre/Programmation/opensim-core/OpenSim/Examples/ExampleHopperDevice/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + exampleHopperDevice + + CMakeProjectManager.CMakeRunConfiguration.exampleHopperDevice +/home/pariterre/Programmation/opensim-core/OpenSim/Examples/ExampleHopperDevice/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + example2DataTable + + CMakeProjectManager.CMakeRunConfiguration.example2DataTable +/home/pariterre/Programmation/opensim-core/OpenSim/Examples/DataTable/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + example1DataTable + + CMakeProjectManager.CMakeRunConfiguration.example1DataTable +/home/pariterre/Programmation/opensim-core/OpenSim/Examples/DataTable/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testComponents + + CMakeProjectManager.CMakeRunConfiguration.testComponents +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/Components/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + futureStatesTrajectoryUsage + + CMakeProjectManager.CMakeRunConfiguration.futureStatesTrajectoryUsage +/home/pariterre/Programmation/opensim-core/OpenSim/Sandbox/ + + 3768 + false + true + false + false + true + + + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testAddComponents + + CMakeProjectManager.CMakeRunConfiguration.testAddComponents +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/AddComponents/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testControllerExample + + CMakeProjectManager.CMakeRunConfiguration.testControllerExample +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/ControllerExample/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + exampleController + + CMakeProjectManager.CMakeRunConfiguration.exampleController +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/ControllerExample/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testExampleMain + + CMakeProjectManager.CMakeRunConfiguration.testExampleMain +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/ExampleMain/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + exampleMain + + CMakeProjectManager.CMakeRunConfiguration.exampleMain +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/ExampleMain/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testOptimizationExample + + CMakeProjectManager.CMakeRunConfiguration.testOptimizationExample +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/OptimizationExample_Arm26/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + exampleOptimization + + CMakeProjectManager.CMakeRunConfiguration.exampleOptimization +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/OptimizationExample_Arm26/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testCustomActuatorExample + + CMakeProjectManager.CMakeRunConfiguration.testCustomActuatorExample +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/CustomActuatorExample/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + exampleCustomActuator + + CMakeProjectManager.CMakeRunConfiguration.exampleCustomActuator +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/CustomActuatorExample/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testMuscleExample + + CMakeProjectManager.CMakeRunConfiguration.testMuscleExample +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/MuscleExample/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + futureMarkerPreview + + CMakeProjectManager.CMakeRunConfiguration.futureMarkerPreview +/home/pariterre/Programmation/opensim-core/OpenSim/Sandbox/ + + 3768 + false + true + false + false + true + + + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + exampleMuscle + + CMakeProjectManager.CMakeRunConfiguration.exampleMuscle +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/MuscleExample/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testSimpleOptimizationExample + + CMakeProjectManager.CMakeRunConfiguration.testSimpleOptimizationExample +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/SimpleOptimizationExample/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + exampleOptimizationSimple + + CMakeProjectManager.CMakeRunConfiguration.exampleOptimizationSimple +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/SimpleOptimizationExample/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + checkEnvironment + + CMakeProjectManager.CMakeRunConfiguration.checkEnvironment +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/Environment/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testIterators + + CMakeProjectManager.CMakeRunConfiguration.testIterators +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/testIterators/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + visualizeModel + + CMakeProjectManager.CMakeRunConfiguration.visualizeModel +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/VisualizeModel/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testREADME + + CMakeProjectManager.CMakeRunConfiguration.testREADME +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/README/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testWrapping + + CMakeProjectManager.CMakeRunConfiguration.testWrapping +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/Wrapping/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testExampleLuxoMuscle + + CMakeProjectManager.CMakeRunConfiguration.testExampleLuxoMuscle +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/ExampleLuxoMuscle/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testBuildDynamicWalker + + CMakeProjectManager.CMakeRunConfiguration.testBuildDynamicWalker +/home/pariterre/Programmation/opensim-core/OpenSim/Tests/BuildDynamicWalker/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + futureOutputVectorsAndChannels + + CMakeProjectManager.CMakeRunConfiguration.futureOutputVectorsAndChannels +/home/pariterre/Programmation/opensim-core/OpenSim/Sandbox/ + + 3768 + false + true + false + false + true + + + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testJointReactions + + CMakeProjectManager.CMakeRunConfiguration.testJointReactions +/home/pariterre/Programmation/opensim-core/Applications/Analyze/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testStaticOptimization + + CMakeProjectManager.CMakeRunConfiguration.testStaticOptimization +/home/pariterre/Programmation/opensim-core/Applications/Analyze/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testInducedAccelerations + + CMakeProjectManager.CMakeRunConfiguration.testInducedAccelerations +/home/pariterre/Programmation/opensim-core/Applications/Analyze/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testAnalyzeTool + + CMakeProjectManager.CMakeRunConfiguration.testAnalyzeTool +/home/pariterre/Programmation/opensim-core/Applications/Analyze/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testForward + + CMakeProjectManager.CMakeRunConfiguration.testForward +/home/pariterre/Programmation/opensim-core/Applications/Forward/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testScale + + CMakeProjectManager.CMakeRunConfiguration.testScale +/home/pariterre/Programmation/opensim-core/Applications/Scale/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testIK + + CMakeProjectManager.CMakeRunConfiguration.testIK +/home/pariterre/Programmation/opensim-core/Applications/IK/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testID + + CMakeProjectManager.CMakeRunConfiguration.testID +/home/pariterre/Programmation/opensim-core/Applications/ID/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testCMCSingleMuscle + + CMakeProjectManager.CMakeRunConfiguration.testCMCSingleMuscle +/home/pariterre/Programmation/opensim-core/Applications/CMC/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testCMCEMGDrivenArm_Thelen + + CMakeProjectManager.CMakeRunConfiguration.testCMCEMGDrivenArm_Thelen +/home/pariterre/Programmation/opensim-core/Applications/CMC/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + futureTaskSpace + + CMakeProjectManager.CMakeRunConfiguration.futureTaskSpace +/home/pariterre/Programmation/opensim-core/OpenSim/Sandbox/TaskSpace/ + + 3768 + false + true + false + false + true + + + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testCMCTwoMusclesOnBlock + + CMakeProjectManager.CMakeRunConfiguration.testCMCTwoMusclesOnBlock +/home/pariterre/Programmation/opensim-core/Applications/CMC/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testCMCEMGDrivenArm_Millard + + CMakeProjectManager.CMakeRunConfiguration.testCMCEMGDrivenArm_Millard +/home/pariterre/Programmation/opensim-core/Applications/CMC/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testCMCArm26_Millard + + CMakeProjectManager.CMakeRunConfiguration.testCMCArm26_Millard +/home/pariterre/Programmation/opensim-core/Applications/CMC/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testCMCGait10dof18musc + + CMakeProjectManager.CMakeRunConfiguration.testCMCGait10dof18musc +/home/pariterre/Programmation/opensim-core/Applications/CMC/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testCMCSingleRigidTendonMuscle + + CMakeProjectManager.CMakeRunConfiguration.testCMCSingleRigidTendonMuscle +/home/pariterre/Programmation/opensim-core/Applications/CMC/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testCMCWithControlConstraintsGait2354 + + CMakeProjectManager.CMakeRunConfiguration.testCMCWithControlConstraintsGait2354 +/home/pariterre/Programmation/opensim-core/Applications/CMC/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testCMCWithControlConstraintsRunningModel + + CMakeProjectManager.CMakeRunConfiguration.testCMCWithControlConstraintsRunningModel +/home/pariterre/Programmation/opensim-core/Applications/CMC/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testCMCArm26_Thelen + + CMakeProjectManager.CMakeRunConfiguration.testCMCArm26_Thelen +/home/pariterre/Programmation/opensim-core/Applications/CMC/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + testRRA + + CMakeProjectManager.CMakeRunConfiguration.testRRA +/home/pariterre/Programmation/opensim-core/Applications/RRA/test/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + opensim-cmd + + CMakeProjectManager.CMakeRunConfiguration.opensim-cmd +/home/pariterre/Programmation/opensim-core/Applications/opensim-cmd/ + + 3768 + false + true + false + false + true + + /home/pariterre/Programmation/BUILDS/opensim/opensim-core-build + + 102 + + + + ProjectExplorer.Project.Target.1 + + Imported Kit + Imported Kit + {8890ef2f-f74e-4f77-b78b-358d73b9a5e7} + 0 + 0 + 0 + + + CMAKE_BUILD_TYPE:STRING=Debug + + /home/pariterre/Programmation/opensim-core/build + + + + + all + + true + CMake Build + + CMakeProjectManager.MakeStep + + 1 + Build + + ProjectExplorer.BuildSteps.Build + + + + + + all + + true + CMake Build + + CMakeProjectManager.MakeStep + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + CMakeProjectManager.CMakeBuildConfiguration + + 1 + + + 0 + Déploiement + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy Configuration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + + Custom Executable + + ProjectExplorer.CustomExecutableRunConfiguration + + 3768 + false + true + false + false + true + + + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 20 + + + Version + 20 + + diff --git a/OpenSim/Examples/CMakeLists.txt b/OpenSim/Examples/CMakeLists.txt index 60c42c24f3..7244c77b5e 100644 --- a/OpenSim/Examples/CMakeLists.txt +++ b/OpenSim/Examples/CMakeLists.txt @@ -11,6 +11,7 @@ if(BUILD_API_EXAMPLES) MuscleExample CustomActuatorExample OptimizationExample_Arm26 + StaticOptimizationExample checkEnvironment SimpleOptimizationExample SymbolicExpressionReporter @@ -21,6 +22,7 @@ if(BUILD_API_EXAMPLES) add_subdirectory(ExampleHopperDevice) add_subdirectory(SymbolicExpressionReporter) add_subdirectory(DataTable) + add_subdirectory(StaticOptimizationExample) elseif() diff --git a/OpenSim/Examples/StaticOptimizationExample/CMakeLists.txt b/OpenSim/Examples/StaticOptimizationExample/CMakeLists.txt new file mode 100644 index 0000000000..c9c2655fee --- /dev/null +++ b/OpenSim/Examples/StaticOptimizationExample/CMakeLists.txt @@ -0,0 +1,32 @@ +set(EXAMPLES_TO_COMPILE StaticOptimizationExample.cpp +) + +foreach(EXAMPLE_PROG ${EXAMPLES_TO_COMPILE}) + get_filename_component(EXAMPLE_ROOT ${EXAMPLE_PROG} NAME_WE) + add_executable(${EXAMPLE_ROOT} ${EXAMPLE_PROG}) + target_link_libraries(${EXAMPLE_ROOT} ${Simbody_LIBRARIES} osimCommon osimTools) + set_target_properties(${EXAMPLE_ROOT} PROPERTIES FOLDER "Examples") + + file(GLOB ADDITIONAL_FILES *.osim *.xml *.mot) + + foreach(ADDITIONAL_FILE ${ADDITIONAL_FILES}) + get_filename_component(ADDITIONAL_FILE_NAME ${ADDITIONAL_FILE} NAME) + add_custom_command( + TARGET ${EXAMPLE_ROOT} + COMMAND ${CMAKE_COMMAND} + ARGS -E copy + ${ADDITIONAL_FILE} + ${CMAKE_BINARY_DIR}/OpenSim/Examples/${EXAMPLE_ROOT}/${ADDITIONAL_FILE_NAME}) + endforeach(ADDITIONAL_FILE) + + # Doesn't work... + add_custom_target( + TARGET ${EXAMPLE_ROOT} + COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_BINARY_DIR}/OpenSim/Examples/${EXAMPLE_ROOT}/Results) +endforeach(EXAMPLE_PROG ${EXAMPLES_TO_COMPILE}) + + + + + diff --git a/OpenSim/Examples/StaticOptimizationExample/StaticOptimizationExample.cpp b/OpenSim/Examples/StaticOptimizationExample/StaticOptimizationExample.cpp new file mode 100644 index 0000000000..8994ce1b49 --- /dev/null +++ b/OpenSim/Examples/StaticOptimizationExample/StaticOptimizationExample.cpp @@ -0,0 +1,17 @@ + +// INCLUDE +#include +#include +#include +#include + +using namespace OpenSim; +using namespace std; + +int main() +{ + AnalyzeTool analyze("OpenSim/Examples/StaticOptimizationExample/arm26_Setup_StaticOptimization.xml"); + analyze.run(); + + return 0; +} diff --git a/OpenSim/Examples/StaticOptimizationExample/arm26.osim b/OpenSim/Examples/StaticOptimizationExample/arm26.osim new file mode 100644 index 0000000000..4cd2f1cc66 --- /dev/null +++ b/OpenSim/Examples/StaticOptimizationExample/arm26.osim @@ -0,0 +1,1617 @@ + + + + + + The OpenSim Development Team (Reinbolt, J; Seth, A; Habib, A; Hamner, S) adapted from a model originally created by Kate Holzbaur (11/22/04) + + License: + Creative Commons (CCBY 3.0). You are free to distribute, remix, tweak, and build upon this work, even commercially, + as long as you credit us for the original creation. + http://creativecommons.org/licenses/by/3.0/ + + + Holzbaur, K.R.S., Murray, W.M., Delp, S.L. A Model of the Upper Extremity for Simulating Musculoskeletal Surgery and Analyzing Neuromuscular Control. + Annals of Biomedical Engineering, vol 33, pp 829–840, 2005 + + meters + N + + 0 -9.8066 0 + + + + + 0 + 0 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + ground_ribs.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + ground_spine.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + ground_skull.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + ground_jaw.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + ground_r_clavicle.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + ground_r_scapula.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + 1.37532 -0.294612 2.43596 + -0.043905 -0.0039 0.1478 + true + x + + + + + + + + 1 1 1 + + 1.37532 -0.294612 2.43596 -0.043905 -0.0039 0.1478 + + false + + 4 + + 0.003 + 0.03 + + + + + + + 1.864572 + 0 -0.180496 0 + 0.01481 + 0.004551 + 0.013193 + 0 + 0 + 0 + + + + + + + + + r_shoulder_elev + + -0.05889802 0.0023 0.99826136 + + + + 1 0 + + + + + + + + 0 1 0 + + + + 0 + + + + + + + + 0.99826136 -0 0.05889802 + + + + 0 + + + + + + + + + 1 0 0 + + + + 0 + + + + + + + + 0 1 0 + + + + 0 + + + + + + + + 0 0 1 + + + + 0 + + + + + ground + -0.017545 -0.007 0.17 + 0 0 0 + 0 0 0 + 0 0 0 + + + + + + rotational + + 0 + + 0 + + -1.57079633 3.14159265 + + false + + false + + + + + + + false + + + + + + + + + arm_r_humerus.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + 3.00162 -0.853466 2.57419 + -0.0078 -0.0041 -0.0014 + true + z + + + + + + + + 1 1 1 + + 3.00162 -0.853466 2.57419 -0.0078 -0.0041 -0.0014 + + false + + 4 + + 0.035 0.02 0.02 + + + -2.00434 -1.00164 0.975465 + 0.0033 0.0073 0.0003 + true + -y + + + + + + + + 1 1 1 + + -2.00434 -1.00164 0.975465 0.0033 0.0073 0.0003 + + false + + 4 + + 0.025 0.02 0.02 + + + -0.14015 -0.00628319 0.154985 + 0.0028 -0.2919 -0.0069 + true + all + + + + + + + + 1 1 1 + + -0.14015 -0.00628319 0.154985 0.0028 -0.2919 -0.0069 + + false + + 4 + + 0.016 + 0.05 + + + + + + + 1.534315 + 0 -0.181479 0 + 0.019281 + 0.001571 + 0.020062 + 0 + 0 + 0 + + + + + + + + + r_elbow_flex + + 0.04940001 0.03660001 0.99810825 + + + + 1 0 + + + + + + + + 0 1 0 + + + + 0 + + + + + + + + 0.99810825 0 -0.04940001 + + + + 0 + + + + + + + + + 1 0 0 + + + + 0 + + + + + + + + 0 1 0 + + + + 0 + + + + + + + + 0 0 1 + + + + 0 + + + + + r_humerus + 0.0061 -0.2904 -0.0123 + 0 0 0 + 0 0 0 + 0 0 0 + + + + + + rotational + + 0 + + 0 + + 0 2.26892803 + + false + + false + + + + + + + false + + + + + + + + + arm_r_ulna.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_radius.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_lunate.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_scaphoid.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_pisiform.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_triquetrum.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_capitate.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_trapezium.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_trapezoid.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_hamate.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_1mc.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_2mc.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_3mc.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_4mc.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_5mc.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_thumbprox.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_thumbdist.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_2proxph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_2midph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_2distph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_3proxph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_3midph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_3distph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_4proxph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_4midph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_4distph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_5proxph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_5midph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_5distph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + + + + + + + + + + + + + + + + false + + 0 + + 1 + + + + + + -0.05365 -0.01373 0.14723 + ground + + + -0.02714 -0.11441 -0.00664 + r_humerus + + + -0.03184 -0.22637 -0.01217 + r_humerus + + + -0.01743 -0.26757 -0.01208 + r_humerus + + + -0.0219 0.01046 -0.00078 + r_ulna_radius_hand + + + + + + + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + TRI + hybrid + -1 -1 + + + TRIlonghh + hybrid + -1 -1 + + + TRIlongglen + hybrid + -1 -1 + + + + + + + 1 + + 798.52 + + 0.134 + + 0.143 + + 0.20943951 + + 10 + + 0.01 + + 0.04 + + 0.033 + + 0.6 + + 0.5 + + 4 + + 0.3 + + 1.8 + + + + false + + 0 + + 1 + + + + + + -0.00599 -0.12646 0.00428 + r_humerus + + + -0.02344 -0.14528 0.00928 + r_humerus + + + -0.03184 -0.22637 -0.01217 + r_humerus + + + -0.01743 -0.26757 -0.01208 + r_humerus + + + -0.0219 0.01046 -0.00078 + r_ulna_radius_hand + + + + + + + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + TRI + hybrid + -1 -1 + + + + + + + 1 + + 624.3 + + 0.1138 + + 0.098 + + 0.15707963 + + 10 + + 0.01 + + 0.04 + + 0.033 + + 0.6 + + 0.5 + + 4 + + 0.3 + + 1.8 + + + + false + + 0 + + 1 + + + + + + -0.00838 -0.13695 -0.00906 + r_humerus + + + -0.02601 -0.15139 -0.0108 + r_humerus + + + -0.03184 -0.22637 -0.01217 + r_humerus + + + -0.01743 -0.26757 -0.01208 + r_humerus + + + -0.0219 0.01046 -0.00078 + r_ulna_radius_hand + + + + + + + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + TRI + hybrid + -1 -1 + + + + + + + 1 + + 624.3 + + 0.1138 + + 0.0908 + + 0.15707963 + + 10 + + 0.01 + + 0.04 + + 0.033 + + 0.6 + + 0.5 + + 4 + + 0.3 + + 1.8 + + + + false + + 0 + + 1 + + + + + + -0.039235 0.00347 0.14795 + ground + + + -0.028945 0.01391 0.15639 + ground + + + 0.02131 0.01793 0.01028 + r_humerus + + + 0.02378 -0.00511 0.01201 + r_humerus + + + 0.01345 -0.02827 0.00136 + r_humerus + + + 0.01068 -0.07736 -0.00165 + r_humerus + + + 0.01703 -0.12125 0.00024 + r_humerus + + + 0.0228 -0.1754 -0.0063 + r_humerus + + + 0.00751 -0.04839 0.02179 + r_ulna_radius_hand + + + + + + + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + BIClonghh + hybrid + 2 3 + + + + + + + 1 + + 624.3 + + 0.1157 + + 0.2723 + + 0 + + 10 + + 0.01 + + 0.04 + + 0.033 + + 0.6 + + 0.5 + + 4 + + 0.3 + + 1.8 + + + + false + + 0 + + 1 + + + + + + 0.004675 -0.01231 0.13475 + ground + + + -0.007075 -0.04004 0.14507 + ground + + + 0.01117 -0.07576 -0.01101 + r_humerus + + + 0.01703 -0.12125 -0.01079 + r_humerus + + + 0.0228 -0.1754 -0.0063 + r_humerus + + + 0.00751 -0.04839 0.02179 + r_ulna_radius_hand + + + + + + + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + + + + 1 + + 435.56 + + 0.1321 + + 0.1923 + + 0 + + 10 + + 0.01 + + 0.04 + + 0.033 + + 0.6 + + 0.5 + + 4 + + 0.3 + + 1.8 + + + + false + + 0 + + 1 + + + + + + 0.0068 -0.1739 -0.0036 + r_humerus + + + -0.0032 -0.0239 0.0009 + r_ulna_radius_hand + + + + + + + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + TRI + hybrid + -1 -1 + + + + + + + 1 + + 987.26 + + 0.0858 + + 0.0535 + + 0 + + 10 + + 0.01 + + 0.04 + + 0.033 + + 0.6 + + 0.5 + + 4 + + 0.3 + + 1.8 + + + + + + + + + + ground + + -0.01256 0.04 0.17 + + false + + + + r_humerus + + 0.005 -0.2904 0.03 + + false + + + + r_ulna_radius_hand + + -0.0011 -0.23559 0.0943 + + false + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Examples/StaticOptimizationExample/arm26_InverseKinematics.mot b/OpenSim/Examples/StaticOptimizationExample/arm26_InverseKinematics.mot new file mode 100644 index 0000000000..4482dc0d80 --- /dev/null +++ b/OpenSim/Examples/StaticOptimizationExample/arm26_InverseKinematics.mot @@ -0,0 +1,133 @@ +inverse kinematics +nRows=121 +nColumns=12 + +# SIMM Motion File Header: +name inverse kinematics +datacolumns 12 +datarows 121 +otherdata 1 +range 0.000000 1.000000 +endheader +time r_shoulder_elev r_elbow_flex r_acromion_tx r_acromion_ty r_acromion_tz r_humerus_epicondyle_tx r_humerus_epicondyle_ty r_humerus_epicondyle_tz r_radius_styloid_tx r_radius_styloid_ty r_radius_styloid_tz + 0.00000000 -0.36571172 0.89932091 -0.01305452 0.03950548 0.16950548 -0.01255938 -0.29741438 0.19998562 -0.01312468 -0.53356968 0.25142032 + 0.00833333 -0.34635835 0.92606446 -0.01296065 0.03959935 0.16959935 -0.01256732 -0.29742232 0.19997768 -0.01286702 -0.53360038 0.25138255 + 0.01666667 -0.33196550 0.95466896 -0.01285343 0.03970657 0.16970657 -0.01257439 -0.29742939 0.19997061 -0.01258261 -0.53362982 0.25134502 + 0.02500000 -0.31486548 0.98516023 -0.01273643 0.03982357 0.16982357 -0.01258031 -0.29743531 0.19996469 -0.01224700 -0.53365833 0.25130658 + 0.03333333 -0.34958635 1.16797448 -0.01261356 0.03994644 0.16994644 -0.01258485 -0.29743985 0.19996015 -0.01183747 -0.53368607 0.25126617 + 0.04166667 -0.32091242 1.18102966 -0.01248890 0.04007110 0.17007110 -0.01258782 -0.29744282 0.19995718 -0.01133375 -0.53371292 0.25122284 + 0.05000000 -0.27147880 1.21348294 -0.01236661 0.04019339 0.17019339 -0.01258911 -0.29744411 0.19995589 -0.01071857 -0.53373847 0.25117577 + 0.05833333 -0.29593672 1.45165354 -0.01225076 0.04030924 0.17030924 -0.01258868 -0.29744368 0.19995632 -0.00997806 -0.53376194 0.25112427 + 0.06666667 -0.23255294 1.48542215 -0.01214522 0.04041478 0.17041478 -0.01258653 -0.29744153 0.19995847 -0.00910189 -0.53378220 0.25106785 + 0.07500000 -0.24906631 1.77076571 -0.01205349 0.04050651 0.17050651 -0.01258276 -0.29743776 0.19996224 -0.00808330 -0.53379774 0.25100613 + 0.08333333 -0.16473664 1.81603600 -0.01197863 0.04058137 0.17058137 -0.01257751 -0.29743251 0.19996749 -0.00691885 -0.53380669 0.25093892 + 0.09166667 -0.20303900 2.23239981 -0.01192314 0.04063686 0.17063686 -0.01257098 -0.29742598 0.19997402 -0.00560804 -0.53380691 0.25086614 + 0.10000000 -0.09914484 2.30366584 -0.01188886 0.04067114 0.17067114 -0.01256343 -0.29741843 0.19998157 -0.00415286 -0.53379600 0.25078780 + 0.10833333 -0.16279847 2.84960286 -0.01187693 0.04068307 0.17068307 -0.01255517 -0.29741017 0.19998983 -0.00255714 -0.53377143 0.25070403 + 0.11666667 -0.14515615 3.21583550 -0.01188776 0.04067224 0.17067224 -0.01254650 -0.29740150 0.19999850 -0.00082605 -0.53373051 0.25061499 + 0.12500000 -0.12953200 3.61836241 -0.01192099 0.04063901 0.17063901 -0.01253778 -0.29739278 0.20000722 0.00103459 -0.53367055 0.25052087 + 0.13333333 -0.11559872 4.05556346 -0.01197549 0.04058451 0.17058451 -0.01252933 -0.29738433 0.20001567 0.00301876 -0.53358881 0.25042188 + 0.14166667 -0.10321086 4.52565937 -0.01204947 0.04051053 0.17051053 -0.01252151 -0.29737651 0.20002349 0.00512072 -0.53348253 0.25031818 + 0.15000000 -0.09222400 5.02703208 -0.01214045 0.04041955 0.17041955 -0.01251460 -0.29736960 0.20003040 0.00733533 -0.53334896 0.25020993 + 0.15833333 -0.08250693 5.55831114 -0.01224541 0.04031459 0.17031459 -0.01250888 -0.29736388 0.20003612 0.00965821 -0.53318529 0.25009722 + 0.16666667 -0.07394526 6.11840519 -0.01236085 0.04019915 0.17019915 -0.01250458 -0.29735958 0.20004042 0.01208588 -0.53298865 0.24998010 + 0.17500000 -0.06643992 6.70649281 -0.01248292 0.04007708 0.17007708 -0.01250187 -0.29735687 0.20004313 0.01461569 -0.53275611 0.24985856 + 0.18333333 -0.05990367 7.32198529 -0.01260756 0.03995244 0.16995244 -0.01250084 -0.29735584 0.20004416 0.01724570 -0.53248458 0.24973256 + 0.19166667 -0.05425688 7.96447193 -0.01273061 0.03982939 0.16982939 -0.01250154 -0.29735654 0.20004346 0.01997452 -0.53217087 0.24960202 + 0.20000000 -0.04942385 8.63365713 -0.01284798 0.03971202 0.16971202 -0.01250395 -0.29735895 0.20004105 0.02280103 -0.53181166 0.24946683 + 0.20833333 -0.04532973 9.32929686 -0.01295576 0.03960424 0.16960424 -0.01250797 -0.29736297 0.20003703 0.02572420 -0.53140351 0.24932687 + 0.21666667 -0.04189845 10.05114077 -0.01305036 0.03950964 0.16950964 -0.01251344 -0.29736844 0.20003156 0.02874286 -0.53094288 0.24918203 + 0.22500000 -0.03905156 10.79888459 -0.01312862 0.03943138 0.16943138 -0.01252014 -0.29737514 0.20002486 0.03185548 -0.53042620 0.24903219 + 0.23333333 -0.03670794 11.57213586 -0.01318794 0.03937206 0.16937206 -0.01252782 -0.29738282 0.20001718 0.03506007 -0.52984985 0.24887726 + 0.24166667 -0.03478428 12.37039415 -0.01322634 0.03933366 0.16933366 -0.01253617 -0.29739117 0.20000883 0.03835410 -0.52921028 0.24871718 + 0.25000000 -0.03319728 13.19304609 -0.01324255 0.03931745 0.16931745 -0.01254487 -0.29739987 0.20000013 0.04173442 -0.52850399 0.24855191 + 0.25833333 -0.03185968 14.03936873 -0.01323603 0.03932397 0.16932397 -0.01255357 -0.29740857 0.19999143 0.04519735 -0.52772763 0.24838144 + 0.26666667 -0.03069339 14.90855355 -0.01320698 0.03935302 0.16935302 -0.01256194 -0.29741694 0.19998306 0.04873870 -0.52687796 0.24820580 + 0.27500000 -0.02962037 15.79972240 -0.01315638 0.03940362 0.16940362 -0.01256964 -0.29742464 0.19997536 0.05235386 -0.52595193 0.24802501 + 0.28333333 -0.02857033 16.71195763 -0.01308592 0.03947408 0.16947408 -0.01257638 -0.29743138 0.19996862 0.05603789 -0.52494667 0.24783914 + 0.29166667 -0.02748165 17.64432766 -0.01299794 0.03956206 0.16956206 -0.01258189 -0.29743689 0.19996311 0.05978563 -0.52385949 0.24764827 + 0.30000000 -0.02630303 18.59591055 -0.01289537 0.03966463 0.16966463 -0.01258595 -0.29744095 0.19995905 0.06359178 -0.52268789 0.24745248 + 0.30833333 -0.02499484 19.56581269 -0.01278164 0.03977836 0.16977836 -0.01258841 -0.29744341 0.19995659 0.06745099 -0.52142956 0.24725187 + 0.31666667 -0.02352997 20.55318161 -0.01266051 0.03989949 0.16989949 -0.01258916 -0.29744416 0.19995584 0.07135787 -0.52008236 0.24704652 + 0.32500000 -0.02189415 21.55721255 -0.01253604 0.04002396 0.17002396 -0.01258819 -0.29744319 0.19995681 0.07530707 -0.51864431 0.24683656 + 0.33333333 -0.02008570 22.57714903 -0.01241237 0.04014763 0.17014763 -0.01258552 -0.29744052 0.19995948 0.07929325 -0.51711365 0.24662207 + 0.34166667 -0.01811476 23.61227859 -0.01229362 0.04026638 0.17026638 -0.01258127 -0.29743627 0.19996373 0.08331112 -0.51548874 0.24640318 + 0.35000000 -0.01600203 24.66192465 -0.01218374 0.04037626 0.17037626 -0.01257559 -0.29743059 0.19996941 0.08735537 -0.51376820 0.24617999 + 0.35833333 -0.01377704 25.72543625 -0.01208639 0.04047361 0.17047361 -0.01256872 -0.29742372 0.19997628 0.09142070 -0.51195081 0.24595261 + 0.36666667 -0.01147607 26.80217652 -0.01200482 0.04055518 0.17055518 -0.01256091 -0.29741591 0.19998409 0.09550181 -0.51003558 0.24572119 + 0.37500000 -0.00913992 27.89151149 -0.01194174 0.04061826 0.17061826 -0.01255249 -0.29740749 0.19999251 0.09959332 -0.50802176 0.24548586 + 0.38333333 -0.00681148 28.99279965 -0.01189925 0.04066075 0.17066075 -0.01254376 -0.29739876 0.20000124 0.10368986 -0.50590888 0.24524677 + 0.39166667 -0.00453331 30.10538322 -0.01187878 0.04068122 0.17068122 -0.01253509 -0.29739009 0.20000991 0.10778597 -0.50369672 0.24500407 + 0.40000000 -0.00234534 31.22858097 -0.01188099 0.04067901 0.17067901 -0.01252681 -0.29738181 0.20001819 0.11187620 -0.50138532 0.24475794 + 0.40833333 -0.00028285 32.36168290 -0.01190583 0.04065417 0.17065417 -0.01251923 -0.29737423 0.20002577 0.11595504 -0.49897507 0.24450857 + 0.41666667 0.00162535 33.50394664 -0.01195245 0.04060755 0.17060755 -0.01251267 -0.29736767 0.20003233 0.12001699 -0.49646663 0.24425615 + 0.42500000 0.00335832 34.65459541 -0.01201931 0.04054069 0.17054069 -0.01250738 -0.29736238 0.20003762 0.12405656 -0.49386096 0.24400089 + 0.43333333 0.00490388 35.81282221 -0.01210419 0.04045581 0.17045581 -0.01250356 -0.29735856 0.20004144 0.12806829 -0.49115935 0.24374301 + 0.44166667 0.00625921 36.97779498 -0.01220424 0.04035576 0.17035576 -0.01250136 -0.29735636 0.20004364 0.13204683 -0.48836337 0.24348273 + 0.45000000 0.00743086 38.14865791 -0.01231615 0.04024385 0.17024385 -0.01250087 -0.29735587 0.20004413 0.13598691 -0.48547488 0.24322029 + 0.45833333 0.00843440 39.32453349 -0.01243617 0.04012383 0.17012383 -0.01250212 -0.29735712 0.20004288 0.13988337 -0.48249601 0.24295593 + 0.46666667 0.00929366 40.50452568 -0.01256033 0.03999967 0.16999967 -0.01250504 -0.29736004 0.20003996 0.14373121 -0.47942919 0.24268989 + 0.47500000 0.01003957 41.68772348 -0.01268447 0.03987553 0.16987553 -0.01250953 -0.29736453 0.20003547 0.14752556 -0.47627713 0.24242242 + 0.48333333 0.01070875 42.87320520 -0.01280446 0.03975554 0.16975554 -0.01251541 -0.29737041 0.20002959 0.15126172 -0.47304280 0.24215378 + 0.49166667 0.01134191 44.06004303 -0.01291632 0.03964368 0.16964368 -0.01252245 -0.29737745 0.20002255 0.15493517 -0.46972942 0.24188421 + 0.50000000 0.01198206 45.24730749 -0.01301630 0.03954370 0.16954370 -0.01253037 -0.29738537 0.20001463 0.15854159 -0.46634048 0.24161399 + 0.50833333 0.01267270 46.43407232 -0.01310109 0.03945891 0.16945891 -0.01253887 -0.29739387 0.20000613 0.16207688 -0.46287969 0.24134337 + 0.51666667 0.01345596 47.61941862 -0.01316785 0.03939215 0.16939215 -0.01254760 -0.29740260 0.19999740 0.16553716 -0.45935101 0.24107261 + 0.52500000 0.01437089 48.80243902 -0.01321436 0.03934564 0.16934564 -0.01255624 -0.29741124 0.19998876 0.16891877 -0.45575859 0.24080197 + 0.53333333 0.01545184 49.98224116 -0.01323908 0.03932092 0.16932092 -0.01256443 -0.29741943 0.19998057 0.17221831 -0.45210681 0.24053171 + 0.54166667 0.01672706 51.15795063 -0.01324117 0.03931883 0.16931883 -0.01257186 -0.29742686 0.19997314 0.17543264 -0.44840022 0.24026209 + 0.55000000 0.01821759 52.32871326 -0.01322058 0.03933942 0.16933942 -0.01257824 -0.29743324 0.19996676 0.17855889 -0.44464355 0.23999336 + 0.55833333 0.01993625 53.49369685 -0.01317798 0.03938202 0.16938202 -0.01258332 -0.29743832 0.19996168 0.18159446 -0.44084166 0.23972577 + 0.56666667 0.02188715 54.65209201 -0.01311480 0.03944520 0.16944520 -0.01258690 -0.29744190 0.19995810 0.18453702 -0.43699960 0.23945956 + 0.57500000 0.02406536 55.80311241 -0.01303314 0.03952686 0.16952686 -0.01258883 -0.29744383 0.19995617 0.18738455 -0.43312250 0.23919498 + 0.58333333 0.02645693 56.94599452 -0.01293572 0.03962428 0.16962428 -0.01258904 -0.29744405 0.19995595 0.19013529 -0.42921562 0.23893226 + 0.59166667 0.02903926 58.07999661 -0.01282578 0.03973422 0.16973422 -0.01258753 -0.29744253 0.19995747 0.19278781 -0.42528429 0.23867162 + 0.60000000 0.03178161 59.20440250 -0.01270699 0.03985301 0.16985301 -0.01258436 -0.29743936 0.19996064 0.19534094 -0.42133392 0.23841329 + 0.60833333 0.03464610 60.31852459 -0.01258330 0.03997670 0.16997670 -0.01257964 -0.29743464 0.19996536 0.19779387 -0.41736991 0.23815746 + 0.61666667 0.03758875 61.42170168 -0.01245884 0.04010116 0.17010116 -0.01257356 -0.29742856 0.19997144 0.20014607 -0.41339769 0.23790435 + 0.62500000 0.04056077 62.51329589 -0.01233775 0.04022225 0.17022225 -0.01256636 -0.29742136 0.19997864 0.20239731 -0.40942265 0.23765413 + 0.63333333 0.04350995 63.59268878 -0.01222406 0.04033594 0.17033594 -0.01255833 -0.29741333 0.19998667 0.20454767 -0.40545016 0.23740699 + 0.64166667 0.04638226 64.65927586 -0.01212156 0.04043844 0.17043844 -0.01254978 -0.29740478 0.19999522 0.20659748 -0.40148555 0.23716308 + 0.65000000 0.04912336 65.71246042 -0.01203366 0.04052634 0.17052634 -0.01254103 -0.29739603 0.20000397 0.20854735 -0.39753414 0.23692258 + 0.65833333 0.05168016 66.75164583 -0.01196330 0.04059670 0.17059670 -0.01253244 -0.29738744 0.20001256 0.21039814 -0.39360118 0.23668561 + 0.66666667 0.05400236 67.77622719 -0.01191281 0.04064719 0.17064719 -0.01252435 -0.29737935 0.20002065 0.21215091 -0.38969195 0.23645234 + 0.67500000 0.05604381 68.78558259 -0.01188388 0.04067612 0.17067612 -0.01251706 -0.29737206 0.20002794 0.21380696 -0.38581170 0.23622289 + 0.68333333 0.06979236 69.77100245 -0.01187747 0.04068253 0.17068253 -0.01251087 -0.29736587 0.20003413 0.21536776 -0.38196571 0.23599740 + 0.69166667 0.06806868 70.75126662 -0.01189380 0.04066620 0.17066620 -0.01250602 -0.29736102 0.20003898 0.21683498 -0.37815928 0.23577600 + 0.70000000 0.06770480 71.71218515 -0.01193232 0.04062768 0.17062768 -0.01250269 -0.29735769 0.20004231 0.21821046 -0.37439776 0.23555882 + 0.70833333 0.06690687 72.65507471 -0.01199174 0.04056826 0.17056826 -0.01250102 -0.29735602 0.20004398 0.21949622 -0.37068650 0.23534597 + 0.71666667 0.06584502 73.57897612 -0.01207010 0.04048990 0.17048990 -0.01250108 -0.29735608 0.20004392 0.22069445 -0.36703086 0.23513758 + 0.72500000 0.06449404 74.48314039 -0.01216477 0.04039523 0.17039523 -0.01250285 -0.29735785 0.20004215 0.22180755 -0.36343612 0.23493376 + 0.73333333 0.06285762 75.36679895 -0.01227261 0.04028739 0.17028739 -0.01250628 -0.29736128 0.20003872 0.22283809 -0.35990746 0.23473462 + 0.74166667 0.06094491 76.22920866 -0.01239002 0.04016998 0.17016998 -0.01251123 -0.29736623 0.20003377 0.22378885 -0.35644981 0.23454024 + 0.75000000 0.05877203 77.06967336 -0.01251309 0.04004691 0.17004691 -0.01251750 -0.29737250 0.20002750 0.22466280 -0.35306781 0.23435070 + 0.75833333 0.05636103 77.88756761 -0.01263773 0.03992227 0.16992227 -0.01252484 -0.29737984 0.20002016 0.22546310 -0.34976566 0.23416605 + 0.76666667 0.05373876 78.68235732 -0.01275978 0.03980022 0.16980022 -0.01253298 -0.29738798 0.20001202 0.22619307 -0.34654709 0.23398632 + 0.77500000 0.05093576 79.45361444 -0.01287517 0.03968483 0.16968483 -0.01254159 -0.29739659 0.20000341 0.22685619 -0.34341525 0.23381151 + 0.78333333 0.04798497 80.20102266 -0.01298006 0.03957994 0.16957994 -0.01255033 -0.29740533 0.19999467 0.22745603 -0.34037273 0.23364162 + 0.79166667 0.04492049 80.92437184 -0.01307096 0.03948904 0.16948904 -0.01255886 -0.29741386 0.19998614 0.22799621 -0.33742155 0.23347660 + 0.80000000 0.04177628 81.62353969 -0.01314484 0.03941516 0.16941516 -0.01256685 -0.29742185 0.19997815 0.22848037 -0.33456327 0.23331641 + 0.80833333 0.03858497 82.29846098 -0.01319924 0.03936076 0.16936076 -0.01257398 -0.29742898 0.19997102 0.22891211 -0.33179911 0.23316099 + 0.81666667 0.03537668 82.94908527 -0.01323235 0.03932765 0.16932765 -0.01257998 -0.29743498 0.19996502 0.22929492 -0.32913014 0.23301028 + 0.82500000 0.03217802 83.57532672 -0.01324306 0.03931694 0.16931694 -0.01258461 -0.29743961 0.19996039 0.22963221 -0.32655748 0.23286425 + 0.83333333 0.02901118 84.17701009 -0.01323102 0.03932898 0.16932898 -0.01258768 -0.29744268 0.19995732 0.22992720 -0.32408258 0.23272287 + 0.84166667 0.02589322 84.75381918 -0.01319663 0.03936337 0.16936337 -0.01258908 -0.29744408 0.19995592 0.23018300 -0.32170738 0.23258614 + 0.85000000 0.02283563 85.30525356 -0.01314103 0.03941897 0.16941897 -0.01258876 -0.29744376 0.19995624 0.23040254 -0.31943456 0.23245411 + 0.85833333 0.01984394 85.83060080 -0.01306607 0.03949393 0.16949393 -0.01258672 -0.29744172 0.19995828 0.23058864 -0.31726762 0.23232686 + 0.86666667 0.01691778 86.32892998 -0.01297426 0.03958574 0.16958574 -0.01258304 -0.29743804 0.19996196 0.23074402 -0.31521095 0.23220452 + 0.87500000 0.01405106 86.79911086 -0.01286865 0.03969135 0.16969135 -0.01257787 -0.29743287 0.19996713 0.23087130 -0.31326970 0.23208723 + 0.88333333 0.01123241 87.23986240 -0.01275276 0.03980724 0.16980724 -0.01257142 -0.29742642 0.19997358 0.23097310 -0.31144964 0.23197518 + 0.89166667 0.00844590 87.64983004 -0.01263045 0.03992955 0.16992955 -0.01256393 -0.29741893 0.19998107 0.23105197 -0.30975681 0.23186856 + 0.90000000 0.00567191 88.02769033 -0.01250579 0.04005421 0.17005421 -0.01255570 -0.29741070 0.19998930 0.23111047 -0.30819707 0.23176755 + 0.90833333 0.00288819 88.37227703 -0.01238294 0.04017706 0.17017706 -0.01254705 -0.29740205 0.19999795 0.23115111 -0.30677559 0.23167233 + 0.91666667 0.00007104 88.68272162 -0.01226599 0.04029401 0.17029401 -0.01253832 -0.29739332 0.20000668 0.23117637 -0.30549626 0.23158301 + 0.92500000 -0.00280345 88.95859798 -0.01215882 0.04040118 0.17040118 -0.01252985 -0.29738485 0.20001515 0.23118860 -0.30436106 0.23149965 + 0.93333333 -0.00575814 89.20006062 -0.01206503 0.04049497 0.17049497 -0.01252197 -0.29737697 0.20002303 0.23119006 -0.30336953 0.23142223 + 0.94166667 -0.00881334 89.40796412 -0.01198771 0.04057229 0.17057229 -0.01251500 -0.29737000 0.20003000 0.23118280 -0.30251825 0.23135060 + 0.95000000 -0.01198637 89.58395452 -0.01192947 0.04063053 0.17063053 -0.01250920 -0.29736420 0.20003580 0.23116869 -0.30180044 0.23128455 + 0.95833333 0.01890233 89.64605129 -0.01189222 0.04066778 0.17066778 -0.01250481 -0.29735981 0.20004019 0.23114936 -0.30120580 0.23122369 + 0.96666667 -0.02746879 89.85716098 -0.01187722 0.04068278 0.17068278 -0.01250199 -0.29735699 0.20004301 0.23112621 -0.30072042 0.23116756 + 0.97500000 -0.00118994 89.89484427 -0.01188496 0.04067504 0.17067504 -0.01250085 -0.29735585 0.20004415 0.23110044 -0.30032702 0.23111556 + 0.98333333 -0.00677497 89.99446345 -0.01191519 0.04064481 0.17064481 -0.01250145 -0.29735645 0.20004355 0.23107306 -0.30000530 0.23106698 + 0.99166667 -0.02953557 90.10080868 -0.01196690 0.04059310 0.17059310 -0.01250375 -0.29735875 0.20004125 0.23104492 -0.29973250 0.23102105 + 1.00000000 -0.02356660 90.10762135 -0.01203836 0.04052164 0.17052164 -0.01250767 -0.29736267 0.20003733 0.23101676 -0.29948414 0.23097691 diff --git a/OpenSim/Examples/StaticOptimizationExample/arm26_Setup_StaticOptimization.xml b/OpenSim/Examples/StaticOptimizationExample/arm26_Setup_StaticOptimization.xml new file mode 100644 index 0000000000..595973176e --- /dev/null +++ b/OpenSim/Examples/StaticOptimizationExample/arm26_Setup_StaticOptimization.xml @@ -0,0 +1,100 @@ + + + + + arm26.osim + + false + + + + Results + + 20 + + 0.0000000 + + 1.0000000 + + false + + 20000 + + 1.00000000 + + 0.00000001 + + 0.00001000 + + + + + + true + + 0.00000000 + + 1.00000000 + + 1 + + true + + true + + 2.00000000 + + true + + + + + + + + + + + + + + + arm26_InverseKinematics.mot + + + + 6.00000000 + + + From 874e138259b0044af54e578e52983429dcbdcf40 Mon Sep 17 00:00:00 2001 From: Pariterre Date: Sun, 20 Jan 2019 23:31:02 -0500 Subject: [PATCH 4/8] WIP --- OpenSim/Analyses/StaticOptimization.cpp | 4 +- OpenSim/Analyses/StaticOptimizationTarget.cpp | 60 ++++++++++++------- 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/OpenSim/Analyses/StaticOptimization.cpp b/OpenSim/Analyses/StaticOptimization.cpp index 8e16bc3390..1658e5bf0d 100644 --- a/OpenSim/Analyses/StaticOptimization.cpp +++ b/OpenSim/Analyses/StaticOptimization.cpp @@ -375,7 +375,7 @@ record(const SimTK::State& s) target.setParameterLimits(lowerBounds, upperBounds); - _parameters = 0; // Set initial guess to zeros + _parameters = 0.02; // Set initial guess to zeros (min activation is 0.01, and for central difference make it is not lower bound) // Static optimization _modelWorkingCopy->getMultibodySystem().realize(sWorkingCopy,SimTK::Stage::Velocity); @@ -581,7 +581,7 @@ int StaticOptimization::begin(const SimTK::State& s ) _forceReporter->updForceStorage().reset(); _parameters.resize(_modelWorkingCopy->getNumControls()); - _parameters = 0; + _parameters = 0.02; } _statesSplineSet=GCVSplineSet(5,_statesStore); diff --git a/OpenSim/Analyses/StaticOptimizationTarget.cpp b/OpenSim/Analyses/StaticOptimizationTarget.cpp index 09b59a7b44..cdd0a4bbfc 100644 --- a/OpenSim/Analyses/StaticOptimizationTarget.cpp +++ b/OpenSim/Analyses/StaticOptimizationTarget.cpp @@ -38,7 +38,7 @@ using SimTK::Vector; using SimTK::Matrix; using SimTK::Real; -#define USE_LINEAR_CONSTRAINT_MATRIX +//#define USE_LINEAR_CONSTRAINT_MATRIX const double StaticOptimizationTarget::SMALLDX = 1.0e-14; //const double StaticOptimizationTarget::_activationExponent = 2.0; @@ -89,8 +89,9 @@ StaticOptimizationTarget(const SimTK::State& s, Model *aModel,int aNP,int aNC, b bool StaticOptimizationTarget:: prepareToOptimize(SimTK::State& s, double *x) { - // COMPUTE MAX ISOMETRIC FORCE const ForceSet& fSet = _model->getForceSet(); +#ifdef USE_LINEAR_CONSTRAINT_MATRIX + // COMPUTE MAX ISOMETRIC FORCE for(int i=0, j=0;i(&fSet.get(i)); @@ -113,7 +114,6 @@ prepareToOptimize(SimTK::State& s, double *x) } } -#ifdef USE_LINEAR_CONSTRAINT_MATRIX //cout<<"Computing linear constraint matrix..."<(&fSet.get(i)); + if( act ) { +// act->overrideActuation(s, true); + } + } #endif // return false to indicate that we still need to proceed with optimization @@ -543,17 +551,14 @@ constraintFunc(const SimTK::Vector ¶meters, const bool new_parameters, SimTK //QueryPerformanceFrequency(&frequency); //QueryPerformanceCounter(&start); -#ifndef USE_LINEAR_CONSTRAINT_MATRIX - - // Evaluate constraint function for all constraints and pick the appropriate component - computeConstraintVector(parameters,constraints); - -#else - +#ifdef USE_LINEAR_CONSTRAINT_MATRIX // Use precomputed constraint matrix //cout<<"Computing constraints assuming linear dependence..."<getCurrentState()); + computeConstraintVector(state, parameters,constraints); #endif //QueryPerformanceCounter(&stop); @@ -631,17 +636,13 @@ constraintJacobian(const SimTK::Vector ¶meters, const bool new_parameters, S //QueryPerformanceFrequency(&frequency); //QueryPerformanceCounter(&start); -#ifndef USE_LINEAR_CONSTRAINT_MATRIX - - // Compute gradient - StaticOptimizationTarget::CentralDifferencesConstraint(this,&_dx[0],parameters,jac); - -#else - +#ifdef USE_LINEAR_CONSTRAINT_MATRIX // Use precomputed constraint matrix (works if constraint is linear) //cout<<"Computing constraint gradient assuming linear dependence..."<getForceSet(); +#ifdef USE_LINEAR_CONSTRAINT_MATRIX for(int i=0,j=0;i(&fs.get(i)); if( act ) { @@ -670,7 +672,23 @@ computeAcceleration(SimTK::State& s, const SimTK::Vector ¶meters,SimTK::Vect j++; } } - +#else +// for(int i=0,j=0;i(&fs.get(i)); +// if (mus){ +// mus->overrideActuation(s, true); +// mus->setActivation(s, parameters[j]); +// } +// } +// _model->equilibrateMuscles(s); + for(int i=0,j=0;i(&fs.get(i)); + if( act ) { + act->setOverrideActuation(s, parameters[j] * _optimalForce[j]); + j++; + } + } +#endif _model->getMultibodySystem().realize(s,SimTK::Stage::Acceleration); SimTK::Vector udot = _model->getMatterSubsystem().getUDot(s); From e6b49689310eee248184a3449c016dd75d459d4c Mon Sep 17 00:00:00 2001 From: pariterre Date: Mon, 21 Jan 2019 15:28:05 -0500 Subject: [PATCH 5/8] Static optimization without using linear optim now returns reliable values --- OpenSim/Analyses/StaticOptimization.cpp | 2 +- OpenSim/Analyses/StaticOptimizationTarget.cpp | 42 +++++++++++-------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/OpenSim/Analyses/StaticOptimization.cpp b/OpenSim/Analyses/StaticOptimization.cpp index f9fd895da2..49912525d7 100644 --- a/OpenSim/Analyses/StaticOptimization.cpp +++ b/OpenSim/Analyses/StaticOptimization.cpp @@ -446,7 +446,7 @@ record(const SimTK::State& s) double tolConstraints = 1e-6; bool incompleteModel = false; string msgIncomplete = "The model appears unsuitable for static optimization.\nTry appending the model with additional force(s) or locking joint(s) to reduce the following acceleration constraint violation(s):\n"; - SimTK::Vector constraints; + SimTK::Vector constraints(target.getNumConstraints()); target.constraintFunc(_parameters,true,constraints); auto coordinates = _modelWorkingCopy->getCoordinatesInMultibodyTreeOrder(); diff --git a/OpenSim/Analyses/StaticOptimizationTarget.cpp b/OpenSim/Analyses/StaticOptimizationTarget.cpp index 6f15551a9c..8b764675dd 100644 --- a/OpenSim/Analyses/StaticOptimizationTarget.cpp +++ b/OpenSim/Analyses/StaticOptimizationTarget.cpp @@ -140,9 +140,10 @@ prepareToOptimize(SimTK::State& s, double *x) for(int i=0; i(&fSet.get(i)); if( act ) { -// act->overrideActuation(s, true); + act->overrideActuation(s, false); } } + #endif // return false to indicate that we still need to proceed with optimization @@ -664,7 +665,6 @@ computeAcceleration(SimTK::State& s, const SimTK::Vector ¶meters,SimTK::Vect { // double time = s.getTime(); - const ForceSet& fs = _model->getForceSet(); #ifdef USE_LINEAR_CONSTRAINT_MATRIX for(int i=0,j=0;i(&fs.get(i)); -// if (mus){ -// mus->overrideActuation(s, true); -// mus->setActivation(s, parameters[j]); -// } -// } -// _model->equilibrateMuscles(s); - for(int i=0,j=0;i(&fs.get(i)); - if( act ) { - act->setOverrideActuation(s, parameters[j] * _optimalForce[j]); - j++; - } + for(int i=0,j=0;i(&fs.get(i)); + if (mus){ + mus->setActivation(s, parameters[j]); + ++j; + } + } + try{ + _model->equilibrateMuscles(s); + } catch (const Exception& x) { + // If the muscle falls into some weird numerical error, try to just slightly change the activations + for(int i=0,j=0;i(&fs.get(i)); + if (mus){ + if (parameters[j] < 1) + mus->setActivation(s, parameters[j]+.001); + else + mus->setActivation(s, parameters[j]-.001); + ++j; + } + } + _model->equilibrateMuscles(s); } #endif _model->getMultibodySystem().realize(s,SimTK::Stage::Acceleration); SimTK::Vector udot = _model->getMatterSubsystem().getUDot(s); - for(int i=0; i<_accelerationIndices.getSize(); i++) + for(int i=0; i<_accelerationIndices.getSize(); i++) rAccel[i] = udot[_accelerationIndices[i]]; //QueryPerformanceCounter(&stop); From 189be4d6257509f906e21bc24e0ef1248eaa78bb Mon Sep 17 00:00:00 2001 From: pariterre Date: Tue, 22 Jan 2019 12:14:17 -0500 Subject: [PATCH 6/8] Static optimization using Python --- .../StaticOptimization/data/arm26.osim | 1617 +++++++++++++++++ .../data/arm26_InverseKinematics.mot | 132 ++ .../static_optim/__init__.py | 0 .../static_optim/constraints.py | 31 + .../static_optim/dynamic_models.py | 208 +++ .../StaticOptimization/static_optim/forces.py | 34 + .../static_optim/kinematic.py | 84 + .../static_optim/objective.py | 38 + .../static_optimization_example.py | 124 ++ 9 files changed, 2268 insertions(+) create mode 100644 Bindings/Python/examples/StaticOptimization/data/arm26.osim create mode 100644 Bindings/Python/examples/StaticOptimization/data/arm26_InverseKinematics.mot create mode 100644 Bindings/Python/examples/StaticOptimization/static_optim/__init__.py create mode 100644 Bindings/Python/examples/StaticOptimization/static_optim/constraints.py create mode 100644 Bindings/Python/examples/StaticOptimization/static_optim/dynamic_models.py create mode 100644 Bindings/Python/examples/StaticOptimization/static_optim/forces.py create mode 100644 Bindings/Python/examples/StaticOptimization/static_optim/kinematic.py create mode 100644 Bindings/Python/examples/StaticOptimization/static_optim/objective.py create mode 100644 Bindings/Python/examples/StaticOptimization/static_optimization_example.py diff --git a/Bindings/Python/examples/StaticOptimization/data/arm26.osim b/Bindings/Python/examples/StaticOptimization/data/arm26.osim new file mode 100644 index 0000000000..4cd2f1cc66 --- /dev/null +++ b/Bindings/Python/examples/StaticOptimization/data/arm26.osim @@ -0,0 +1,1617 @@ + + + + + + The OpenSim Development Team (Reinbolt, J; Seth, A; Habib, A; Hamner, S) adapted from a model originally created by Kate Holzbaur (11/22/04) + + License: + Creative Commons (CCBY 3.0). You are free to distribute, remix, tweak, and build upon this work, even commercially, + as long as you credit us for the original creation. + http://creativecommons.org/licenses/by/3.0/ + + + Holzbaur, K.R.S., Murray, W.M., Delp, S.L. A Model of the Upper Extremity for Simulating Musculoskeletal Surgery and Analyzing Neuromuscular Control. + Annals of Biomedical Engineering, vol 33, pp 829–840, 2005 + + meters + N + + 0 -9.8066 0 + + + + + 0 + 0 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + ground_ribs.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + ground_spine.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + ground_skull.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + ground_jaw.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + ground_r_clavicle.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + ground_r_scapula.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + 1.37532 -0.294612 2.43596 + -0.043905 -0.0039 0.1478 + true + x + + + + + + + + 1 1 1 + + 1.37532 -0.294612 2.43596 -0.043905 -0.0039 0.1478 + + false + + 4 + + 0.003 + 0.03 + + + + + + + 1.864572 + 0 -0.180496 0 + 0.01481 + 0.004551 + 0.013193 + 0 + 0 + 0 + + + + + + + + + r_shoulder_elev + + -0.05889802 0.0023 0.99826136 + + + + 1 0 + + + + + + + + 0 1 0 + + + + 0 + + + + + + + + 0.99826136 -0 0.05889802 + + + + 0 + + + + + + + + + 1 0 0 + + + + 0 + + + + + + + + 0 1 0 + + + + 0 + + + + + + + + 0 0 1 + + + + 0 + + + + + ground + -0.017545 -0.007 0.17 + 0 0 0 + 0 0 0 + 0 0 0 + + + + + + rotational + + 0 + + 0 + + -1.57079633 3.14159265 + + false + + false + + + + + + + false + + + + + + + + + arm_r_humerus.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + 3.00162 -0.853466 2.57419 + -0.0078 -0.0041 -0.0014 + true + z + + + + + + + + 1 1 1 + + 3.00162 -0.853466 2.57419 -0.0078 -0.0041 -0.0014 + + false + + 4 + + 0.035 0.02 0.02 + + + -2.00434 -1.00164 0.975465 + 0.0033 0.0073 0.0003 + true + -y + + + + + + + + 1 1 1 + + -2.00434 -1.00164 0.975465 0.0033 0.0073 0.0003 + + false + + 4 + + 0.025 0.02 0.02 + + + -0.14015 -0.00628319 0.154985 + 0.0028 -0.2919 -0.0069 + true + all + + + + + + + + 1 1 1 + + -0.14015 -0.00628319 0.154985 0.0028 -0.2919 -0.0069 + + false + + 4 + + 0.016 + 0.05 + + + + + + + 1.534315 + 0 -0.181479 0 + 0.019281 + 0.001571 + 0.020062 + 0 + 0 + 0 + + + + + + + + + r_elbow_flex + + 0.04940001 0.03660001 0.99810825 + + + + 1 0 + + + + + + + + 0 1 0 + + + + 0 + + + + + + + + 0.99810825 0 -0.04940001 + + + + 0 + + + + + + + + + 1 0 0 + + + + 0 + + + + + + + + 0 1 0 + + + + 0 + + + + + + + + 0 0 1 + + + + 0 + + + + + r_humerus + 0.0061 -0.2904 -0.0123 + 0 0 0 + 0 0 0 + 0 0 0 + + + + + + rotational + + 0 + + 0 + + 0 2.26892803 + + false + + false + + + + + + + false + + + + + + + + + arm_r_ulna.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_radius.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_lunate.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_scaphoid.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_pisiform.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_triquetrum.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_capitate.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_trapezium.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_trapezoid.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_hamate.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_1mc.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_2mc.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_3mc.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_4mc.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_5mc.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_thumbprox.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_thumbdist.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_2proxph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_2midph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_2distph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_3proxph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_3midph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_3distph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_4proxph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_4midph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_4distph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_5proxph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_5midph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + arm_r_5distph.vtp + + 1 1 1 + + + + -0 0 -0 0 0 0 + + 1 1 1 + + 4 + + 1 + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + + + + + + + + + + + + + + + + false + + 0 + + 1 + + + + + + -0.05365 -0.01373 0.14723 + ground + + + -0.02714 -0.11441 -0.00664 + r_humerus + + + -0.03184 -0.22637 -0.01217 + r_humerus + + + -0.01743 -0.26757 -0.01208 + r_humerus + + + -0.0219 0.01046 -0.00078 + r_ulna_radius_hand + + + + + + + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + TRI + hybrid + -1 -1 + + + TRIlonghh + hybrid + -1 -1 + + + TRIlongglen + hybrid + -1 -1 + + + + + + + 1 + + 798.52 + + 0.134 + + 0.143 + + 0.20943951 + + 10 + + 0.01 + + 0.04 + + 0.033 + + 0.6 + + 0.5 + + 4 + + 0.3 + + 1.8 + + + + false + + 0 + + 1 + + + + + + -0.00599 -0.12646 0.00428 + r_humerus + + + -0.02344 -0.14528 0.00928 + r_humerus + + + -0.03184 -0.22637 -0.01217 + r_humerus + + + -0.01743 -0.26757 -0.01208 + r_humerus + + + -0.0219 0.01046 -0.00078 + r_ulna_radius_hand + + + + + + + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + TRI + hybrid + -1 -1 + + + + + + + 1 + + 624.3 + + 0.1138 + + 0.098 + + 0.15707963 + + 10 + + 0.01 + + 0.04 + + 0.033 + + 0.6 + + 0.5 + + 4 + + 0.3 + + 1.8 + + + + false + + 0 + + 1 + + + + + + -0.00838 -0.13695 -0.00906 + r_humerus + + + -0.02601 -0.15139 -0.0108 + r_humerus + + + -0.03184 -0.22637 -0.01217 + r_humerus + + + -0.01743 -0.26757 -0.01208 + r_humerus + + + -0.0219 0.01046 -0.00078 + r_ulna_radius_hand + + + + + + + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + TRI + hybrid + -1 -1 + + + + + + + 1 + + 624.3 + + 0.1138 + + 0.0908 + + 0.15707963 + + 10 + + 0.01 + + 0.04 + + 0.033 + + 0.6 + + 0.5 + + 4 + + 0.3 + + 1.8 + + + + false + + 0 + + 1 + + + + + + -0.039235 0.00347 0.14795 + ground + + + -0.028945 0.01391 0.15639 + ground + + + 0.02131 0.01793 0.01028 + r_humerus + + + 0.02378 -0.00511 0.01201 + r_humerus + + + 0.01345 -0.02827 0.00136 + r_humerus + + + 0.01068 -0.07736 -0.00165 + r_humerus + + + 0.01703 -0.12125 0.00024 + r_humerus + + + 0.0228 -0.1754 -0.0063 + r_humerus + + + 0.00751 -0.04839 0.02179 + r_ulna_radius_hand + + + + + + + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + BIClonghh + hybrid + 2 3 + + + + + + + 1 + + 624.3 + + 0.1157 + + 0.2723 + + 0 + + 10 + + 0.01 + + 0.04 + + 0.033 + + 0.6 + + 0.5 + + 4 + + 0.3 + + 1.8 + + + + false + + 0 + + 1 + + + + + + 0.004675 -0.01231 0.13475 + ground + + + -0.007075 -0.04004 0.14507 + ground + + + 0.01117 -0.07576 -0.01101 + r_humerus + + + 0.01703 -0.12125 -0.01079 + r_humerus + + + 0.0228 -0.1754 -0.0063 + r_humerus + + + 0.00751 -0.04839 0.02179 + r_ulna_radius_hand + + + + + + + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + + + + 1 + + 435.56 + + 0.1321 + + 0.1923 + + 0 + + 10 + + 0.01 + + 0.04 + + 0.033 + + 0.6 + + 0.5 + + 4 + + 0.3 + + 1.8 + + + + false + + 0 + + 1 + + + + + + 0.0068 -0.1739 -0.0036 + r_humerus + + + -0.0032 -0.0239 0.0009 + r_ulna_radius_hand + + + + + + + + + + + + 1 1 1 + + -0 0 -0 0 0 0 + + false + + 4 + + + + + TRI + hybrid + -1 -1 + + + + + + + 1 + + 987.26 + + 0.0858 + + 0.0535 + + 0 + + 10 + + 0.01 + + 0.04 + + 0.033 + + 0.6 + + 0.5 + + 4 + + 0.3 + + 1.8 + + + + + + + + + + ground + + -0.01256 0.04 0.17 + + false + + + + r_humerus + + 0.005 -0.2904 0.03 + + false + + + + r_ulna_radius_hand + + -0.0011 -0.23559 0.0943 + + false + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Bindings/Python/examples/StaticOptimization/data/arm26_InverseKinematics.mot b/Bindings/Python/examples/StaticOptimization/data/arm26_InverseKinematics.mot new file mode 100644 index 0000000000..abd46f165b --- /dev/null +++ b/Bindings/Python/examples/StaticOptimization/data/arm26_InverseKinematics.mot @@ -0,0 +1,132 @@ +Coordinates +version=1 +nRows=121 +nColumns=3 +inDegrees=yes + +Units are S.I. units (second, meters, Newtons, ...) +Angles are in degrees. + +endheader +time r_shoulder_elev r_elbow_flex + 0.00000000 -0.03394423 -0.05440752 + 0.00833333 -0.03657365 0.01417949 + 0.01666667 -0.03908443 0.08815700 + 0.02500000 -0.04126018 0.17357577 + 0.03333333 -0.04302262 0.27576038 + 0.04166667 -0.04431782 0.39945264 + 0.05000000 -0.04510954 0.54869991 + 0.05833333 -0.04537808 0.72677247 + 0.06666667 -0.04512001 0.93612489 + 0.07500000 -0.04434823 1.17840384 + 0.08333333 -0.04309148 1.45449954 + 0.09166667 -0.04139335 1.76463436 + 0.10000000 -0.03931062 2.10847927 + 0.10833333 -0.03691091 2.48528740 + 0.11666667 -0.03427009 2.89403350 + 0.12500000 -0.03146918 3.33354847 + 0.13333333 -0.02859119 3.80263942 + 0.14166667 -0.02571790 4.30018788 + 0.15000000 -0.02292668 4.82522141 + 0.15833333 -0.02028769 5.37695629 + 0.16666667 -0.01786127 5.95481213 + 0.17500000 -0.01569588 6.55840109 + 0.18333333 -0.01382651 7.18749683 + 0.19166667 -0.01227362 7.84198911 + 0.20000000 -0.01104271 8.52183068 + 0.20833333 -0.01063203 9.22680499 + 0.21666667 -0.01014548 9.95712408 + 0.22500000 -0.00994868 10.71250561 + 0.23333333 -0.00999836 11.49266577 + 0.24166667 -0.01024449 12.29720264 + 0.25000000 -0.01063082 13.12558584 + 0.25833333 -0.01109740 13.97716626 + 0.26666667 -0.01158331 14.85119468 + 0.27500000 -0.01202923 15.74684640 + 0.28333333 -0.01237995 16.66324846 + 0.29166667 -0.01258656 17.59950631 + 0.30000000 -0.01260837 18.55472747 + 0.30833333 -0.01241432 19.52804021 + 0.31666667 -0.01198399 20.51860647 + 0.32500000 -0.01058758 21.52207195 + 0.33333333 -0.00959073 22.54440307 + 0.34166667 -0.00836629 23.58174648 + 0.35000000 -0.00694125 24.63344306 + 0.35833333 -0.00534967 25.69885458 + 0.36666667 -0.00363212 26.77735633 + 0.37500000 -0.00183366 27.86832623 + 0.38333333 -0.00000136 28.97113454 + 0.39166667 0.00181800 30.08513509 + 0.40000000 0.00358032 31.20965795 + 0.40833333 0.00428682 32.34819524 + 0.41666667 0.00590309 33.49117787 + 0.42500000 0.00738472 34.64241319 + 0.43333333 0.00871270 35.80113533 + 0.44166667 0.00987599 36.96654805 + 0.45000000 0.01087179 38.13783197 + 0.45833333 0.01170564 39.31414404 + 0.46666667 0.01239170 40.49461673 + 0.47500000 0.01295331 41.67835672 + 0.48333333 0.01327011 42.86586863 + 0.49166667 0.01377298 44.05247968 + 0.50000000 0.01343804 45.24176825 + 0.50833333 0.01425886 46.42911029 + 0.51666667 0.01516679 47.61407250 + 0.52500000 0.01576730 48.79835999 + 0.53333333 0.01655188 49.97933728 + 0.54166667 0.01756672 51.15600652 + 0.55000000 0.01883929 52.32746631 + 0.55833333 0.02037991 53.49290785 + 0.56666667 0.02218621 54.65157998 + 0.57500000 0.02424569 55.80276096 + 0.58333333 0.02653710 56.94574291 + 0.59166667 0.02903146 58.07982547 + 0.60000000 0.03169288 59.20431944 + 0.60833333 0.03447969 60.31855210 + 0.61666667 0.03734550 61.42186798 + 0.62500000 0.04024030 62.51362855 + 0.63333333 0.04311165 63.59321090 + 0.64166667 0.04589217 64.66132688 + 0.65000000 0.04854040 65.71428274 + 0.65833333 0.05102086 66.75336239 + 0.66666667 0.05327580 67.77793606 + 0.67500000 0.05525461 68.78735815 + 0.68333333 0.05691445 69.78095927 + 0.69166667 0.05811323 70.75864875 + 0.70000000 0.05876137 71.71835406 + 0.70833333 0.05918762 72.66006045 + 0.71666667 0.05930941 73.58300983 + 0.72500000 0.05907709 74.48642151 + 0.73333333 0.05846323 75.36950928 + 0.74166667 0.05746128 76.23150702 + 0.75000000 0.05608208 77.07169562 + 0.75833333 0.05434973 77.88942823 + 0.76666667 0.05229773 78.68415149 + 0.77500000 0.04996565 79.45542034 + 0.78333333 0.04739652 80.20290345 + 0.79166667 0.04463464 80.92637757 + 0.80000000 0.04172377 81.62570894 + 0.80833333 0.03870563 82.30082252 + 0.81666667 0.03561853 82.95165954 + 0.82500000 0.03249633 83.57812722 + 0.83333333 0.02936748 84.18004462 + 0.84166667 0.02625434 84.75709092 + 0.85000000 0.02322870 85.31019088 + 0.85833333 0.01999313 85.83566423 + 0.86666667 0.01687593 86.33409957 + 0.87500000 0.01384316 86.80436866 + 0.88333333 0.01087758 87.24519349 + 0.89166667 0.00795763 87.65522203 + 0.90000000 0.00505936 88.03313282 + 0.90833333 0.00215732 88.37776134 + 0.91666667 -0.00077423 88.68824068 + 0.92500000 -0.00376022 88.96414621 + 0.93333333 -0.00682352 89.20563380 + 0.94166667 -0.00998396 89.41355950 + 0.95000000 -0.01325729 89.58957023 + 0.95833333 -0.01665443 89.73615585 + 0.96666667 -0.02018099 89.85665620 + 0.97500000 -0.02383697 89.95521895 + 0.98333333 -0.02761671 90.03670904 + 0.99166667 -0.03150905 90.10657304 + 1.00000000 -0.03549721 90.17066638 diff --git a/Bindings/Python/examples/StaticOptimization/static_optim/__init__.py b/Bindings/Python/examples/StaticOptimization/static_optim/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Bindings/Python/examples/StaticOptimization/static_optim/constraints.py b/Bindings/Python/examples/StaticOptimization/static_optim/constraints.py new file mode 100644 index 0000000000..ab3def6035 --- /dev/null +++ b/Bindings/Python/examples/StaticOptimization/static_optim/constraints.py @@ -0,0 +1,31 @@ +""" +Constraints class. + +ConstraintAccelerationTarget create a strict constraint for the optimization such as the generalized accelerations +computed from muscle activation equal the generalized accelerations from inverse kinematics. +""" +import numpy as np +from scipy.optimize import approx_fprime + + +class ConstraintAccelerationTarget: + def __init__(self): + pass + + def constraints(self, x, idx=None): + """callback for calculating the constraints.""" + qddot_from_muscles = self.forward_dynamics(x) + const = [ + self.actual_qddot[idx_q] - qddot_from_muscles.get(idx_q) + for idx_q in range(qddot_from_muscles.size()) + ] + if idx is not None: + return const[idx] + else: + return const + + def jacobian(self, x): + jac = np.ndarray([self.n_dof, self.n_actuators]) + for idof in range(self.n_dof): + jac[idof, :] = approx_fprime(x, self.constraints, 1e-10, idof) + return jac diff --git a/Bindings/Python/examples/StaticOptimization/static_optim/dynamic_models.py b/Bindings/Python/examples/StaticOptimization/static_optim/dynamic_models.py new file mode 100644 index 0000000000..d2d2314035 --- /dev/null +++ b/Bindings/Python/examples/StaticOptimization/static_optim/dynamic_models.py @@ -0,0 +1,208 @@ +""" +Dynamic models. + +These are the actual classes to send to IPOPT. +""" + +import numpy as np +import opensim as osim + +from static_optim.constraints import ConstraintAccelerationTarget +from static_optim.forces import ResidualForces, ExternalForces +from static_optim.kinematic import KinematicModel +from static_optim.objective import ObjMinimizeActivation + + +class ClassicalStaticOptimization( + KinematicModel, + ObjMinimizeActivation, + ConstraintAccelerationTarget, + ResidualForces, + ExternalForces, +): + """ + Computes the muscle activations in order to minimize them while targeting the acceleration from inverse kinematics. + This is the most classical approach to Static Opimization. + """ + + # TODO: write tests + def __init__( + self, + model, + mot, + filter_param=None, + activation_exponent=2, + residual_actuator_xml=None, + external_load_xml=None, + ): + KinematicModel.__init__(self, model, mot, filter_param) + ObjMinimizeActivation.__init__(self, activation_exponent) + ResidualForces.__init__(self, residual_actuator_xml) + ExternalForces.__init__(self, external_load_xml) + + def forward_dynamics(self, x): + # set residual forces + fs = self.model.getForceSet() + for i in range(self.n_muscles, fs.getSize()): + act = osim.ScalarActuator.safeDownCast(fs.get(i)) + if act: + act.setOverrideActuation(self.state, x[i]) + + # update muscles + muscle_activation = x[: self.n_muscles] + for m in range(self.n_muscles): + self.muscle_actuators.get(m).setActivation(self.state, muscle_activation[m]) + self.model.equilibrateMuscles(self.state) + self.model.realizeAcceleration(self.state) + return self.state.getUDot() + + +class ClassicalOptimizationLinearConstraints( + KinematicModel, + ObjMinimizeActivation, + ConstraintAccelerationTarget, + ResidualForces, + ExternalForces, +): + """ + Intends to mimic the classical approach but with the constraints linearized. + It makes the assumption that muscle length is constant at a particular position and velocity, whatever the muscle + activation. + """ + + # TODO: write tests + def __init__( + self, + model, + mot, + filter_param=None, + activation_exponent=2, + residual_actuator_xml=None, + external_load_xml=None, + muscle_physiology=True, + ): + self.muscle_physiology = muscle_physiology + self.previous_activation = np.array([]) + + KinematicModel.__init__(self, model, mot, filter_param) + ObjMinimizeActivation.__init__(self, activation_exponent) + ResidualForces.__init__(self, residual_actuator_xml) + ExternalForces.__init__(self, external_load_xml) + + # prepare linear constraints variables + self.previous_activation = np.ones(self.n_muscles) + self.qddot_from_nl = [] + self.constraint_vector = [] + self.optimal_forces = [] + self.passive_forces = [] + self.constraint_matrix = [] + self.jacobian_matrix = [] # Precomputed jacobian + self._prepare_constraints() + + def forward_dynamics(self, x): + fs = self.model.getForceSet() + for i in range(fs.getSize()): + act = osim.ScalarActuator.safeDownCast(fs.get(i)) + if act: + act.setOverrideActuation(self.state, x[i] * self.optimal_forces[i]) + + self.model.realizeAcceleration(self.state) + return self.state.getUDot() + + def passive_forward_dynamics(self): + fs = self.model.getForceSet() + for i in range(fs.getSize()): + act = osim.ScalarActuator.safeDownCast(fs.get(i)) + if act: + act.setOverrideActuation(self.state, self.passive_forces[i]) + + self.model.realizeAcceleration(self.state) + qddot = self.state.getUDot() + return [qddot.get(idx_q) for idx_q in range(qddot.size())] + + def upd_model_kinematics(self, frame): + super().upd_model_kinematics(frame) + if self.previous_activation.size > 0: + self._prepare_constraints() + + def _prepare_constraints(self): + fs = self.model.getForceSet() + for i in range(fs.getSize()): + act = osim.ScalarActuator.safeDownCast(fs.get(i)) + if act: + act.overrideActuation(self.state, False) + + self.passive_forces = [] + for m in range(self.n_muscles): + self.muscle_actuators.get(m).setActivation(self.state, self.previous_activation[m]) + self.model.equilibrateMuscles(self.state) + self.model.realizeVelocity(self.state) + for m in range(self.n_muscles): + self.passive_forces.append(self.muscle_actuators.get(m).getPassiveFiberForceAlongTendon(self.state)) + + forces = self.model.getForceSet() + self.optimal_forces = [] + imus = 0 + for i in range(forces.getSize()): + muscle = osim.Muscle.safeDownCast(forces.get(i)) + if muscle: + if self.muscle_physiology: + self.model.setAllControllersEnabled(True) + self.optimal_forces.append(muscle.getActiveFiberForceAlongTendon(self.state) / + self.previous_activation[i]) + self.model.setAllControllersEnabled(False) + else: + self.optimal_forces.append(muscle.getMaxIsometricForce()) + imus += 1 + coordinate = osim.CoordinateActuator.safeDownCast(forces.get(i)) + if coordinate: + self.optimal_forces.append(coordinate.getOptimalForce()) + + self.linear_constraints() + + def constraints(self, x, idx=None): + # x = self.previous_activation + x_tp = x.reshape((x.shape[0], 1)) + x_mul = np.ndarray((self.constraint_matrix.shape[0], x_tp.shape[1])) + np.matmul(self.constraint_matrix, x_tp, x_mul) + x_constraint = x_mul.ravel() + + # That is what really happening + # const = self.actual_qddot - (x_constraint + self.passive_forward_dynamics()) + const = x_constraint - self.constraint_vector + + if idx is not None: + return const[idx] + else: + return const + + def linear_constraints(self): + fs = self.model.getForceSet() + for i in range(fs.getSize()): + act = osim.ScalarActuator.safeDownCast(fs.get(i)) + if act: + act.overrideActuation(self.state, True) + p_vector = np.zeros(self.n_actuators) + + qddot_from_nl_tp = self.forward_dynamics(p_vector) + self.qddot_from_nl = np.array( + [qddot_from_nl_tp.get(idx_q) for idx_q in range(qddot_from_nl_tp.size())]) + + self.constraint_matrix = np.zeros((self.n_dof, self.n_actuators)) + + for p in range(self.n_actuators): + p_vector[p] = 1 + qddot_from_muscles_tp = self.forward_dynamics(p_vector) + qddot_from_muscles = np.array([qddot_from_muscles_tp.get(idx_q) for idx_q in range(qddot_from_muscles_tp.size())]) + self.constraint_matrix[:, p] = qddot_from_muscles - self.qddot_from_nl + p_vector[p] = 0 + + self.constraint_vector = np.array(self.actual_qddot) - np.array(self.passive_forward_dynamics()) + + def jacobian(self, x): + return self.constraint_matrix + + def set_previous_activation(self, x): + x[x <= 0] = 0.01 + x[x > 1] = 1 + self.previous_activation = np.array(x) \ No newline at end of file diff --git a/Bindings/Python/examples/StaticOptimization/static_optim/forces.py b/Bindings/Python/examples/StaticOptimization/static_optim/forces.py new file mode 100644 index 0000000000..0c68b22a17 --- /dev/null +++ b/Bindings/Python/examples/StaticOptimization/static_optim/forces.py @@ -0,0 +1,34 @@ +""" +Forces method classes. + +The dynamic model should inherit from these classes in order to get the proper forces. +""" +import opensim as osim + + +class ResidualForces: + def __init__(self, residual_actuator_xml=None): + + if residual_actuator_xml: + force_set = osim.ArrayStr() + force_set.append(residual_actuator_xml) + + analyze_tool = osim.AnalyzeTool(self.model) + analyze_tool.setModel(self.model) + analyze_tool.setForceSetFiles(force_set) + analyze_tool.updateModelForces(self.model, residual_actuator_xml) + self.state = self.model.initSystem() + + fs = self.model.getForceSet() + for i in range(fs.getSize()): + act = osim.CoordinateActuator.safeDownCast(fs.get(i)) + if act: + act.overrideActuation(self.state, True) + + +class ExternalForces: + def __init__(self, external_load_xml=None): + if external_load_xml: + analyze_tool = osim.AnalyzeTool(self.model) + analyze_tool.setModel(self.model) + analyze_tool.setExternalLoadsFileName(external_load_xml) diff --git a/Bindings/Python/examples/StaticOptimization/static_optim/kinematic.py b/Bindings/Python/examples/StaticOptimization/static_optim/kinematic.py new file mode 100644 index 0000000000..7e76a1614c --- /dev/null +++ b/Bindings/Python/examples/StaticOptimization/static_optim/kinematic.py @@ -0,0 +1,84 @@ +""" +Kinematics method classes. + +The dynamic model should inherit from this class in order to get the proper kinematics. +""" + +import opensim as osim + + +class KinematicModel: + def __init__(self, model, mot, filter_param=None): + + # load model + self.model = osim.Model(model) + self.state = self.model.initSystem() + + # prepare data + self.actual_q, self.actual_qdot, self.actual_qddot = [], [], [] + + # get some reference that will be modified during the optimization (for speed sake) + self.actuators = self.model.getForceSet() + self.muscle_actuators = self.model.getMuscles() + self.n_dof = self.state.getQ().size() + self.n_actuators = self.actuators.getSize() + self.n_muscles = self.muscle_actuators.getSize() + + self._data_storage = osim.Storage(mot) + self.filter_param = filter_param + + self.__dispatch_kinematics() + + def get_time(self, frame): + return self._data_storage.getStateVector(frame).getTime() + + def __dispatch_kinematics(self): + self.model.getSimbodyEngine().convertDegreesToRadians(self._data_storage) + + if self.filter_param: + # TODO: read value from xml + self._data_storage.lowpassFIR(self.filter_param[0], self.filter_param[1]) + + # TODO: read value from xml + self.gen_coord_function = osim.GCVSplineSet(5, self._data_storage) + self.n_frame = self._data_storage.getSize() + + self.all_q, self.all_qdot, self.all_qddot = [], [], [] + for iframe in range(self.n_frame): + q, qdot, qddot = [], [], [] + for iq in range(self._data_storage.getStateVector(iframe).getSize()): + q.append( + self.gen_coord_function.evaluate( + iq, 0, self._data_storage.getStateVector(iframe).getTime() + ) + ) + qdot.append( + self.gen_coord_function.evaluate( + iq, 1, self._data_storage.getStateVector(iframe).getTime() + ) + ) + qddot.append( + self.gen_coord_function.evaluate( + iq, 2, self._data_storage.getStateVector(iframe).getTime() + ) + ) + + self.all_q.append(q) + self.all_qdot.append(qdot) + self.all_qddot.append(qddot) + + self.upd_model_kinematics(frame=0) + + def upd_model_kinematics(self, frame): + # get a fresh state + self.model.initStateWithoutRecreatingSystem(self.state) + self.state.setTime(self.get_time(frame)) + + # update kinematic states + self.actual_q = self.all_q[frame] + self.actual_qdot = self.all_qdot[frame] + self.actual_qddot = self.all_qddot[frame] + + self.state.setQ(osim.Vector(self.actual_q)) + self.state.setU(osim.Vector(self.actual_qdot)) + self.model.realizeVelocity(self.state) diff --git a/Bindings/Python/examples/StaticOptimization/static_optim/objective.py b/Bindings/Python/examples/StaticOptimization/static_optim/objective.py new file mode 100644 index 0000000000..1d1dcfa6f8 --- /dev/null +++ b/Bindings/Python/examples/StaticOptimization/static_optim/objective.py @@ -0,0 +1,38 @@ +""" +Objectives class. + +ObjMinimizeActivation minimizes the absolute activation raised at the activation_exponent (2 as default). +""" +import numpy as np +import opensim as osim + + +class ObjMinimizeActivation: + def __init__(self, activation_exponent=2): + self.activation_exponent = activation_exponent + self.muscles_actuators = self.model.getMuscles() + self.n_muscles = self.muscles_actuators.getSize() + + def objective(self, x): + """callback for calculating the objective.""" + return np.power(np.abs(x), self.activation_exponent).sum() + + def gradient(self, x): + """callback for calculating the gradient.""" + return self.activation_exponent * np.power( + np.abs(x), self.activation_exponent - 1 + ) + + def get_bounds(self): + forces = self.model.getForceSet() + activation = {"min": [], "max": []} + for i in range(forces.getSize()): + f = osim.CoordinateActuator.safeDownCast(forces.get(i)) + if f: + activation["min"].append(f.get_min_control()) + activation["max"].append(f.get_max_control()) + m = osim.Muscle.safeDownCast(forces.get(i)) + if m: + activation["min"].append(m.get_min_control()) + activation["max"].append(m.get_max_control()) + return activation["min"], activation["max"] diff --git a/Bindings/Python/examples/StaticOptimization/static_optimization_example.py b/Bindings/Python/examples/StaticOptimization/static_optimization_example.py new file mode 100644 index 0000000000..763ada415d --- /dev/null +++ b/Bindings/Python/examples/StaticOptimization/static_optimization_example.py @@ -0,0 +1,124 @@ +import os +import ipopt +import numpy as np + +from static_optim.dynamic_models import ClassicalStaticOptimization, ClassicalOptimizationLinearConstraints + +setup = { + "model": "data/arm26.osim", + "mot": "data/arm26_InverseKinematics.mot", + "filter_param": None, + "muscle_physiology": True, +} +show_results = False # Necessitate that pyomeca and matplotlib are installed on the computer + +# non-linear static optimization model +if os.path.isfile('data_non_linear_all.npy'): + # If possible load the data since non-linear is very slow + calc_non_linear = False + x0_non_linear_all = np.load('data_non_linear_all.npy') + info_non_linear = dict() + info_non_linear["obj_val"] = 0 + info_non_linear["g"] = 0 + +else: + calc_non_linear = True + x0_non_linear_all = [] + model_non_linear = ClassicalStaticOptimization(setup["model"], setup["mot"], setup["filter_param"]) + + # optimization options + activation_initial_guess_non_linear = np.zeros([model_non_linear.n_muscles]) + lb_non_linear, ub_non_linear = model_non_linear.get_bounds() + + # problem + problem_non_linear = ipopt.problem( + n=model_non_linear.n_muscles, # Nb of variables + lb=lb_non_linear, # Variables lower bounds + ub=ub_non_linear, # Variables upper bounds + m=model_non_linear.n_dof, # Nb of constraints + cl=np.zeros(model_non_linear.n_dof), # Lower bound constraints + cu=np.zeros(model_non_linear.n_dof), # Upper bound constraints + problem_obj=model_non_linear, # Class that defines the problem + ) + problem_non_linear.addOption("tol", 1e-7) + problem_non_linear.addOption("print_level", 0) + + +# linear static optimization model +model_linear = ClassicalOptimizationLinearConstraints( + setup["model"], + setup["mot"], + setup["filter_param"], + muscle_physiology=setup["muscle_physiology"], +) + +# optimization options +activation_initial_guess_linear = np.zeros([model_linear.n_muscles]) +lb_linear, ub_linear = model_linear.get_bounds() + +# problem +problem_linear = ipopt.problem( + n=model_linear.n_muscles, # Nb of variables + lb=lb_linear, # Variables lower bounds + ub=ub_linear, # Variables upper bounds + m=model_linear.n_dof, # Nb of constraints + cl=np.zeros(model_linear.n_dof), # Lower bound constraints + cu=np.zeros(model_linear.n_dof), # Upper bound constraints + problem_obj=model_linear, # Class that defines the problem +) +problem_linear.addOption("tol", 1e-7) +problem_linear.addOption("print_level", 0) + +# optimization +activations_non_linear = [] +activations_linear = [] +for iframe in range(0, int(model_linear.n_frame)): + print(f'frame: {iframe} | time: {model_linear.get_time(iframe)}') + + # Reference + if calc_non_linear: + model_non_linear.upd_model_kinematics(iframe) + try: + x_non_linear, info_non_linear = problem_non_linear.solve(activation_initial_guess_non_linear) + except RuntimeError: + print(f"Error while computing the frame #{iframe}") + x0_non_linear_all.append(x_non_linear) + else: + x_non_linear = x0_non_linear_all[iframe] + # the output is the initial guess for next frame + activation_initial_guess_non_linear = x_non_linear + activations_non_linear.append(x_non_linear) + print(f'x_non_linear = {x_non_linear}') + + # New optim + if hasattr(model_linear, 'previous_activation'): + model_linear.set_previous_activation(activation_initial_guess_linear) + model_linear.upd_model_kinematics(iframe) + try: + x_linear, info_linear = problem_linear.solve(activation_initial_guess_linear) + except RuntimeError: + print(f"Error while computing the frame #{iframe}") + + # the output is the initial guess for next frame + activation_initial_guess_linear = x_linear + activations_linear.append(x_linear) + print(f'x = {x_linear}') + print(f'Diff = {x_non_linear - x_linear}') + print('') + +# Save the non linear data +np.save('data_non_linear_all', x0_non_linear_all) + +# Show the data +if show_results: + import matplotlib.pyplot as plt + from pyomeca import Analogs3d + + data = { + "non_linear": Analogs3d(np.array(activations_non_linear)), + "linear": Analogs3d(np.array(activations_linear)) + } + ax = data["linear"].plot(fmt='') + data["non_linear"].plot(fmt='.', ax=ax) + (data["non_linear"] - data["linear"]).plot(fmt='') + plt.show() From 661761ab667e8b70e8e542cb3015e7949c0a723c Mon Sep 17 00:00:00 2001 From: pariterre Date: Tue, 22 Jan 2019 12:19:02 -0500 Subject: [PATCH 7/8] Updated CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index be61fe5b12..19fd8e33d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -216,6 +216,7 @@ Python interface - Improved error handling. Now, OpenSim's error messages show up as exceptions in Python. - The Python bindings can now be built for Python 3 (as well as Python 2). +- Added an example of Static optimization performed in Python 3. Other Changes ------------- From 1bd46f2a3a5e94405c499c32b38f0c055d3af89e Mon Sep 17 00:00:00 2001 From: Pariterre Date: Fri, 22 Mar 2019 13:46:18 -0400 Subject: [PATCH 8/8] Moved initStateWithoutRecreatingSystem Moved initStateWithoutRecreatingSystem where it is called only once --- .../examples/StaticOptimization/static_optim/kinematic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bindings/Python/examples/StaticOptimization/static_optim/kinematic.py b/Bindings/Python/examples/StaticOptimization/static_optim/kinematic.py index 7e76a1614c..00493f5f88 100644 --- a/Bindings/Python/examples/StaticOptimization/static_optim/kinematic.py +++ b/Bindings/Python/examples/StaticOptimization/static_optim/kinematic.py @@ -67,11 +67,11 @@ def __dispatch_kinematics(self): self.all_qdot.append(qdot) self.all_qddot.append(qddot) + self.model.initStateWithoutRecreatingSystem(self.state) self.upd_model_kinematics(frame=0) def upd_model_kinematics(self, frame): # get a fresh state - self.model.initStateWithoutRecreatingSystem(self.state) self.state.setTime(self.get_time(frame)) # update kinematic states