Home › Forum › SOFA › Programming with SOFA › [SOLVED] Attach constraint and Fixed constraint difference
Tagged: 64_bits, AttachConstraint, Linux_ubuntu, SOFA_1706
- This topic has 10 replies, 3 voices, and was last updated 4 years, 4 months ago by
Sarah.
-
AuthorPosts
-
31 July 2019 at 17:53 #14053
Rishabh
BlockedHi,
I came across a difference between the AttachConstraint and FixedConstraint in the simulation. The difference will be clear with the following images
AttachConstraint behavior – https://ibb.co/wsbC2f9
FixedConstraint behavior – https://ibb.co/rvP9nBDEssentially there is too much deformation with attach constraint. I fail to understand why this is as even with fixed constraint I am only fixing the positions of the two vertices. Does it have something to do with the stiffness of the constraint?
Thank you,
Rishabh13 August 2019 at 18:04 #14098Hugo
KeymasterIt is a good questions.
The FixedConstraint is a ProjectiveConstraint, which will enforce a zero velocity on specific points of your model.
The AttachConstraint is a PairInteractionConstraint (documentation is missing for now, but we work on it). This component aims at satisfying the constraint defining that two points of two different models (“paired models”) have the same position. In your case of of the two models (red balls) are fixed. So it should give the same result. To get the same result (same physics), you should activate the option twoWay. This option makes sure that forces are projected back from model2 to model1.Still, could you share the scene you wrote with the AttachConstraint please?
Best
Hugo
14 August 2019 at 18:27 #14120Rishabh
BlockedHi @hugo,
The scene file can be found here in gist, https://gist.github.com/jangirrishabh/3753c2a877535a47c82a954cf6c5a168
I tried the ‘twoWay = True’ param but did not notice any change in the deformations. Although adjusting VelocityFactor, PositionFactor and radius parameters has some minor effects.
I need to move the red balls around as actuators, they are physical objects who can interact with the environment, and controlled by two other virtual input balls, whose position I am essentially changing (and having a spring force field between them). Am I doing something complex here? Is there an easy way to just move the red balls around without having to attach them to virtual balls with a force field
Thanks,
Rishabh23 August 2019 at 11:55 #14147Hugo
Keymaster24 August 2019 at 13:05 #14153Rishabh
BlockedHi hugo, what do you mean by the unit of simulation?
Rishabh
26 August 2019 at 11:54 #14158Hugo
KeymasterI mean, what should be the size the square object, what should be its Young modulus ?
26 August 2019 at 12:17 #14159Rishabh
BlockedOkay, for now the simulation units mentioned in the script are alright. All my experiments are in simulation so that does not affect the problem. So yes, the numbers in the script can be used.
2 September 2019 at 16:37 #14173Hugo
KeymasterI might have been unclear.
What are your units: mm ? meters ? inches ?
Just make sure that your physical parameters (elasticity, threshold, time steps etc.) are accordingly and properly defined.To more specifically answer the initial question: whas is the difference betweem FixedConstraint and AttachConstraint (with twoWays option):
- FixedConstraint is a projective constraint. It means at each time step, the fixed nodes will a zero-velocity projected. Therefore, they won’t move.
- AttachConstraint is a PairInteraction constraint. It means it couples a pair of objects and it will constraint each of these objects to respect the constraint that x_object1[indices1]=x_object2[indices2]. This constraint is included in the constraint Jacobian matrix H:
Let me know how I can help further.
BestHugo
16 April 2020 at 14:34 #15785Sarah
BlockedHi!
Building upon this topic. I’ve been looking into some of these constraints as well and was using the RestShapeSpringsForceField myself in order to constrain some points. But read in this topic that this would not ‘respect’ the physics: https://www.sofa-framework.org/community/forum/topic/fixed-constraints-not-so-fixed-with-genericconstraintsolver/
Am trying to figure out what the best constraint is to apply to get physical results upon deformation of the mesh object. Would you recommend using the FixedConstraint instead of the RestShapeSpringsForceField, or would it be better to use Attach constraint?Furthermore I was wondering about the constraint solvers the GenericConstraintSolver seems like it would be applicable to any of these three forms of constraints, but what would the reason for using the LCPConstraintSolver be? Would that be more for collision and friction? Thanks for your input the forum has been a really useful tool for me!
Sarah
16 April 2020 at 16:06 #15793Hugo
KeymasterHi @sarah
Constraints work well no worries.
If you are looking at defining a fixed boundary condition: then the FixedConstraint is the good solution. But it depends on what is your physical purpose.Could you describe a bit more your use-case/scene?
See the difference between LCP and GenericCS here in the doc.
Best wishes,
Hugo
16 April 2020 at 18:29 #15797 -
AuthorPosts
- You must be logged in to reply to this topic.