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

Conversation

aymanhab
Copy link
Member

@aymanhab aymanhab commented Dec 19, 2023

…e getCoordinateNamesInMultibodyTreeOrder for scripting users

Fixes issue #0

Brief summary of changes

Using SimTK::ReferencePtr across binding was problematic due to methods optimized out. Adding a method to return names of coordinates instead to sidestep the memory management issue across the binding interface.

Testing I've completed

Looking for feedback on...

CHANGELOG.md (choose one)

  • updated

This change is Reviewable

…e getCoordinateNamesInMultibodyTreeOrder for scripting users
@aymanhab aymanhab requested a review from nickbianco December 19, 2023 22:54
Copy link
Member

@nickbianco nickbianco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, just two minor suggestions.

CHANGELOG.md Outdated
@@ -25,7 +25,7 @@ and `Blankevoort1991Ligament`, usages of `get_GeometryPath`, `upd_GeometryPath`,
- Deleting elements from an `OpenSim::Coordinate` range now throws an exception during `finalizeFromProperties` (previously:
it would let you do it, and throw later when `Coordinate::getMinRange()` or `Coordinate::getMaxRange()` were called, #3532)
- Added `FunctionBasedPath`, a class for representing paths in `Force`s based on `Function` objects (#3389)
- Fixed bindings to expose the method Model::getCoordinatesInMultibodyTreeOrder to scripting users (#3569)
- Fixed bindings to expose the method Model::getCoordinateNamesInMultibodyTreeOrder to scripting users (#3569)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but you've added a new method, so you could state that here and highlight that is scripting friendly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -131,6 +131,8 @@ void testAssembleModelWithConstraints(string modelFile)
for(int i=0; i< coords.getSize(); i++) {
cout << "Coordinate " << coords[i].getName() << " get value = " << coords[i].getValue(state) << endl;
}
auto coordsInOrder = model.getCoordinateNamesInMultibodyTreeOrder();
cout << coordsInOrder << std::endl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a simple check that coordsInOrder has the same size as the CoordinateSet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

@nickbianco nickbianco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Reviewed 1 of 3 files at r1, 2 of 3 files at r3, 2 of 2 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @aymanhab)

Copy link
Member

@nickbianco nickbianco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @aymanhab)

@aymanhab
Copy link
Member Author

Thanks @nickbianco

@aymanhab aymanhab merged commit c0732c5 into main Dec 20, 2023
6 checks passed
aymanhab added a commit that referenced this pull request Jan 10, 2024
#3656)

* Undo binding of model getCoordinatesInMultibodyTreeOrder and introduce getCoordinateNamesInMultibodyTreeOrder for scripting users

* Fix dereferencing the ReferencePtr and exercise in test case

* Fix compilation warnings/errors on linux and call site to index the SimTKArray

* Fix int/size_t mixup that causes compilation errors on linux

* Update CHANGELOG.md

Use updated function name

* Address feedback on PR in test, changelog language
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants