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

Undo binding of model getCoordinatesInMultibodyTreeOrder and introduc… #3656

Merged
merged 6 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
5 changes: 5 additions & 0 deletions Bindings/Python/tests/test_simbody.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ def test_SimbodyMatterSubsystem(self):
assert (smss.calcSystemMassCenterLocationInGround(s)[2] ==
model.calcMassCenterPosition(s)[2])

coordNames = model.getCoordinateNamesInMultibodyTreeOrder();
print('firstCoord', coordNames.get(0));

J = osim.Matrix()
smss.calcSystemJacobian(s, J)
# 6 * number of mobilized bodies
Expand Down Expand Up @@ -248,3 +251,5 @@ def test_SimbodyMatterSubsystem(self):
assert residual.size() == s.getNU()
for i in range(residual.size()):
assert abs(residual[i]) < 1e-10


3 changes: 0 additions & 3 deletions Bindings/simulation.i
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ OpenSim::ModelComponentSet<OpenSim::Controller>;
%include <OpenSim/Simulation/Model/ModelVisualPreferences.h>
%include <OpenSim/Simulation/Model/ModelVisualizer.h>
%copyctor OpenSim::Model;
%include <SimTKcommon/internal/ReferencePtr.h>
%template(ReferencePtrCoordinate) SimTK::ReferencePtr<const OpenSim::Coordinate>;
%template(StdVectorReferencePtrCoordinate) std::vector<SimTK::ReferencePtr<const OpenSim::Coordinate>>;
%include <OpenSim/Simulation/Model/Model.h>

%include <OpenSim/Simulation/Model/AbstractPathPoint.h>
Expand Down
8 changes: 8 additions & 0 deletions OpenSim/Simulation/Model/Model.h
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,14 @@ OpenSim_OBJECT_NONTEMPLATE_DEFS(Model, ModelComponent);
std::vector<SimTK::ReferencePtr<const OpenSim::Coordinate>>
getCoordinatesInMultibodyTreeOrder() const;

/** A variant of getCoordinatesInMultibodyTreeOrder that returns names for Scripting users */
SimTK::Array_<std::string> getCoordinateNamesInMultibodyTreeOrder() {
SimTK::Array_<std::string> namesArray;
aymanhab marked this conversation as resolved.
Show resolved Hide resolved
auto coords = getCoordinatesInMultibodyTreeOrder();
for (auto coord : coords)
namesArray.push_back(coord->getName());
return namesArray;
}
/** Get a warning message if any Coordinates have a MotionType that is NOT
consistent with its previous user-specified value that existed in
Model files prior to OpenSim 4.0 */
Expand Down
Loading