Page 2 of 3

Re: MocoOrientationTrackingGoal

Posted: Tue Sep 15, 2020 4:16 am
by aafox
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

Re: MocoOrientationTrackingGoal

Posted: Tue Sep 15, 2020 8:52 am
by nbianco
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.

Re: MocoOrientationTrackingGoal

Posted: Wed Sep 16, 2020 7:58 am
by rosshm
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

Re: MocoOrientationTrackingGoal

Posted: Wed Sep 16, 2020 9:31 am
by nbianco
Good point, Ross.

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

Re: MocoOrientationTrackingGoal

Posted: Thu Sep 17, 2020 6:15 am
by karthick_ganesan
Hi Nick,
Do you mean MocoAccelerationTrackingGoal?. The documentation says it is for linear accelerations.
Thanks,
Karthick

Re: MocoOrientationTrackingGoal

Posted: Thu Sep 17, 2020 12:04 pm
by nbianco
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.

Re: MocoOrientationTrackingGoal

Posted: Sat Sep 19, 2020 8:52 am
by karthick_ganesan
That 's great. I am interested in minimizing generalized accelerations.
Is it available in any of the 0.5 build?
Thanks.

Re: MocoOrientationTrackingGoal

Posted: Mon Sep 21, 2020 11:29 am
by nbianco
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.

Re: MocoOrientationTrackingGoal

Posted: Mon Sep 21, 2020 11:41 pm
by karthick_ganesan
Thanks Nick. I have tried it . But I could not get good convergence with implicit multibody dynamics.
Regards,
Karthick.

Re: MocoOrientationTrackingGoal

Posted: Tue Sep 22, 2020 9:17 am
by nbianco
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.