Home › Forum › SOFA › Using SOFA › [SOLVED] FixedRotationConstraint and LinearMovementConstraint not working
Tagged: 64_bits, SOFA_1608, Windows_10
- This topic has 4 replies, 2 voices, and was last updated 7 years, 11 months ago by Jens.
-
AuthorPosts
-
24 November 2016 at 15:20 #7984JensBlocked
Hello everybody,
I have a small problem with a SOFA scene. I want to constraint one object such that it cannot rotate with FixedRotationConstraint. However, if I include that in my scene, nothing changes and the object is still able to rotate when I move it with the mouse. Maybe I am doing something completely work. I would appreciate any tips an help, since I just started using SOFA and am still trying to learn how to best do some things and so on.
And the LinearMovementConstraint component can be used to move an object in a certain way, like rotate it or move it up or down, right? Because I tried using it and nothing happened.My .scn file is below
<?xml version="1.0"?> <Node name="root" gravity="0 0 -9.81" dt="0.02" > <VisualStyle name="visualStyle1" displayFlags="showVisual showBehaviorModels showForceFields showCollision showMapping" /> <DefaultPipeline name="DefaultCollisionPipeline" verbose="0" draw="0" depth="6" /> <LCPConstraintSolver name="lCPConstraintSolver" group="0" /> <BruteForceDetection name="BFDetection" /> <MinProximityIntersection name="minProximityIntersection1" alarmDistance="0.1" contactDistance="0.05" /> <OglGrid name="grid" /> <DefaultCollisionGroupManager name="CollisionGroup" /> <DefaultContactManager name="CollisionResponse" response="default" /> <Node name="GelatinCylinder" activated="1" > <MeshGmshLoader name="loader" filename="c:/local/sofa/gmsh/Cylinder_big.msh" edgesGroups="-1 0 11 0 11 11 -1 22 11 250 33 11 -1 261 11 -1 55 11 272 66 11 -1 77 338 -1 88 4 -1 337 4 -1 96 4 341 100 -1 201 11 441 212 11 -1 223 653 -1 234 11 -1 652 11 -1 256 11 663 267 11 -1 278 930 9 282 4 -1 939 4 -1 713 10 943 723 10 -1 733 1666 9 743 10 -1 1675 10 -1 763 10 1685 773 3 -1 776 2458 9 779 3 -1 2467 3 -1 2250 10 2470 2260 10 -1 2270 4730 9 2280 10 -1 4739 10 -1 2300 3 4749 2303 3 -1 2306 7052 9 -1 6851 10 7061 6861 10 -1 6871 13922 9 6881 10 -1 13931 10 -1 6901 3 13941 6904 3 -1 6907 20845 9 -1 20654 10 20854 20664 10 -1 20674 41518 9 20684 10 -1 41527 10 -1 20704 3 41537 20707 3 -1 20710 62244 9 -1 62063 10 62253 62073 10 -1 62083 124326 9 62093 10 -1 124335 10 -1 62113 3 124345 62116 3 -1 62119 186461 9 -1 186290 10 186470 186300 10 -1 186310 372770 9 186320 10 -1 372779 10 -1 186340 3 372789 186343 3 -1 186346 559132 9 -1 558971 10 559141 558981 10 -1 558991 1118122 9 559001 10 -1 1118131 10 -1 559021 3 1118141 559024 3 -1 559027 1677165 9 -1 1677014 10 1677174 1677024 10 -1 1677034 3354198 9 1677044 10 -1 3354207 10 -1 1677064 3 3354217 1677067 3 -1 1677070 5031284 9 -1 5031143 10 5031293 5031153 10 -1 5031163 10062446 9 5031173 10 -1 10062455 10 -1 5031193 3 10062465 5031196 3 -1 5031199 15093661 9 -1 15093530 10 15093670 15093540 10 -1 15093550 30187210 9 15093560 10 -1 30187219 10 -1 15093580 3 30187229 15093583 3 -1 15093586 45280812 9 -1 45280691 10 45280821 45280701 10 -1 45280711 90561522 9 45280721 10 -1 90561531 10 -1 45280741 3 90561541 45280744 3 -1 45280747 135842285 9 -1 135842174 10 135842294 135842184 10 -1 135842194 271684478 9 135842204 10 -1 271684487 10 -1 135842224 3 271684497 135842227 3 -1 135842230 407526724 9 -1 407526623 10 407526733 407526633 10 -1 407526643 815053366 9 407526653 10 -1 815053375 10 -1 407526673 3 815053385 407526676 3 -1 407526679 1222580061 9 -1 1222579970 10 1222580070 1222579980 10 -1 1222579990 -1849807246 9 1222580000 10 -1 -1849807237 10 -1 1222580020 3 -1849807227 1222580023 3 -1 1222580026 -627227204 9 -1 -627227285 10 -627227195 -627227275 10 -1 -627227265 -1254454470 9 -627227255 10 -1 -1254454461 10 -1 -627227235 3 -1254454451 -627227232 3 -1 -627227229 -1881681683 9 -1 -1881681754 10 -1881681674 -1881681744 10 -1 -1881681734 531603878 9 -1881681724 10 -1 531603887 10 -1 -1881681704 3 531603897 -1881681701 3 -1 -1881681698 -1350077804 9 -1 -1350077865 10 -1350077795 -1350077855 10 -1 -1350077845 1594811646 9 -1350077835 10 -1 1594811655 10 -1 -1350077815 3 1594811665 -1350077812 3 -1 -1350077809 244733853 9 -1 244733802 10 244733862 244733812 10 -1 244733822 489467674 9 244733832 10 -1 489467683 10 -1 244733852 3 489467693 244733855 3 -1 244733858 734201548 9 -1 734201507 10 734201557 734201517 10 -1 734201527 1468403074 9 734201537 10 -1 1468403083 10 -1 734201557 3 1468403093 734201560 3 -1 734201563 -2092362643 9 -1 -2092362674 10 -2092362634 -2092362664 10 -1 -2092362654 110241998 9 -2092362644 10 -1 110242007 10 -1 -2092362624 3 110242017 -2092362621 3 -1 -2092362618 -1982120604 9 -1 -1982120625 10 -1982120595 -1982120615 10 -1 -1982120605 330726086 9 -1982120595 10 -1 330726095 10 -1 -1982120575 3 330726105 -1982120572 3 -1 -1982120569 -1651394467 9 -1 -1651394478 10 -1651394458 -1651394468 10 -1 -1651394458 992178370 9 -1651394448 10 -1 992178379 10 -1 -1651394428 3 992178389 -1651394425 3 -1 -1651394422 -659216036 9 -1 -659216037 10 -659216027 -659216027 10 -1 -659216017 -1318432054 9 -659216007 10 -1 -1318432045 10 -1 -659215987 3 -1318432035 -659215984 3 -1 -659215981 -1977648019 9 -1 -1977648010 10 -1 -1977648000 10 -1 -1977647990 10 -1 -1977647980 10 -1 -1977647970 10 -1 -1977647960 3 -1 -1977647957 3 -1 -1977647954 3 -1 -1977647951 3" trianglesGroups="-1 0 404 0 404 92 -1 496 404 -1 588 92 -1 403 92 -1 495 404 495 899 92 -1 991 1394 -1 1083 92 -1 1393 92 -1 1485 318 1485 1803 84 -1 1887 3288 -1 1971 84 -1 3287 84 -1 3371 318 3371 3689 84 -1 3773 7060 -1 3857 84 -1 7059 84 -1 7143 318 7143 7461 84 -1 7545 14604 -1 7629 84 -1 14603 84 -1 14687 318 14687 15005 84 -1 15089 29692 -1 15173 84 -1 29691 84 -1 29775 318 29775 30093 84 -1 30177 59868 -1 30261 84 -1 59867 84 -1 59951 318 59951 60269 84 -1 60353 120220 -1 60437 84 -1 120219 84 -1 120303 318 120303 120621 84 -1 120705 240924 -1 120789 84 -1 240923 84 -1 241007 318 241007 241325 84 -1 241409 482332 -1 241493 84 -1 482331 84 -1 482415 318 482415 482733 84 -1 482817 965148 -1 482901 84 -1 965147 84 -1 965231 318 965231 965549 84 -1 965633 1930780 -1 965717 84 -1 1930779 84 -1 1930863 318 1930863 1931181 84 -1 1931265 3862044 -1 1931349 84 -1 3862043 84 -1 3862127 318 3862127 3862445 84 -1 3862529 7724572 -1 3862613 84 -1 7724571 84 -1 7724655 318 7724655 7724973 84 -1 7725057 15449628 -1 7725141 84 -1 15449627 84 -1 15449711 318 15449711 15450029 84 -1 15450113 30899740 -1 15450197 84 -1 30899739 84 -1 30899823 318 30899823 30900141 84 -1 30900225 61799964 -1 30900309 84 -1 61799963 84 -1 61800047 318 61800047 61800365 84 -1 61800449 123600412 -1 61800533 84 -1 123600411 84 -1 123600495 318 123600495 123600813 84 -1 123600897 247201308 -1 123600981 84 -1 247201307 84 -1 247201391 318 247201391 247201709 84 -1 247201793 494403100 -1 247201877 84 -1 494403099 84 -1 494403183 318 494403183 494403501 84 -1 494403585 988806684 -1 494403669 84 -1 988806683 84 -1 988806767 318 988806767 988807085 84 -1 988807169 1977613852 -1 988807253 84 -1 1977613851 84 -1 1977613935 318 1977613935 1977614253 84 -1 1977614337 -339739108 -1 1977614421 84 -1 -339739109 84 -1 -339739025 318 -339739025 -339738707 84 -1 -339738623 -679477732 -1 -339738539 84 -1 -679477733 84 -1 -679477649 318 -679477649 -679477331 84 -1 -679477247 -1358954980 -1 -679477163 84 -1 -1358954981 84 -1 -1358954897 318 -1 -1358954579 84 -1 -1358954495 84 -1 -1358954411 84 -1 -1358954327 84 -1 -1358954243 318" tetrahedraGroups=" -1 0 2035" /> <CGLinearSolver template="GraphScattered" name="ODE solver" tolerance="1e-009" threshold="1e-009" /> <EulerImplicitSolver name="linear solver" /> <MechanicalObject template="Vec3d" name="Volume" position="@loader.position" velocity="0 0 0" force="0 0 0" externalForce="0 0 0" restScale="1" translation="@loader.translation" rotation="@loader.rotation" scale3d="@loader.scale3d" /> <TetrahedronSetTopologyContainer name="Container" position="@loader.position" tetrahedra="@loader.tetrahedra" /> <TetrahedronSetGeometryAlgorithms template="Vec3d" name="tetrahedronSetGeometryAlgorithms" drawTetrahedra="1" drawColorTetrahedra="1 1 0.3 1" /> <TetrahedralCorotationalFEMForceField template="Vec3d" name="tetrahedralCorotationalFEMFF" poissonRatio="0.45" youngModulus="36000" /> <UniformMass template="Vec3d" name="uniformMass12" totalmass="200" /> <FixedPlaneConstraint template="Vec3d" name="fixedPlaneConstraint" direction="0 0 1" dmin="-0.01" dmax="0.01" /> <TLineModel template="Vec3d" name="tLineModel" proximity="0.01" contactStiffness="100" /> <WriteState name="writeState7" listening="1" filename="c:/local/sofa/sofa/dataout.data" writeX="1" writeV="1" writeF="1" /> <TTriangleModel template="Vec3d" name="tTriangleModel" moving="1" simulated="1" selfCollision="0" proximity="0.01" contactStiffness="100" /> <FixedConstraint template="Vec3d" name="fixedConstraint" indices="0 1 2 3 4 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229" /> <OglLineAxis name="oglLineAxis22" size="@../grid.size" /> <Node name="Triangles Mesh" > <TriangleSetTopologyContainer name="Container" /> <TriangleSetTopologyModifier name="Modifier" /> <TriangleSetTopologyAlgorithms template="Vec3d" name="GeomAlgo" /> <Tetra2TriangleTopologicalMapping name="Mapping" input="@../Container" output="@Container" /> <Node name="Visu" > <OglModel template="ExtVec3f" name="Visual" material="Default Diffuse 1 0.74902 0.74902 0.74902 1 Ambient 1 0.913725 0.921569 0.823529 1 Specular 0 1 1 1 1 Emissive 0 0 0 0 0 Shininess 0 45 " primitiveType="DEFAULT" blendEquation="GL_FUNC_ADD" sfactor="GL_SRC_ALPHA" dfactor="GL_ONE_MINUS_SRC_ALPHA" /> <IdentityMapping template="Vec3d,ExtVec3f" name="identityMap" input="@../../Volume" output="@Visual" /> </Node> </Node> </Node> <Node name="Instrument" > <EulerImplicitSolver name="ODE solver" rayleighMass="1" /> <CGLinearSolver template="GraphScattered" name="linear solver" tolerance="1e-010" threshold="1e-009" /> <UniformMass template="Rigid3d" name="uniformMass4" /> <FixedRotationConstraint template="Rigid3d" name="fixedRotationConstraint12" FixedXRotation="1" FixedYRotation="1" FixedZRotation="1" /> <LinearMovementConstraint template="Rigid3d" name="linearMovementConstraint26" indices="0" keyTimes="0" movements="0 0 -10 0 0 0" /> <MechanicalObject template="Rigid3d" name="InstrumentState" position="0 0 0 0 0 0 1" velocity="0 0 0 0 0 0" force="0 0 0 0 0 0" externalForce="0 0 0 0 0 0" restScale="1" translation="0 0 2" rotation="90 0 0" /> <Node name="Visu" > <OglModel template="ExtVec3f" name="InstrumentVisualModel" fileMesh="c:/local/sofa/blender/cylinder_instrument_100.obj" translation="0 0 0" rotation="0 0 0" material="Default Diffuse 1 0.74902 0.74902 0.74902 1 Ambient 1 0.2 0.2 0.2 1 Specular 0 1 1 1 1 Emissive 0 0 0 0 0 Shininess 0 45 " primitiveType="DEFAULT" blendEquation="GL_FUNC_ADD" sfactor="GL_SRC_ALPHA" dfactor="GL_ONE_MINUS_SRC_ALPHA" /> <RigidMapping template="Rigid3d,ExtVec3f" name="MM->VM Mapping" input="@.." output="@InstrumentVisualModel" /> </Node> <Node name="CollisionModel" > <MeshObjLoader name="loader" filename="c:/local/sofa/blender/cylinder_instrument_100.obj" /> <MeshTopology name="InstrumentCollisionModel" position="@loader.position" edges="@loader.edges" triangles="@loader.triangles" quads="@loader.quads" tetrahedra="@loader.tetras" hexahedra="@loader.hexas" /> <MechanicalObject template="Vec3d" name="InstrumentCollisionState" position="@loader.position" velocity="0 0 0" force="0 0 0" externalForce="0 0 0" restScale="1" /> <TLineModel template="Vec3d" name="instrument" moving="1" simulated="0" proximity="0.01" contactStiffness="10" /> <TPointModel template="Vec3d" name="instrument" moving="1" simulated="0" proximity="0.01" contactStiffness="10" /> <RigidMapping template="Rigid3d,Vec3d" name="MM->CM Mapping" input="@../" output="@./" /> </Node> </Node> </Node>
30 November 2016 at 19:06 #8030HugoKeymasterHi Jens,
when trying your scene there is : Cylinder_big.msh and cylinder_instrument_100.obj missing. Could you share them with us to have the complete scene ?
Cheers
Hugo
21 December 2016 at 15:29 #8242JensBlockedHi Hugo,
Sorry for just answering now. Thank you but I managed to solve the problem in the meantime. However, when the last movement from the LinearMovementConstraint component is done. Instead of stopping at that position the object just keeps on moving with the same speed in that direction and does not stop. Can I change that somehow?
This is my component and basically I want it to stop moving after 9s when it reaches the initial zero position again. But it just keeps on moving.
<LinearMovementConstraint template="Rigid3d" name="linearMovementConstraint1" indices="0" keyTimes="0 1.5 3 4.5 6 7.5 9" movements="0 0 0 0 0 0 0 0 -0.15 0 0 0 0 0 0 0 0 0 0 0 -0.15 0 0 0 0 0 0 0 0 0 0 0 -0.15 0 0 0 0 0 0 0 0 0" />
Best regards,
Jens
21 December 2016 at 15:42 #8243HugoKeymasterHi Jens,
I think what allows to stop any movement is to set a new step of the movements (and keyTime), but with the same value. As follows:
<LinearMovementConstraint template="Rigid3d" name="linearMovementConstraint1" indices="0" keyTimes="0 1.5 3 4.5 6 7.5 9 10" movements="0 0 0 0 0 0 0 0 -0.15 0 0 0 0 0 0 0 0 0 0 0 -0.15 0 0 0 0 0 0 0 0 0 0 0 -0.15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" />
Best
Hugo
22 December 2016 at 10:19 #8244JensBlockedHey Hugo,
that worked, thanks a lot 🙂
Best regards,
Jens
-
AuthorPosts
- You must be logged in to reply to this topic.