Home › Forum › SOFA › Using SOFA › [SOLVED] How to set a FixedTranslationConstraint on a specific mesh index?
Tagged: 64_bits, FixedTranslationConstraint, Linux_ubuntu, SOFA_1712
- This topic has 7 replies, 3 voices, and was last updated 6 years, 3 months ago by Hugo.
-
AuthorPosts
-
2 August 2018 at 18:53 #11635NouraBlocked
Hello,
I’m trying to figure out how it is possible to impose a
FixedTranslationConstraint
on a specific point in a rigid model.Here is a minimal simulation scene which demonstrates the wrong behavior: A torque is applied, the constraint is set on wrong position (the center of mass), and I added a text label “fixation” at the desired fixation position.
You need to download the required .obj file here.
I would appreciate the motivated person to look into my scene during the hottest summer days đŸ˜‰
Noura
<?xml version="1.0"?> <Node name="root" gravity="0 0 0" dt="0.01" > <EulerImplicitSolver rayleighStiffness="0.01"/> <CGLinearSolver iterations="50" tolerance="1e-06" threshold="1e-06"/> <VisualStyle name="visualStyle" displayFlags=" showWireframe showBehavior" /> <BruteForceDetection name="bruteForceDetection1" /> <DefaultContactManager name="defaultContactManager1" response="default" /> <DefaultPipeline name="defaultPipeline1" /> <MinProximityIntersection name="minProximityIntersection1" alarmDistance="0.2" contactDistance="0.1" /> <Node name="Radius" activated="1" > <MechanicalObject name="MO_Radius" template="Rigid3d" position="-15.6818 124.415 -260.548 0 0 0 1" /> <UniformMass totalmass="10"/> <!-- Right now, I'm setting the FixedTranslationConstraint here on the centre of mass, but it is not the position where I would like to --> <FixedTranslationConstraint template="Rigid3d"/> <!-- Supnation --> <TorsionForceField indices="0" torque="-20" axis="0.02 0.024 0.96" origin="-27.39 121.61 -368.12"/> <!-- Pronation --> <!-- <TorsionForceField indices="0" torque="20" axis="0.02 0.024 0.96" origin="-27.39 121.61 -368.12"/> --> <Node name="Visual_Radius" activated="1" > <OglModel name="VisualModel" filename="Radius.obj" color="0 0 1" /> <RigidMapping input="@../MO_Radius" output="@VisualModel" /> </Node> <Node name="Surface_Radius" activated="1" > <MeshObjLoader name="loader" filename="Radius.obj" /> <Mesh src="@loader" /> <MechanicalObject name="MO" src="@loader" /> <!-- Can't set a FixedTranslationConstraint on a specific point defined by its index (1011 is the index of the point RAF_Proximal introduced later in the scene--> <!-- <FixedTranslationConstraint name="fixation_poisition" indices="1011" /> --> <RigidMapping input="@../MO_Radius" output="@MO"/> <Triangle/> <Line /> <Point/> </Node> </Node> <!-- Visualization of the rotation axis and two points of interest --> <Node name="Rotation_axis_Visu" activated="1"> <OglModel template="ExtVec3f" position="-27.39 120.38 -367.86 -0.038 152.33 -171.65 " edges="1 0 " material="Default Diffuse 0 0 1 0 1 Ambient 1 1 1 0 1 Specular 0 0.333333 0 1 0 Emissive 0 0 1 0 1 Shininess 0 45" lineWidth="7" primitiveType="DEFAULT" blendEquation="GL_FUNC_ADD" sfactor="GL_SRC_ALPHA" dfactor="GL_ONE_MINUS_SRC_ALPHA"/> </Node> <!-- The bone should be fixed against translations at this position --> <Node name="RAF_Proximal" activated="1"> <Visual3DText text="Fixation" position="-27.396 120.38 -375" scale="1" /> <MechanicalObject name="p1_radius" template="Rigid3d" dx="-27.396" dy="120.38" dz="-367.86" rx="0" ry="0" rz="0" /> <UniformMass totalmass="1" /> </Node> <Node name="RAF_Distal" activated="1"> <MechanicalObject name="p2_ulna" template="Rigid3d" dx="-0.038966" dy="152.33" dz="-171.65" rx="0" ry="0" rz="0" /> <UniformMass totalmass="1" /> </Node> </Node>
2 August 2018 at 19:21 #11637BineshBlockedHi @Noura
in your scene , you loaded a mesh with mesh loader and mapped it to one point and apply fixedConstraint to MO_Radius mechanical object . so your fixedConstraint work with MO_Radius mechanical object and fix 1 point .you can use fixed constraint in your mesh topolgy node and give it a correct index
Or
you can use “PartialFixedConstraint” instead of “FixedTranslationConstraint”
2 August 2018 at 20:30 #11638NouraBlockedHi @Binesh,
Thanks for your comment.
In my current scene, there is no mesh topology node. Do you mean in the “Surface_Radius” Node? If yes, I already tried to set both: once a “FixedConstraint” and then a “PartialFixedConstraint” on the vertex (which has index no 1011). None of these lines:
<FixedConstraint name="fixation_poisition" indices="1011" />
<PartialFixedConstraint name="fixation_poisition" indices="1011" />
has an influence, and the point is still moving!
Even if one of both solution would work (which means restricting the motion of the vertex), I think that it is not the appropriate way because this would constraint the rotation as well which is not what should happen.
Any other suggestions?
Noura
3 August 2018 at 11:16 #11640HugoKeymasterHi @noura
I am not sure to understand what you want to simulate.
You apply a rotation on the center of mass, the object rotates indeed.But what is the constraint you want to apply?
3 August 2018 at 12:18 #11641NouraBlockedHi Hugo,
No matter where the torque is applied (on the center of mass or on another point), the proximal extremity of the bone (Node RAF_Proximal in the scene) should be fixed against translation.
In other words, imagine that the bone is mounted to a fixation device at this point (RAF_Proximal) which allows it only to rotate but not to go away.Hope that it is clear now?
Noura
4 August 2018 at 07:18 #11644BineshBlocked@Noura
your bone can rotate only
Is this not true?
I checked your scene very much and look like every thing is OK
I do not know exactly what the problem is đŸ˜€6 August 2018 at 16:40 #11645NouraBlockedThanks @Hugo and @Binesh for your attempts!
We managed finally to fix our simulation.
Solution was by replacing the MechanicalObject position by a different one (the base of the bone instead of its center of mass), and it works as desired.Best,
Noura
13 August 2018 at 10:30 #11655HugoKeymasterGreat to hear!
Thanks for the feedback Noura !! -
AuthorPosts
- You must be logged in to reply to this topic.