MocoOrientationTrackingGoal

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
User avatar
Aaron Fox
Posts: 271
Joined: Sun Aug 06, 2017 10:54 pm

Re: MocoOrientationTrackingGoal

Post by Aaron Fox » Tue Sep 15, 2020 4:16 am

Thanks Nick. As usual a fairly easy solution! I'll let you know once I go back to this approach how it pans out. I did have an extra broader query on this - is there a way you could explain how to construct the 3x3 rotation matrix for different scenarios? I was simply doing zero rotation for a body (i.e. neutral) so it was easy enough to fill with zeros, but let's say I wanted to do a 45 degree rotation about the X-axis - are there some simple ways or tools within OpenSim that will assist with constructing the values?

The WeldJoint model operator is a helpful tip - I was going back and forth locking and unlocking coordinates! I assume this is really only applicable to when completely locking a joint? I'm doing some analyses going from a 3D to 2D hip joint (i.e. removing adduction and rotation), and this operator doesn't seem to work that way (i.e. coordinate specific), correct? My work-around here was to just re-define and replace the joint anyway.

Aaron

User avatar
Nicholas Bianco
Posts: 963
Joined: Thu Oct 04, 2012 8:09 pm

Re: MocoOrientationTrackingGoal

Post by Nicholas Bianco » Tue Sep 15, 2020 8:52 am

You could use a model coordinate to rotate a body (assuming the coordinate rotates the body in the correct direction) and then compute the rotation matrix between the two bodies using the API.

You're correct that welding a joint is limited, in that all coordinates associated with that joint are now fixed. Redefining the joint as you say is the way to go.

User avatar
Ross Miller
Posts: 371
Joined: Tue Sep 22, 2009 2:02 pm

Re: MocoOrientationTrackingGoal

Post by Ross Miller » Wed Sep 16, 2020 7:58 am

I was at one point doing a similar thing to what Aaron described I think, I did it with MocoTrack and just set all the pelvis angles to zero in the tracking targets data. This is unique to the pelvis since its the "base" segment of the whole model and its pose in the global frame is defined directly by state variables, but it seemed like a easy/straightforward approach.

Ross

User avatar
Nicholas Bianco
Posts: 963
Joined: Thu Oct 04, 2012 8:09 pm

Re: MocoOrientationTrackingGoal

Post by Nicholas Bianco » Wed Sep 16, 2020 9:31 am

Good point, Ross.

Another option could be use the MocoAccelerationGoal to minimize pelvis rotational accelerations.

User avatar
Karthick Ganesan
Posts: 118
Joined: Thu Oct 10, 2013 12:11 am

Re: MocoOrientationTrackingGoal

Post by Karthick Ganesan » Thu Sep 17, 2020 6:15 am

Hi Nick,
Do you mean MocoAccelerationTrackingGoal?. The documentation says it is for linear accelerations.
Thanks,
Karthick

User avatar
Nicholas Bianco
Posts: 963
Joined: Thu Oct 04, 2012 8:09 pm

Re: MocoOrientationTrackingGoal

Post by Nicholas Bianco » Thu Sep 17, 2020 12:04 pm

Ah, ignore my previous post.

I was referring to a different goal than MocoAccelerationTrackingGoal. MocoAccelerationGoal would allow you to minimize generalized accelerations directly, but it doesn't exist in an official release yet.

Using MocoAccelerationTrackingGoal to track zero (linear, body) accelerations is the best way to go for now.

User avatar
Karthick Ganesan
Posts: 118
Joined: Thu Oct 10, 2013 12:11 am

Re: MocoOrientationTrackingGoal

Post by Karthick Ganesan » Sat Sep 19, 2020 8:52 am

That 's great. I am interested in minimizing generalized accelerations.
Is it available in any of the 0.5 build?
Thanks.

User avatar
Nicholas Bianco
Posts: 963
Joined: Thu Oct 04, 2012 8:09 pm

Re: MocoOrientationTrackingGoal

Post by Nicholas Bianco » Mon Sep 21, 2020 11:29 am

You can minimize generalized accelerations if using implicit multibody dynamics with MocoCasADiSolver. Use the property 'minimize_implicit_multibody_accelerations' and 'implicit_multibody_accelerations_weight' to enable minimizing generalized accelerations (which are controls in the implicit problem formulation) and set the cost weight, respectively. You currently cannot set weights for individual generalized accelerations.

User avatar
Karthick Ganesan
Posts: 118
Joined: Thu Oct 10, 2013 12:11 am

Re: MocoOrientationTrackingGoal

Post by Karthick Ganesan » Mon Sep 21, 2020 11:41 pm

Thanks Nick. I have tried it . But I could not get good convergence with implicit multibody dynamics.
Regards,
Karthick.

User avatar
Nicholas Bianco
Posts: 963
Joined: Thu Oct 04, 2012 8:09 pm

Re: MocoOrientationTrackingGoal

Post by Nicholas Bianco » Tue Sep 22, 2020 9:17 am

Karthick, maybe you could provide more context about the problem you were trying to solve? Typically we see better convergence with implicit dynamics, especially when minimizing (regulating) the acceleration controls.

POST REPLY