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
Making arms parallel to the ground
- Nicholas Bianco
- Posts: 1041
- Joined: Thu Oct 04, 2012 8:09 pm
Re: Making arms parallel to the ground
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
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
- Ross Miller
- Posts: 375
- Joined: Tue Sep 22, 2009 2:02 pm
Re: Making arms parallel to the ground
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):
There's another setting that can be used:
but I didn't get good results with it.
Ross
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);
Code: Select all
solver.set_lagrange_multiplier_weight(weight_goes_here);
Ross
- Nicholas Bianco
- Posts: 1041
- Joined: Thu Oct 04, 2012 8:09 pm
Re: Making arms parallel to the ground
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.
That being said, OpenSim doesn't yet support a kinematic constraint to enforce a particular orientation.