Difference joint vs constraint

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Pagnon David
Posts: 86
Joined: Mon Jan 06, 2014 3:13 am

Difference joint vs constraint

Post by Pagnon David » Tue Nov 22, 2022 4:09 pm

Hello,
I'm a little confused with OpenSim constraints, and I can't find an answer anywhere:
- Does OpenSim handle soft constraints?
- If not, what is the difference between a joint and a hard constraint? More specifically, between a weld joint and a weld constraint, or a point constraint and a ball joint?
- When should I use one over the other, and why? (I'm only concerned with kinematics in my case)
Thanks!

Reference: https://simtk-confluence.stanford.edu:8 ... Sim+Models

User avatar
Pagnon David
Posts: 86
Joined: Mon Jan 06, 2014 3:13 am

Re: Difference joint vs constraint

Post by Pagnon David » Wed Nov 23, 2022 6:06 am

Subsidiary question: Is it possible to assign weights to constraints, in the inverse kinematics tool for example?
I might be missing something, but I feel like it could make a hard constraint become soft?

User avatar
Thomas Uchida
Posts: 1798
Joined: Wed May 16, 2012 11:40 am

Re: Difference joint vs constraint

Post by Thomas Uchida » Wed Nov 23, 2022 7:27 am

Please see the Simbody Theory Manual (SimbodyTheoryManual.pdf): https://github.com/simbody/simbody/tree ... imbody/doc. A joint permits relative motion between bodies; a constraint prohibits some or all motion between bodies. Constraints are sometimes used to "break" kinematic loops. Some examples of "soft" constraints in OpenSim are the CoordinateLimitForce (https://simtk.org/api_docs/opensim/api_ ... ml#details) and the BushingForce (https://simtk.org/api_docs/opensim/api_ ... ml#details).

User avatar
Michael Sherman
Posts: 812
Joined: Fri Apr 01, 2005 6:05 pm

Re: Difference joint vs constraint

Post by Michael Sherman » Wed Nov 23, 2022 12:01 pm

Tom beat me to answering and gave a better answer than I would have! (Hi, Tom)

To elaborate a little -- in your example of a Weld joint vs. Weld constraint:
Say we weld body A to body B. With a weld joint, A and B essentially become the same body, with B attached exactly as specified by the joint. There are no additional degrees of freedom and no constraint equations added to the system by the introduction of body B. In contrast, using a weld constraint, A and B are still separate bodies each with their own mobility (could have as many as 6 dofs each). The weld constraint introduces 6 algebraic equations each restricting one of the possible relative motions between A and B. The equations of motion (in terms of body dofs) must be solved such that the constraint equations are satisfied simultaneously (to a tolerance).

Soft connections like the Bushing Tom mentioned are not actually implemented via constraints, but are force elements whose force contributions can be individually determined just from the current state.

Regards,
Sherm

User avatar
Pagnon David
Posts: 86
Joined: Mon Jan 06, 2014 3:13 am

Re: Difference joint vs constraint

Post by Pagnon David » Thu Nov 24, 2022 9:13 am

Thank you both! It is clearer now.

I had come across BushingForce, but not CoordinateLimitForce. I have not tested any of them, I guess it is going to be my next step! I can't find any mention of either of them in the Simbody manual, though.
Also, I am curious: to my knowledge kinematics does not consider forces. Will they still be taken into account for IK? Are they a kind of coupling, rather than a proper force then?

Michael, you say that
the constraint equations are satisfied simultaneously (to a tolerance).
What o you mean, by a tolerance?

Thanks !

User avatar
Michael Sherman
Posts: 812
Joined: Fri Apr 01, 2005 6:05 pm

Re: Difference joint vs constraint

Post by Michael Sherman » Thu Nov 24, 2022 10:29 am

You are correct that kinematics doesn't consider forces so the force elements don't affect IK. IK always respects joints and should satisfy constraints also.

"To a tolerance" means that (unlike joints) constraints won't be satisfied perfectly (that is, to machine precision). Instead there will be some small residual error in the constraints, typically something like 10^-4 length units. The maximum allowable error (user settable, typically) is called the "tolerance".

Sherm

User avatar
Pagnon David
Posts: 86
Joined: Mon Jan 06, 2014 3:13 am

Re: Difference joint vs constraint

Post by Pagnon David » Thu Nov 24, 2022 11:01 am

Okay, thank you for clarifying.

Just to make it sure, using bushingforce or coordinatelimitforce won't be useful for closed-loop inverse kinematics?
To be more specific, lets say I want to constrain a bike to a cyclist, but IK fails when I use the standard weld or point constraints. I would like to release them a little, or to use something different. In this case, these two elements cannot help?

I do appreciate the time you are taking to help :)

User avatar
Michael Sherman
Posts: 812
Joined: Fri Apr 01, 2005 6:05 pm

Re: Difference joint vs constraint

Post by Michael Sherman » Thu Nov 24, 2022 11:42 am

I'm not familiar with OpenSim's IK interface so this is just Thanksgiving speculation in case no one else is available:
- assuming there is a way to loosen the tolerance, you may find you can solve the problem using joints and constraints with a little more slop allowed
- you may have a problem with your geometry where there actually isn't an exact solution; in that case if loosening tolerance isn't enough you might need to refine your geometry

Right, forces are not consider during IK. If you want to solve with forces in place, consider static analysis (looks for an equilibrium solution).

Hopefully someone more knowledgeable will answer soon!

Regards,
Sherm

User avatar
Pagnon David
Posts: 86
Joined: Mon Jan 06, 2014 3:13 am

Re: Difference joint vs constraint

Post by Pagnon David » Mon Nov 28, 2022 11:52 am

Thank you!
So, if I sum it up:
- I don't think there is any way to loosen the tolerance of constraints (I could be wrong), nor to implement soft constraints
- I can't use force elements for inverse kinematics (unless I first conduct a static analysis, and then I refine geometry in order to minimize the forces where I reattached the broken loop, is that it?)

But
- I can probably design and/or scale my model better, to make sure that no geometry incompatibilities are met.

Other consideration: Would other inverse kinematics algorithm work better? I am not totally clear on it, but how does Global optimization compare to Kalman smoother to inverse Jacobian, in this case?

POST REPLY