Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NMSM Pipeline contact elements for use in Moco #3877

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2063d6f
MeyerFregly2016Muscle
SpencerTWilliams Jul 5, 2024
0a5110e
Contact element
SpencerTWilliams Jul 5, 2024
ce52f67
Actuator test
SpencerTWilliams Jul 5, 2024
bac8757
Update StationPlaneContactForce.h
SpencerTWilliams Jul 5, 2024
78dea72
Simplify actuator test
SpencerTWilliams Jul 5, 2024
355066c
Clean comments and integral function
SpencerTWilliams Aug 16, 2024
83edd24
Revert "Simplify actuator test"
SpencerTWilliams Aug 16, 2024
5b99764
Revert "Actuator test"
SpencerTWilliams Aug 16, 2024
75c00e7
Update CHANGELOG.md
SpencerTWilliams Aug 16, 2024
87aeb0a
Merge branch 'main' into main
nickbianco Aug 19, 2024
6cd3549
Merge branch 'main' into main
nickbianco Aug 20, 2024
2c49c57
Force documentation and suggestions
SpencerTWilliams Sep 6, 2024
e113ed4
Merge branch 'main' into main
nickbianco Sep 6, 2024
86ec6cd
Remove MeyerFregly2016Muscle from branch
SpencerTWilliams Sep 16, 2024
6f165d1
Remove potential discontinuity
SpencerTWilliams Sep 16, 2024
51a4827
Update CHANGELOG.md
SpencerTWilliams Sep 16, 2024
e4cc026
Fix comments
SpencerTWilliams Sep 23, 2024
5a18a15
Update contact force documentation
SpencerTWilliams Sep 23, 2024
869ada9
Move StationPlaneContactForce
SpencerTWilliams Sep 23, 2024
8251a91
Move AckermannVanDenBogert2010Force
SpencerTWilliams Sep 23, 2024
7c80a3f
Update class documentation
SpencerTWilliams Sep 26, 2024
72d39e0
Enable MeyerFregly2016Force in template
SpencerTWilliams Sep 26, 2024
8dcb999
Add spring resting length
SpencerTWilliams Sep 26, 2024
cd46b4d
Resting length in properties
SpencerTWilliams Sep 26, 2024
a07c257
Known kinematics test
SpencerTWilliams Sep 26, 2024
5dd1ae5
Fix typo
SpencerTWilliams Sep 27, 2024
09e11f9
Add kinematics test case for MeyerFregly2016Force
SpencerTWilliams Sep 27, 2024
f30a8c9
Update CMakeLists.txt
SpencerTWilliams Oct 9, 2024
5a26b49
Merge branch 'main' into main
nickbianco Oct 16, 2024
a605a24
Merge branch 'main' into main
nickbianco Oct 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ v4.6
- Fixed an issue where a copy of an `OpenSim::Model` containing a `OpenSim::ExternalLoads` could not be
finalized (#3926)
- Updated all code examples to use c++14 (#3929)
- Completed the implementation of the `MeyerFregly2016Force` included in the `StationPlaneContactForce` class to support NMSM Pipeline-equivalent contact models in Moco. (#3877)


v4.5.1
======
Expand Down Expand Up @@ -94,6 +96,7 @@ pointer to avoid crashes in scripting due to invalid pointer ownership (#3781).
- Improved exception handling for internal errors in `MocoCasADiSolver`. Problems will now abort and print a descriptive error message (rather than fail due to an empty trajectory). (#3834)
- Upgraded the Ipopt dependency Metis to version 5.1.0 on Unix and macOS to enable building on `osx-arm64` (#3874).


v4.5
====
- Added `AbstractGeometryPath` which is a base class for `GeometryPath` and other path types (#3388). All path-based
Expand Down
2 changes: 0 additions & 2 deletions OpenSim/Moco/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ set(MOCO_SOURCES
MocoFrameDistanceConstraint.cpp
MocoOutputConstraint.h
MocoOutputConstraint.cpp
Components/StationPlaneContactForce.h
Components/StationPlaneContactForce.cpp
Components/DiscreteForces.h
Components/DiscreteForces.cpp
Components/AccelerationMotion.h
Expand Down
32 changes: 30 additions & 2 deletions OpenSim/Moco/Test/testMocoContact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,29 @@ void testFrictionForce(const SimTK::Real& equilibriumHeight) {
}
}

// Test that the contact model produces the expected force output for a given
// set of input kinematics and default parameters.
void testKnownKinematics() {
Model modelTemp = create2DPointMassModel<MeyerFregly2016Force>();
modelTemp.finalizeConnections();
Model model(modelTemp);
model.finalizeConnections();

SimTK::State state = model.initSystem();
model.setStateVariableValue(state, "ty/ty/value", -0.005);
model.setStateVariableValue(state, "ty/ty/speed", -0.01);
model.setStateVariableValue(state, "tx/tx/speed", 0.03);
model.setStateVariableValue(state, "tz/tz/speed", 0.02);

auto& contact = model.template getComponent<StationPlaneContactForce>("contact");
model.realizeVelocity(state);
const Vec3 contactForce = contact.calcContactForceOnStation(state);

CHECK(contactForce[0] == Approx(-5.9842).margin(1e-3));
CHECK(contactForce[1] == Approx(40.0051).margin(1e-3));
CHECK(contactForce[2] == Approx(-3.9894).margin(1e-3));
}

template<typename T>
void testStationPlaneContactForce() {
const SimTK::Real equilibriumHeight = testNormalForce<T>();
Expand Down Expand Up @@ -515,8 +538,8 @@ void testSmoothSphereHalfSpaceForce_FrictionForce(
}

TEMPLATE_TEST_CASE("testStationPlaneContactForce", "[tropter]",
AckermannVanDenBogert2010Force, EspositoMiller2018Force
/* TODO MeyerFregly2016Force */) {
AckermannVanDenBogert2010Force, EspositoMiller2018Force,
MeyerFregly2016Force) {
testStationPlaneContactForce<TestType>();
}

Expand Down Expand Up @@ -618,6 +641,11 @@ TEST_CASE("MocoContactTrackingGoal", "[casadi]") {
0.5);
}


TEST_CASE("testMeyerFregly2016ForceValues", "[casadi]") {
testKnownKinematics();
}

// This is a round-trip test. First, use createExternalLoadsTableForGait() to
// create a table of external loads based on a simulation with foot-ground
// contact force elements. Then, use the external loads to apply forces to the
Expand Down
Loading
Loading