Page 1 of 1

Joint lock constraint is ignored when calculating ResidualForce?

Posted: Tue May 28, 2019 10:17 am
by jp123909
Hi all

I am trying to conduct the static inverse dynamics to calculate the coordinate forces given the vector Q.
I found that the residual force of the locked coordinate is not zero.
Does this value mean the force that is needed to apply for satisfy the lock constraint?

I also can't totally understand the difference between model.getMatterSubsystem().calcResidualForce
and model.getMatterSubsystem().calcResidualForceIgnoringConstraints.
When using the former one, coordinate lock constraint is considered?

Thank you in advance

Re: Joint lock constraint is ignored when calculating ResidualForce?

Posted: Wed May 29, 2019 6:19 pm
by sherm
Hi, Jiang. I can answer part of your question:

The difference between calcResidualForce() and calcResidualForceIgnoringConstraints() is just whether the method allows you to specify the constraint multipliers lambda. Neither method generates internal constraint forces and both methods ignore prescribed motion.

A separate question is how OpenSim models locked joints. They can be modeled either with constraints or with prescribed motion and I don't know which. Does someone else know the answer?

Regards,
Sherm

Re: Joint lock constraint is ignored when calculating ResidualForce?

Posted: Thu May 30, 2019 4:15 am
by mitkof6
The internal implementation of OpenSim used the SimTK::Constraint::PrescribedMotion constraint to enforce coordinate locking:

https://github.com/opensim-org/opensim- ... e.cpp#L184
https://simbody.github.io/simbody-3.6-d ... ml#details

Re: Joint lock constraint is ignored when calculating ResidualForce?

Posted: Thu May 30, 2019 8:13 am
by sherm
Great, thanks Dimitar!

So calculating residual forces using Simbody's calcResidualForce() method does not include forces needed to lock joints unless you supply them yourself through the lambda parameter to that method.

Re: Joint lock constraint is ignored when calculating ResidualForce?

Posted: Thu May 30, 2019 9:53 am
by jp123909
Hi, Sherman and Dimitar

Thank you very much for your reply.
Now I understand that I may need an additional actuator to lock the joints.
I think it would be better to clarify this point in the OpenSim user guidance, which will help people who are dealing with inverse dynamics problem (e.g., calculating the joint torque).

Re: Joint lock constraint is ignored when calculating ResidualForce?

Posted: Thu May 30, 2019 1:24 pm
by aseth
You do not need additional actuators to lock a joint. You either a.) care about the coordinate force necessary to enforce the lock (that is what ID provides now) or b.) you don't, in which case can simply ignore what ID computes. Adding an actuator to enforce the lock (to result in zero residual) would only mean they would have apply the coordinate force currently being computed for you (i.e. the residual). How would you compute that coordinate force? ID? Apologies if I am missing the purpose here.