-
Notifications
You must be signed in to change notification settings - Fork 322
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
PolynomialPathFitter
and other utilities for FunctionBasedPath
#3581
Changes from 51 commits
4514fba
fd5ec86
e700333
4b48e74
21b44d1
2ad259f
8a714ab
60ffecc
307a321
78335de
f23a75c
9b44256
5c7d505
2991448
d4376b3
57ebe85
9450572
c4f329e
a336259
d90672e
9916560
84f16ae
ac3aaca
8a5ed38
7fe2852
d16a2ba
579f18f
3660f8c
149b18e
f01cbd7
fc4adca
8715ab9
447def1
43d0ddc
1add512
088237d
5026d6c
f2726c0
f57f844
ded4fea
ebac89b
779fc62
3f83539
82cab02
4c52fc8
aaead77
74ab617
2e4b7e5
fd01001
2d1a6fe
27a3c4d
5ed1300
21454e1
d9fd62f
4b9c643
1f55352
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -309,3 +309,26 @@ void ModelFactory::createReserveActuators(Model& model, double optimalForce, | |
} | ||
} | ||
|
||
void ModelFactory::replacePathsWithFunctionBasedPaths(Model& model, | ||
const Set<FunctionBasedPath>& functionBasedPaths) { | ||
for (int i = 0; i < functionBasedPaths.getSize(); ++i) { | ||
auto path = functionBasedPaths.get(i); | ||
|
||
// Get the force component associated with this path. | ||
OPENSIM_THROW_IF(!model.hasComponent<Force>(path.getName()), | ||
Exception, "Model does not contain a Force at path {}.", | ||
path.getName()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This Throw is already performed at |
||
auto& force = model.updComponent<Force>(path.getName()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems odd that the name of the FunctionBasedPath is equal to the path of a component in a model. Is there a reason for this? |
||
|
||
// Check that the force has a path property. | ||
OPENSIM_THROW_IF( | ||
!force.hasProperty("path"), Exception, | ||
"Force {} does not have a path property.", path.getName()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This throw does add new info, but does not use the throw from |
||
|
||
// Update the path. | ||
path.setName(fmt::format("{}_path", force.getName())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "path" to a PathActuator as the name of a FunctionBasedPath's name, postfixed with |
||
force.updPropertyByName<AbstractPath>("path").setValue(path); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use try here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this name never change? Since "path" seems to be pretty ambiguous, someone might change the name of the property "path". |
||
} | ||
model.finalizeFromProperties(); | ||
model.finalizeConnections(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The different meanings of "path" becomes confusing in this function...