Home › Forum › SOFA › Using SOFA › Mounting a rigid object to a single point
Tagged: 64_bits, Linux_ubuntu, SOFA_1712
- This topic has 4 replies, 4 voices, and was last updated 6 years, 5 months ago by Hugo.
-
AuthorPosts
-
19 July 2018 at 09:56 #11349markus_wBlocked
Hi all,
since a few days I’m struggling with the problem of trying to restrict the translation of a rigid object with a surface mesh to a certain point…. or simple: I try to fix one point of the cube to a position, but the cube itself should be able to rotate around this point. I tried to put a FixedConstraint on a vertex of the surface mesh, but it just ended up in some strange behaviour π
Can you please help me?
Here is a .7z file containing the scene file and a obj file for the mesh.
https://drive.google.com/file/d/1yFovGJ7SVAJPU512jhgrG4d1HvmUIwll/view?usp=sharing19 July 2018 at 16:50 #11383mmabroukBlockedHi Markus,
I took a quick look to your code. It seems to me that the FixedConstraint is in the wrong node, it should be under the “cube” node, otherwise it won’t have access to the cube frames. In other words, you have right now is:
<cube>
</cube>
<n_endpoint>
</n_endpoint>While you should have
<cube><MechanicalObject><FixedConstraint>
</cube>I’m also a beginner with Sofa, so don’t take my word for it π Hope this helps.
Best,
Mahmoud23 July 2018 at 13:08 #11401markus_wBlockedHi Mahmoud,
when I reassemble the scene file, so the FixedConstraint is inside the node for the cube, the MechanicalObject (in this case the representative for the center of mass) is fixed and the whole object is not moving anymore.
I also tried to set the FixedConstraint inside the “surface_cube” node and set the indices to the chosen point, but also this is not help.Therefore my next step was to create a MechanicalOject outside the cube, fix this one to its position in the global space and attach this point and the one I try to fix in the cube together.
Any other suggestions????? Every piece of help is welcome π
Best,
Markus26 July 2018 at 12:03 #11530NouraBlockedHi,
Maybe adding
<FixedTranslationConstraint template="Rigid3d" />
inside
<Node name="cube" activated="1">
should restrict the translation and allow the rotation? Not sure if this is the proper way to do it.Noura
26 July 2018 at 12:18 #11531HugoKeymasterHi @strandhaus,
I am not sure to get what you want to achieve. You want to constraint one point of your cube to a rigid object that can move, is this correct?
If so, I modified the scene here:
<?xml version="1.0" ?> <Node name="root" dt="0.05" showBoundingTree="0" gravity="0 0 -1" bbox="-3 -3 -3 3 3 3"> <RequiredPlugin name="SofaMiscCollision"/> <VisualStyle displayFlags="showBehaviorModels hideForceFields hideCollisionModels showVisual"/> <CollisionPipeline verbose="0" name="CollisionPipeline"/> <BruteForceDetection name="N2"/> <CollisionResponse response="default" name="collision response"/> <MinProximityIntersection alarmDistance="0.001" contactDistance="0.00001"/> <EulerImplicitSolver /> <CGLinearSolver iterations="50" tolerance="1e-06" threshold="1e-06"/> <Node name="RigidParticle" > <MechanicalObject name="particle" template="Rigid" position="0.5 0.5 0.5 0 0 0 1" showObject="1" showObjectScale="0.5"/> <Node name="mappingVec" > <MechanicalObject name="particleVec" template="Vec3d"/> <RigidMapping input="@../particle" output="@particleVec"/> </Node> </Node> <Node name="Cube" > <MechanicalObject name="mo_surface_cube"/> <UniformMass mass="1" /> <RegularGrid nx="2" ny="2" nz="2" xmin="-0.5" xmax="0.5" ymin="-0.5" ymax="0.5" zmin="-0.5" zmax="0.5" /> <TetrahedronFEMForceField name="FEM" youngModulus="4000" poissonRatio="0.3" /> <Node name="Visual" activated="1"> <OglModel name="VisualModel" filename="cube.obj" color="yellow"/> <BarycentricMapping input="@.." output="@VisualModel"/> </Node> </Node> <AttachConstraint object1="@RigidParticle/mappingVec/particleVec" indices1="0" object2="@Cube/mo_surface_cube" indices2="7" constraintFactor="2" twoWay="true" radius="0.1"/> </Node>
Otherwise, never hesitate to take a look at the examples/ folder in the sources of SOFA. You can find for instance : examples/Components/constraint/ (SlidingConstraint, FixedConstraint, PartialFixedConstraint etc)
Best,
Hugo
-
AuthorPosts
- You must be logged in to reply to this topic.