Forum Replies Created
-
AuthorPosts
-
Hugo
KeymasterOk thanks @xiaojuan , it’s closed
Note that you can always close the topic yourself by crossing the appropriate box near to the “Submit” button (when topic is open)Hugo
KeymasterHi @hkomninos
To answer you first, it is strange indeed to get way smaller strain than FeBIO.
I know @Igorp and @Eleonora are discussing about such comparison and validation on another forum topic. Igor, Eleonora, any advice / info about Harris’ remark ?Dear @outtt, you can find an example based on constraint solved with Penalty method in the repository examples/Components/collision:
- TriangleModel.scn
- SphereModel.scn
But notice that – as stated above – even if penalty method would not suffer from a decrease in performance due to increasing nb of contacts, but it would be way less stable, and the constraints might not be well respected. If you have specific questions regarding penalty methods, please open a dedicated topic.
Best,
Hugo
Hugo
KeymasterHmm ok it means this might have been fixed in master since then
I’ll investigate and let you know.Best
Hugo
Hugo
KeymasterHi Harris
That’s exactly my point, the GS requires more iterations to converge.
Hugo
Hugo
KeymasterHi @outtt
which version are you using ? 18.06 ?
This should be fixed in 18.12. I will gather more info about this issue with the devs.Best
Hugo
Hugo
KeymasterHi Harris
Good, that’s what I assumed.
When constraints (like contacts) based on the Lagrange multipliers appears in the simulation, a new term appears in the linear system : the H matrix, which includes the constraint directions. When the pressure applied on your soft body increases, the constraints becomes harder to respect. And the solver requires more iterations to converge and find a proper solution, respecting the constraints. This is why the frame rate decreases, while the number of constraints (contacts) remains the same.With penalty methods, you would not have a significant decrease in performance but it would be way less stable, and the constraints might not be well respected.
Best
Hugo
25 January 2019 at 09:34 in reply to: [SOLVED] Adding captions and instructions in sofa animation exercises #1290024 January 2019 at 16:54 in reply to: [SOLVED] Adding captions and instructions in sofa animation exercises #12881Hugo
KeymasterHi @rubab
I guess using Python you can dynamically create and destroy OglLabel in your scene.
You can find an example of use in examples/Components/visualmodel/OglLabel.scnLet me know if it helps.
Hugo
Hugo
KeymasterDear Harris,
How are you solving the constraint?
Using penalty or using Lagrange approach?Best
Hugo
Hugo
KeymasterHi @xiaojuan
I never used it myself but the example scene helped me.
With the RecordedCamera, you define yourself the position of the camera where you will make the recording: using the position and rotationLookAt datafields.With the scene NavigationRecordedCamera, you define a series of position/orientations that the camera will follow at specific time frames: using the cameraPosition (vector of positions) and cameraOrientations (vector of orientations) datafields. The motion of the camera is done between a starting time (startTime) and the end time (endTime).
Do never hesitate to have a short look in the C++ code for a better understanding.
Best wishes,Hugo
Hugo
KeymasterGood @hkomninos , and thanks @secretdevil.
Harris, do not hesitate to set yourself a forum status to “[SOLVED]” when the discussion is over.Hugo
KeymasterCould you please share the scene and associated files with us?
In case you do not want to make it public, send them to me in private. Thanks.Hugo
11 January 2019 at 11:36 in reply to: [SOLVED] How to change the texture of OglModel at runtime? #12767Hugo
KeymasterDear Wong,
I will tell you more in details about the memberships in a private email. But most information is available online.
Regarding developer room, note that we recently setup a Gitter room. This room is dedicated to developers, for development questions. So if you have such developer questions, do not hesitate to join. For user question, the forum is the right place to be.
Note that scripting in Python is not really considered as SOFA development.Best regards,
Hugo
Hugo
KeymasterHi @fayad
I needed to investigate myself, here is a solution using the ArticulatedSystemMapping.
Scene:<?xml version="1.0" ?> <Node name="root" dt="0.02" gravity="0 0 0"> <RequiredPlugin name="SofaPython" pluginName="SofaPython" /> <PythonScriptController filename="ChangeOrientation.py" classname="Rotate" listening="true"/> <EulerImplicit /> <CGLinearSolver iterations="100" threshold="1e-6" tolerance="1e-6" /> <MechanicalObject name="bati" template="Rigid" position="0 0 0 0 0 0 1" /> <UniformMass /> <Node name="Grasper"> <MechanicalObject name="Articulations" template="Vec1d" position="0 0" /> <!-- rest_position="0 0.52" --> <RestShapeSpringsForceField points="0 1" stiffness="100000 100000" printLog="true"/> <Node name="Jaws"> <MechanicalObject name="GrasperDOFs" template="Rigid" position="0 0 0 0 0 0 1 0.1 0 0 0 0 0 1 0.2 0 0 0 0 0 1" showObject="1" showObjectScale="1"/> <Node name="visualization"> <Node name="handle_VM"> <OglModel name="VM" filename="mesh/dental_instrument.obj" color="red" /> <RigidMapping input="@../../GrasperDOFs" output="@VM" index="0" isMechanical="false" /> </Node> <Node name="grasper-bottom_VM"> <OglModel name="VM" filename="mesh/dental_instrument.obj" rx="90" color="green" /> <RigidMapping input="@../../GrasperDOFs" output="@VM" index="1" /> </Node> <Node name="grasper-top_VM"> <OglModel name="VM" filename="mesh/dental_instrument.obj" ry="90" color="blue" /> <RigidMapping input="@../../GrasperDOFs" output="@VM" index="2" /> </Node> </Node> <ArticulatedSystemMapping input1="@../Articulations" output="@GrasperDOFs" input2="@../../bati"/> </Node> <ArticulatedHierarchyContainer/> <Node name="articulationCenters"> <Node name="articulationCenter2"> <ArticulationCenter parentIndex="0" childIndex="1" posOnParent="0 0 -13" posOnChild="0 0 -13"/> <Node name="articulations"> <Articulation translation="0" rotation="1" rotationAxis="0 1 0" articulationIndex="0"/> </Node> </Node> <Node name="articulationCenter3"> <ArticulationCenter parentIndex="0" childIndex="2" posOnParent="0 0 -13" posOnChild="0 0 -13"/> <Node name="articulations"> <Articulation translation="0" rotation="1" rotationAxis="0 -1 0" articulationIndex="1"/> </Node> </Node> </Node> </Node> </Node>
with a python script:
import sys import Sofa class Rotate(Sofa.PythonScriptController): def initGraph(self,node): self.Articulations=node.getChild('Grasper').getObject('Articulations') return 0 def onKeyPressed(self,k): if k=="M" : rotation = self.Articulations.findData('position').value rotation[1][0] = rotation[1][0] - 0.1 self.Articulations.findData('position').value = rotation self.Articulations.findData('rest_position').value = rotation print ' M ' if k=="L" : rotation = self.Articulations.findData('position').value rotation[1][0] = rotation[1][0] + 0.1 self.Articulations.findData('position').value = rotation self.Articulations.findData('rest_position').value = rotation print ' L ' return 0
Do not hesitate to post us your resulting video 😉
Best wishes,Hugo
Hugo
KeymasterHi PF,
How does this look into your simulation scene ?
10 January 2019 at 19:19 in reply to: [SOLVED] How to use QTableWidget class in a sofa component plugin #12759Hugo
KeymasterHey @rubab,
I am no expert, but I noticed other devs about your issue. They should come back to you soon.
Hugo
Hugo
KeymasterDear PF,
after a quick check (SpringForceField.inl line 67), it appears that it is still possible to use “fileSprings” or “filename” to initialize Ks, Kd and the rest length with a Xsp file.
Can you share some examples /files ?Hugo
Hugo
KeymasterDear @zahra,
AdvancedTimer has time be placed in the c++ code to keep track/compute the time spent on specific part of the simulation. Not sure about python equivalent, but I guess their are dedicated libs. What I know is working is to set in your environment variable:
export SOFA_TIMER_ALL=1
this will activate all these timer computations. (set =0 to desactivate it)
BestHugo
Hugo
Keymaster10 January 2019 at 18:13 in reply to: [SOLVED] How to change the texture of OglModel at runtime? #12755Hugo
KeymasterHey @outtt
I am fine with helping you, but you should learn coding in Python since it is extremely useful in SOFA. Here is what I would write to test if it works (do not forget to use the PythonScriptController in your xml scene).
XML (inspired from the example examples/Components/visualmodel/OglModel.scn)<?xml version="1.0"?> <Node name="root" dt="0.01"> <RequiredPlugin name="SofaPython" pluginName="SofaPython" /> <PythonScriptController filename="model.py" classname="ChangeTexture" listening="true"/> <OglModel name="VisualModel" fileMesh="mesh/raptor_8kp.obj" texturename="/data/Softwares/sofa/src/master/share/textures/bubble_skin.bmp" translation="30 0 0" useNormals="0"/> <MeshObjLoader name="loader" filename="mesh/raptor_8kp.obj" translation="0 0 0"/> <OglModel name="VisualModel2" src="@loader" color="red"/> </Node>
Python:
import sys import Sofa class ChangeTexture(Sofa.PythonScriptController): def initGraph(self,node): print 'initGraph called (python side)' self.VM=node.getObject('VisualModel') return 0 def onKeyPressed(self,k): if k=="M" : self.VM.findData('texturename').value='/data/Softwares/sofa/src/master/share/textures/brushed_metal.bmp' self.VM.init() self.VM.initVisual() return 0
Dear @outtt, do you know whether GDUT would be ready to support the open-source project SOFA? Many ways are available to support the open-source initiative : donations, memberships, projects.
And many non-profit ways also exist like feature contributions, communication about your plugins (conferences, youtube, linkedin, twitter) and setup collaborations with the community!Best,
Hugo
Hugo
KeymasterHi @fayad
In order to consider them all as Rigid parts, you can :
1. define one master Rigid node, with only one point
2. create subnodes for each Rigid part, and map them on the above single point with a RigidRigidMappingThus it would be considered as one rigid object.
Best
Hugo
Hugo
KeymasterHugo
KeymasterHi Nassim,
Please find below a scene solving your issue. Two modifs:
1. put the fiber node as a child node from the cylinder (since they correspond to the same object)
2. decreasing the mass of the fiber, that was relatively to the cylinder very high.
3. Removing the TetraModel which is not needed, the collision node (with Point, Line etc) does the job !<Node name="root" gravity="0 -1 0" dt="0.1"> <!-- Basic Components to perform the collision detection --> <RequiredPlugin name="SofaPython" pluginName="SofaPython" /> <RequiredPlugin pluginName='SofaMiscCollision'/> <GenericConstraintSolver tolerance="0.001" maxIterations="1000"/> <VisualStyle displayFlags="showBehaviorModels showForceFields showVisual showWireframe" /> <DefaultMotionAnimationLoop /> <DefaultPipeline name="DefaultCollisionPipeline" verbose="0" /> <BruteForceDetection name="Detection" /> <MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" /> <DefaultContactManager name="Response" /> <DefaultCollisionGroupManager name="Group" /> <CollisionResponse name="Response" response="FrictionContact" responseParams="10"/> <CollisionGroup name="Group" /> <Node name="Floor"> <MeshTopology name="Topology Floor" filename="mesh/floorFlat.obj" /> <MechanicalObject name="Particles Floor" /> <UncoupledConstraintCorrection /> <PointModel name="FrictionCoeff" contactFriction="100" /> <TetrahedronModel name="FrictionCoeff4" contactFriction="1" /> <TriangleModel name="Triangle For Collision Floor" moving="0" simulated="0" /> <LineModel name="Lines For Collision" moving="0" simulated="0" /> <PointModel name="Points For Collision" moving="0" simulated="0"/> </Node> <!--Test de cylindre 2 --> <Node name="Cylinder" activated="1"> <MeshGmshLoader name="loader" filename="mesh/cylinder.msh" /> <EulerImplicitSolver name="cg_odesolver" printLog="0" /> <CGLinearSolver name="linear solver" template="GraphScattered" iterations="25" tolerance="1e-09" threshold="1e-09" /> <TetrahedronSetTopologyContainer src="@loader" name="Topology Container" fileTopology="mesh/cylinder.msh" /> <TetrahedronSetTopologyModifier name="Topology Modifier" /> <TetrahedronSetTopologyAlgorithms name="Topology Algorithms" template="Vec3d" /> <TetrahedronSetGeometryAlgorithms name="Geometry Algorithms" template="Vec3d" /> <MechanicalObject src="@loader" name="Cylinder" template="Vec3d" translation="0 16 0" rotation="90 0 0" scale="12" /> <TetrahedronFEMForceField name="FEM" template="Vec3d" method="polar" poissonRatio="0.3" youngModulus="1500" assembling="0" /> <UniformMass name="Mass" template="Vec3d" totalMass="300" /> <Node name="Visual Model"> <OglModel name="Visual" template="ExtVec3f" color="green" /> <IdentityMapping name="Mapping" template="Vec3d,ExtVec3f" input="@.." output="@Visual" /> </Node> <Node name="Collision Model"> <Mesh name="Cylinder Mesh" filename="mesh/cylinder.obj" /> <MechanicalObject name="Collision" /> <Triangle name="Cube Triangle For Collision" /> <Line name="Cube Edge For Collision" /> <Point name="Cube Point For Collision" /> <IdentityMapping name="RigidMapping Collision-RigidDOF" input="@../Cylinder" output="@Collision" /> </Node> <Node name="Wire2"> <EulerImplicitSolver name="cg_odesolver" printLog="0" /> <CGLinearSolver name="linear solver" template="GraphScattered" iterations="25" tolerance="1e-09" threshold="1e-09" /> <CylinderGridTopology name="Regular Mesh2" n="5 5 5" axis="0 1 0" radius="0.5" length="12" /> <MechanicalObject name="DOFs" template="Vec3d" translation="0 4 0" rotation="0 0 0" /> <TetrahedronFEMForceField name="FEM2" template="Vec3d" method="polar" poissonRatio="0.1" youngModulus="130" assembling="0" /> <UniformMass name="Mass2" template="Vec3d" totalMass="30" /> <BarycentricMapping name="Mapping-fiber2" output="@." input="@.." /> <PythonScriptController filename="ForceControl.py" classname="KeyboardControl" listening="true"/> <Node name="Visual Model"> <OglModel name="Visual2" template="ExtVec3f" color="blue" /> <IdentityMapping name="Mapping2" template="Vec3d,ExtVec3f" input="@.." output="@Visual2" /> </Node> </Node> </Node> </Node>
Best
Hugo
9 January 2019 at 14:29 in reply to: Carving into model does not work when using another model #12744Hugo
KeymasterDear @secretdevil @fayad
Note that @epernod is actively working in the current version of SOFA on topological changes (also needed in Carving). You can follow pull requests over here. Stay tuned.
Hugo
9 January 2019 at 14:27 in reply to: [SOLVED] How to change the texture of OglModel at runtime? #12743 -
AuthorPosts