Forum Replies Created
-
AuthorPosts
-
3 March 2020 at 16:07 in reply to: [SOLVED] RigidMapping from Rigid3d to only some particles of FEMbody #15265HugoKeymaster
Hi @simon !
Looking at your scene, it seems you are more looking for boundary conditions (fixing your 3D beam) or a constraint than for a mapping.
Right?
Do you want a part of your deformable to be rigidly attached to a rigid frame?Did you take a look at the following examples?
- examples/Components/constraint/BilateralInteractionConstraint.scn
- examples/Components/constraint/FixedConstraint.scn
- examples/Components/constraint/AttachConstraint.scn
Best
Hugo
13 February 2020 at 18:18 in reply to: How to prevent distortion of TetrahedralFEM in collision? #15208HugoKeymasterHey @outtt
You’re correct. I will add this to my todolist.
Adding a MeshMatrixMass in a python scene would look like:
node.createObject("MeshMatrixMass", name="SparseMass", massDensity="0.1", topology="@TopologyContainerLink")
I hope this helps.
BestHugo
8 February 2020 at 13:39 in reply to: [SOLVED] error: const type ‘const IdMap’ without a user-provided default constructor #15197HugoKeymasterThanks for sharing your updated solution @zacharyjay !
I close the topic.Hugo
7 February 2020 at 19:20 in reply to: [SOLVED] error: const type ‘const IdMap’ without a user-provided default constructor #15193HugoKeymasterHey @zacharyjay
Sorry your post slipped through our reviews. My apologies.
I am sorry this IdMap error does not ring a bell.. I’ll ask around me.
Are these the only 2 compilation errors you get?
Have you given a try to the latest SOFA release v19.12 ?Best,
Hugo
HugoKeymasterhey @balazs
Welcome on the SOFA forum!
Machine learning trained with simulations, how trendy is it! Interesting topic!A plugin already exists allowing to use SOFA and interact with the simulation within a Python3 environment: SOFAPython3 plugin. In a python script, you can design, run and interact with a simulation and its parameters (and much more!).
Is this what you are looking for?
What do you mean exactly by “access the rendered simulation view from within Python3”?Best wishes,
Hugo
HugoKeymasterHey @fleonard
I am sorry for this late reply.
That’s an interesting and challenging objective. I am no expert of the collision detection pipeline however.Could you share your code on any GitHub repo ?
I will discuss with experts next week and get back to you.Best
Hugo
7 February 2020 at 19:06 in reply to: [SOLVED] BilateralInteractionConstraint reduces gravity by 100x #15190HugoKeymasterHi @joshuaf
I am really sorry for this delayed reply.
I wanted to find some time to look at your simulation.Your simulation includes constraints, solved following the Lagrange multiplier method. You are right, the force that must be applied to compensate the gravity must be scaled by 0.01. It actually corresponds to the time step.
I think this comes from the Lagrange constraint resolution which involves the time step. I need to get through the equations to provide you a complete explanation. I will get back to you next week.
Sorry again for our latency!
Best wishes,Hugo
7 February 2020 at 19:06 in reply to: [SOLVED] One object with different collision definitions for different parts #15189HugoKeymasterHi @marina
Good to see you on the forum!
Yes creating subpart of an object with different representations (e.g. different collision models) should be possible using the SubsetMapping. You can have a look at the example: examples/Components/mapping/SubsetMapping.scnI hope this helps.
Best,Hugo
HugoKeymasterHi @bence,
It must be stressed that Beamadapter is a private plugin.
You won’t really get the support from the community.Could you please contact me in PM and enclose your scene file+meshes please?
Best
Hugo
HugoKeymasterHi @lakehanne
Usually C++ controllers tend to disappear with the growth of the Python scripting. This is due to the fact that Python allows for an easy, live scripting providing a maximum freedom to the user. On the other hand, C++ requires C++ coding, compilation and a controller usually implements one “controlling” feature.
If you implemented your own ForceField, it should work fine with SofaPython, since the forcefield class has already been bound.
For controller examples in C++, you can take a look at MechanicalStateController (in modules/SofaUserInteraction). There, you could implement the function handleEvent() (handling the respective events: onBeginAnimationStep and onEndAnimationStep).
Best,
Hugo
HugoKeymasterGreat. Shall we close this topic then?
Hugo
HugoKeymasterHi @lakehanne
I’m glad if it helped. Can we close the topic?
Anyway, keep us posted from your progress (papers, video, pull-requests etc.)!Best,
Hugo
HugoKeymasterDear @lakehanne
Yes the new SOFAPython plugin (using Python3 instead of Python2) allows such an implementation, you can see an example for a forcefield here.
You might have to rewrite the entire scene. We had a script translating a *.scn into a *.py (see scn2python.py script) but this was compatible for Python2.
Best,
Hugo
HugoKeymasterDear @lakehanne
Your variable
dr_pos_vecs
will contain the field ‘position’ of your Vec3 MechanicalObject. It will therefore be a vector with a size corresponding to the number of nodes in your mesh, with 3 reals (x,y,z) for each node.
How many points does your mesh include?
What is the size returned by the MechanicalObject position vector?Best wishes,
Hugo
PS: short question, why not using Python to script interactive features in your simulation?
HugoKeymasterHugoKeymasterSorry for the delayed reply.
The link seems to be dead. Could you upload it again please? Could you also let us know which version of SOFA are you using?Best
Hugo
21 January 2020 at 17:11 in reply to: How to prevent distortion of TetrahedralFEM in collision? #15124HugoKeymasterDear @outtt
This is a complex question.
First of all, in FEM, tetrahedra are known to be prone to “distortion” or more commonly called “numerical locking”. Their efficiency in term of integration has this drawback. Hexahedra are more robust to this problem.But looking into your scene, the first point would be to use a dense mass (MeshMatrixMass) and not a lumped mass (DiagonalMass). Second, you need to use appropriate values for your physical properties (mass density, Young’s modulus etc). Finally, when this is not sufficient, decreasing the mesh refinement and the time step is the only solution.
I hope I gave several point of investigation here. Do not hesitate to keep us posted.
Best wishes,Hugo
PS: curious question, why are you not using boundary conditions (like using the FixedConstraint) and applying a RestShapeSpringsForceField instead ?
HugoKeymasterHi @jieying
Sorry for the late reply!
I tested your scene multithreading.scn it seems to run.
Here is the simulation:
and no error is given.
Do you still have the error?
Could you copy paste the console output?
Could you tell us your SOFA versions?Below the scene slightly modified:
<?xml version="1.0"?> <Node name="root" gravity="0 -50 0" dt="0.001"> <RequiredPlugin pluginName="MultiThreading" /> <AnimationLoopParallelScheduler name="mainLoop" threadNumber="0" /> <VisualStyle displayFlags="hideBehaviorModels hideVisualModels showCollisionModels showInteractionForcefields" /> <FreeMotionAnimationLoop solveVelocityConstraintFirst="0"/> <LCPConstraintSolver maxIt="1000" tolerance="1e-6" mu="0.9"/> <DefaultPipeline depth="5" verbose="0" draw="0" /> <BruteForceDetection name="N2" /> <MinProximityIntersection alarmDistance="0.03" contactDistance="0.02" /> <DiscreteIntersection/> <DefaultContactManager name="Response" response="FrictionContact"/> <Node name="FloorScene"> <!-- <VisualStyle displayFlags="showBehaviorModels" /> <FreeMotionAnimationLoop solveVelocityConstraintFirst="0"/> <LCPConstraintSolver maxIt="1000" tolerance="1e-6" mu="0.9"/> <DefaultPipeline depth="5" verbose="0" draw="0" /> <BruteForceDetection name="N2" /> <MinProximityIntersection alarmDistance="0.03" contactDistance="0.02" /> <DiscreteIntersection/> <DefaultContactManager name="Response" response="FrictionContact"/> --> <Node name="Floor"> <EulerImplicit rayleighStiffness="0.1" printLog="false" rayleighMass="0.1" /> <CGLinearSolver threshold="1e-8" tolerance="1e-5" iterations="25"/> <MeshObjLoader name="loader" filename="mesh/floorFlat.obj"/> <MeshTopology src="@loader"/> <MechanicalObject name="mecha" src="@loader" template="Rigid3d" scale3d="10 1 10" translation="50 0 50" showObject="1"/> <UniformMass totalMass="10000.0"/> <UncoupledConstraintCorrection/> <OglModel name="visual" src="@loader" color="blue" scale3d="10 1 10" translation="50 0 50"/> <FixedConstraint indices='0 1 2 3'/> <Node name="Coll_Rec"> <MeshTopology src="@../loader"/> <MechanicalObject src="@../loader" name="coll" scale3d="10 1 10" translation="50 0 50"/> <TTriangleModel/> <TLineModel/> <TPointModel/> <RigidMapping input="@.." output="@coll"/> </Node> </Node> </Node> <Node name="CylinderScene"> <!-- <VisualStyle displayFlags="showBehaviorModels" /> <FreeMotionAnimationLoop solveVelocityConstraintFirst="0"/> <LCPConstraintSolver maxIt="1000" tolerance="1e-6" mu="0.9"/> <DefaultPipeline depth="5" verbose="0" draw="0" /> <BruteForceDetection name="N2" /> <MinProximityIntersection alarmDistance="0.03" contactDistance="0.02" /> <DiscreteIntersection/> <DefaultContactManager name="Response" response="FrictionContact"/> --> <Node name="Cylinder"> <EulerImplicit rayleighStiffness="0.1" printLog="false" rayleighMass="0.1" /> <CGLinearSolver threshold="1e-8" tolerance="1e-5" iterations="25"/> <MeshObjLoader name="loader_cyl" filename="mesh/cylinder.obj"/> <MechanicalObject name="Cyl" src="@loader_cyl" template="Rigid3d" scale3d="0.8 0.8 0.8" translation="-30 100 -65"/> <UniformMass totalMass="10000.0"/> <UncoupledConstraintCorrection/> <Node name="Visu_Cyl"> <OglModel name="visual_cyl" src="@../loader_cyl" color="green" scale3d="0.8 0.8 0.8"/> <RigidMapping input="@.." output="@visual_cyl"/> </Node> <Node name="Coll_Cyl"> <MeshTopology src="@../loader_cyl"/> <MechanicalObject src="@../loader_cyl" name="coll_cyl" scale3d="0.8 0.8 0.8"/> <TTriangleModel/> <TLineModel/> <TPointModel/> <RigidMapping input="@.." output="@coll_cyl"/> </Node> </Node> </Node> <DataExchange name="exchangeData1" template="vector<float>" from="@FloorScene/Floor/mecha.position" to="@CylinderScene/Cylinder/Cyl.position"/> </Node>
Best
Hugo
HugoKeymasterDear @outtt
My apologies for this long silence! The start of 2020 is intense!
Let me first ask some further info. Do you really need the blood vessel to have an accurate mechanical behavior or are you mostly interesting in the interaction/grasping effect ?
In case you want to get a ‘realistic interaction’ only, the use of triangular FE model + bending springs might be sufficient.
In case you really need an advanced mechanical surface model (shell), I do have a good news: the shell plugin will soon be made open source. Beforehand, I need to clean it and go through some administrative steps. But it will be available freely!
Best wishes,
Hugo
HugoKeymasterHi guys!
I am writing you to give you some additional updates. On top of last year integration of SOFA within Unity3D, other independent developers are actively investigating the use of SOFA as the physics engine in Unreal Engine. Check out this latest video:
In case you are interested for collaborating, co-developping or consulting these indiedevs, do not hesitate to contact us.
Best wishes,
Hugo
HugoKeymasterSofaPython3 is not yet officially distributed with SOFA. However, you should already be able to download it and compile it with SOFA.
Which version of SOFA are you using?
Could you post the error/crash/warning message you have?
I would need a bit more info to assist you.PS: you post image is not loaded properly
Best
Hugo
HugoKeymasterHi @joshuaf
Sorry for the “Christmas” silence!
For me the finger ms you are pointing to is working but with the same TetrahedronSetTopologyContainer error.Could you give me the version of SOFA you are using and where you downloaded it from please?
Best,Hugo
HugoKeymasterthe mesh seems to have some troubles. The TetrahedronSetTopologyContainer returns this:
[ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [2, 120] in triangle 0 [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [2, 120] in triangle 0 [WARNING] [TetrahedronSetTopologyContainer(container)] TrianglesAroundEdge buffer can't be created as EdgesInTriangle buffer creation failed. [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [131, 125, 144] in tetrahedron 0 [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [131, 125, 144] in tetrahedron 0 [WARNING] [TetrahedronSetTopologyContainer(container)] TetrahedraAroundTriangle buffer can't be created as trianglesInTetrahedron buffer creation failed.
Could you try with other volumetric mesh of yours please?
BestHugo
HugoKeymasterhi @joshuaf
Works fine for me (using another mesh because I don’t have the finger.vtk
Are you sure the file is containing tetrahedra ?
Does the mesh come from the SoftRobot plugin?Hugo
14 December 2019 at 16:05 in reply to: [SOLVED] Problem in generating Cmake-gui when building Sofa #14694 -
AuthorPosts