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

Update MocoTrajectory::generateSpeedsFromValues() to not override auxiliary states #3603

Merged
merged 3 commits into from
Nov 14, 2023

Conversation

nickbianco
Copy link
Member

@nickbianco nickbianco commented Nov 8, 2023

Fixes issue #3477

Brief summary of changes

This PR updates the logic in MocoTrajectory::generateSpeedsFromValues() so that any auxiliary (e.g., muscle-related) states do not get overridden. I've added some accessors to MocoTrajectory to make this fix more convenient, but these are nice additions beyond this fix.

Testing I've completed

  • Added test to testMocoInterface.cpp

Looking for feedback on...

CHANGELOG.md (choose one)

  • updated.

This change is Reviewable

@nickbianco nickbianco requested review from aymanhab and removed request for carmichaelong November 13, 2023 21:34
Copy link
Member

@aymanhab aymanhab left a comment

Choose a reason for hiding this comment

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

LGTM, other than naming conventions that I was a little unclear on, if used widely elsewhere then you can ignore

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @nickbianco)


OpenSim/Moco/MocoTrajectory.h line 476 at r1 (raw file):

    int getNumSpeeds() const {
        ensureUnsealed();
        return (int)getSpeedIndices().size();

Not sure about the ensureUnsealed call having any side-effects, but if not then ignore


OpenSim/Moco/MocoTrajectory.h line 485 at r1 (raw file):

    int getNumAuxiliaryStates() const {
        ensureUnsealed();

Naming: in the past auxiliary states were used to imply muscle states and that was confusing, if this is used to mean something else across the board in Moco world then ignore


OpenSim/Moco/MocoTrajectory.h line 551 at r1 (raw file):

                multibodyStateNames.push_back(name);
            }
        }

Is the implication that /value, /speed are used exclusively for multibody states?

Copy link
Member Author

@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.

Thanks @aymanhab! Let me know if my responses are sufficient, or if you'd like any changes.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @aymanhab)


OpenSim/Moco/MocoTrajectory.h line 476 at r1 (raw file):

Previously, aymanhab (Ayman Habib) wrote…

Not sure about the ensureUnsealed call having any side-effects, but if not then ignore

If the trajectory is sealed, you shouldn't be able to access anything. This call was missing from this method.


OpenSim/Moco/MocoTrajectory.h line 485 at r1 (raw file):

Previously, aymanhab (Ayman Habib) wrote…

Naming: in the past auxiliary states were used to imply muscle states and that was confusing, if this is used to mean something else across the board in Moco world then ignore

Here, auxiliary states is referring to any state that is not a multibody state, including the muscle states but not limited to them. I believe "auxiliary" is the term Simbody uses for the non-multibody states.


OpenSim/Moco/MocoTrajectory.h line 551 at r1 (raw file):

Previously, aymanhab (Ayman Habib) wrote…

Is the implication that /value, /speed are used exclusively for multibody states?

Yes, but I'm not sure if that's explicitly enforced anywhere. /value and /speed are baked in the code in many other places, so this assumption is mostly safe for now. If we wanted to allow non-multibody state names ending in '/value' or '/speed' we would need more comprehensive changes.

Copy link
Member

@aymanhab aymanhab left a comment

Choose a reason for hiding this comment

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

:lgtm:

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

@aymanhab aymanhab merged commit 449dab6 into main Nov 14, 2023
6 checks passed
@aymanhab aymanhab deleted the moco_trajectory_generate_fix branch November 14, 2023 19:39
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.

3 participants