Page 1 of 1

Making arms parallel to the ground

Posted: Tue Apr 23, 2024 3:00 am
by hojin95
Hello MOCO experts!

I'm trying to simulate a squat while we make arms straight parallel to the ground throughout the movement. I was thinking of using MocoOutputConstraint to constrain a point on a hand's rotations in three axes (while elbows and wrists are fixed to straight), but I remember that in older post of mine, Moco doesn't support SimTK::Rotation type outputs in MocoOutputConstraint. I would like to ask whether we are able to use rotation outputs in Moco's path constraints now?

If not, I'd be grateful if I can hear an alternate option to achieve the same goal. The image below is an illustration of what I would like to achieve. Thank you :D
arm_straight.png
arm_straight.png (110.2 KiB) Viewed 2049 times

Re: Making arms parallel to the ground

Posted: Tue Apr 23, 2024 9:52 am
by nbianco
Hi Hojin,

You could use MocoOrientationTrackingGoal to track a constant parallel orientation between the arms and the ground. You can provide reference tracking data via a table of SimTK::Rotation or SimTK::Quaternion values, or a StatesTrajectory representing a model pose with the arms in the orientation you desire.

-Nick

Re: Making arms parallel to the ground

Posted: Wed Apr 24, 2024 11:28 am
by rosshm
Hi Hojin,

I've used the Goal Nick mentioned to minimize the deviations of the torso in global frame, it worked well. You could try that Goal with a high weight and see if it makes the deviations of the arms small enough for your purpose.

If you want the deviations to be literally zero, I think you'd have to use kinematic constraints in the .osim model itself, similar to what is done to define patella motions as prescribed functions of the knee angle. To get the arms to be always parallel to the ground, the kinematic constraint would have to make the shoulder angles functions of both the pelvis and lumbar angles (assuming pelvis is your model's "base" segment) and I'm not sure if that's possible, the patella is the only example of kinematic constraints I'm familiar with in OpenSim models and it's only a function of a single coordinate in the model.

I've run many Moco simulations with the kinematic constraints of the patellas in the problem and it works fine. It's been a while since I troubleshot this part of the model, but I use the following solver settings that I think tell Moco to pay attention to this constraint (maybe Nick can confirm; I searched but couldn't find the old thread on this):

Code: Select all

solver.set_enforce_constraint_derivatives(true);
solver.set_enforce_path_constraint_midpoints(true);
There's another setting that can be used:

Code: Select all

solver.set_lagrange_multiplier_weight(weight_goes_here);
but I didn't get good results with it.

Ross

Re: Making arms parallel to the ground

Posted: Wed Apr 24, 2024 1:45 pm
by nbianco
Enforcing constraint derivatives is true by default, and you should only need to enforce path constraints at midpoints in special cases (e.g., enforcing a MocoControlBoundConstraint in MocoInverse).

That being said, OpenSim doesn't yet support a kinematic constraint to enforce a particular orientation.