Home › Forum › SOFA › Using SOFA › [SOLVED] AttachConstraint not compatible with freemotionanimationloop
Tagged: 64_bits, Linux_other, SOFA_other
- This topic has 4 replies, 2 voices, and was last updated 5 years, 8 months ago by tgaugry.
-
AuthorPosts
-
20 February 2019 at 18:01 #13091tgaugryBlocked
I don’t know if it’s a bug or if i’m doing something wrong, but I haven’t managed to use attachconstraint correctly with a FreeMotionAnimationLoop.
Scene below reproduce the problem – Based on simplified version of the attachconstraint example.#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, division import Sofa def createScene(rootNode): rootNode.findData('dt').value = "0.02" rootNode.createObject('VisualStyle', displayFlags="showBehaviorModels showForceFields") # This does not work rootNode.createObject('FreeMotionAnimationLoop', name='FreeMotionAnimationLoop') rootNode.createObject('GenericConstraintSolver', maxIt='10000', tolerance='1e-9') rootNode.createObject('EulerImplicitSolver', name="cg_odesolver", printLog="0", rayleighStiffness=0.1, rayleighMass=0.1) rootNode.createObject('CGLinearSolver', template="GraphScattered", name="linear solver", iterations="25",tolerance="1.0e-9", threshold="1.0e-9") # Works #rootNode.createObject('EulerImplicit', name="cg_odesolver", printLog="false") #rootNode.createObject('CGLinearSolver', iterations="25", name="linear solver", tolerance="1.0e-9", threshold="1.0e-9") m1 = rootNode.createChild('M1') m1.createObject('MechanicalObject', name="mo") m1.createObject('UniformMass', vertexMass="1") m1.createObject('RegularGrid', nx="4", ny="4", nz="10", xmin="6", xmax="9", ymin="0", ymax="3", zmin="0", zmax="9") m1.createObject('BoxROI', template="Vec3d", box="5.9 -0.1 -0.1 9.1 3.1 0.1", drawBoxes="1", position="@mo.rest_position", name="FixedROI", computeTriangles="0", computeTetrahedra="0", computeEdges="0") m1.createObject('FixedConstraint', template="Vec3d", name="default6", indices="@FixedROI.indices") m1.createObject('TetrahedronFEMForceField', name="FEM", youngModulus="4000", poissonRatio="0.3") m1.createObject('UncoupledConstraintCorrection') m2 = rootNode.createChild('M2') m2.createObject('MechanicalObject', name="mo") m2.createObject('UniformMass', vertexMass="1") m2.createObject('RegularGrid', nx="4", ny="4", nz="10", xmin="6", xmax="9", ymin="0", ymax="3", zmin="9", zmax="18") m2.createObject('TetrahedronFEMForceField', name="FEM", youngModulus="4000", poissonRatio="0.3") m2.createObject('UncoupledConstraintCorrection') rootNode.createObject('NearestPointROI', template="Vec3", name="np1", object1="@./M1/mo", object2="@./M2/mo", radius="0.1") rootNode.createObject('AttachConstraint', object1="@M1", object2="@M2", twoWay="true", indices1="@np1.indices1", indices2="@np1.indices2")
21 February 2019 at 18:31 #13097epernodBlockedHello @tgaury,
could you describe what is the result you obtain. Is it crashing, nothing happen?
Do you have any output log?like this I could see 2 options. Either attachConstraint work only with defaultAnimationLoop or you have to specify indices1=”@../M1/np1.indices1″
Regards,
21 February 2019 at 19:28 #13098tgaugryBlockedResult is not physically plausible. Points of junction seem to be “heavier” than the others. They then gain speed, and the whole thing turn into a windmill. No crash.
You can compare the results using the commented section in the scenario of the initial post (section # This does not work / # Works)Log does not provide any useful information other than INFO messages (loaded plugins, etc).
However, we just realized that a 3 months old master (I don’t have commit id, i’ll try to provide one) can run this scene with the correct result, so this does look like a bug now.
Can you explain what you meant with
you have to specify indices1=”@../M1/np1.indices1″
? I’m actually specifying the indexes that way, the values in the inspector are correct.22 February 2019 at 14:24 #13104tgaugryBlockedSame problem on 0057a0cfd3d3fb6b9b3cdb00ca22eae4c17ae384 (so before attachConstraint split with
rootNode.createObject('AttachConstraint', object1="@M1", object2="@M2", twoWay="true", indices1="144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159", indices2=" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15", constraintFactor="1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1")
22 February 2019 at 16:07 #13107tgaugryBlocked -
AuthorPosts
- You must be logged in to reply to this topic.