14 April 2020 at 23 h 57 min #15759
I am trying to simulate a soft pneumatic actuator on SOFA. The problem I am having is that SOFA crashes immediately after I run the code using CGAL plugin to convert my stl model into a vtu file containing the volumetric mesh. I am guessing there must be something wrong with my code which caused a failure in mesh generation. Can anyone have a look on the code and my stl file and give me some advice on this? Any suggestion would be greatly appreciated!
import Sofa import math import os path = os.path.dirname(os.path.abspath(__file__))+'/data/mesh/' def createScene(rootNode): rootNode.createObject('RequiredPlugin', pluginName='CGALPlugin') node = rootNode.createChild('node') node.createObject('MeshSTLLoader',name='mesh',filename=path+'Test2.stl') node.createObject('MeshGenerationFromPolyhedron',name='gen',template='Vec3d',inputPointsemail@example.com', inputTrianglesfirstname.lastname@example.org',drawTetras='1', cellSize='1.5', facetSize='1.5', cellRatio='2', facetApproximation='0.15' ) node.createObject('Mesh', email@example.comPoints', firstname.lastname@example.orgTetras') node.createObject('VTKExporter', filename=path+'Test2', edges='0', tetras='1', exportAtBegin='1') node.createObject('OglModel', src="@mesh", color="0.0 0.7 0.7 0.5") return rootNode15 April 2020 at 0 h 00 min #15760
The link to the STL files was lost somehow… I hope this one works16 April 2020 at 16 h 06 min #15791
Thanks for your question.
This is related to the specific SoftRobot plugin and its tutorial.
However, I took a look at the meshes used in the tutorial (which I do not actually). One is very thin (yarn) and the other one has large area and thin borders.
Choosing the right parameters of this MeshGenerationFromPolyhedron component (based on CGAL as you understood) is therefore tricky. You have to make sure you allow CGAL to use a broad range of element size. I would therefore play with: facetSize, facetApproximation, cellSize and cellRatio. The latter must can be increased to allow local change of size between elements. FYI, the CGAL function called is :
CGAL::make_mesh_3<C3t3>(domain, criteria, no_perturb(), no_exude())
Let me know if this helps.
Hugo18 April 2020 at 13 h 06 min #15809
Thank you very much for your reply!
You are absolutely right about the meshes. The thin borders caused my problem. I have managed to simulate the actuator after I removed them. So thank you!
My next step is to simulate an assembly of two of this actuator. However, I couldn’t find a tutorial on how to define the connection between two bodies on SOFA. Could you give me some hints?
Owen20 April 2020 at 14 h 09 min #15863
Could you share with the community the parameters you used to get it working?
Depending on the type of animation loop you are using, I would have two solutions:
– the most appropriate constraint to attach physically two objects would be the BilateralInteractionConstraint (requiring a FreeMotionAnimationLoop)
– the second would be the AttachConstraint, a project constraint ensuring that at the end of the time step, the desired points of both objects are in the same location.
Hugo20 April 2020 at 19 h 33 min #15884
Sure, after removing the borders, I used cellSize=’2′, facetSize=’2′, cellRatio=’2′, facetApproximation=’0.15′. However, they only give me an acceptable mesh because I am running SOFA on my laptop which is not very powerful.
I guess I will start with BilateralInteractionConstraint. Is there any example code I can take a look?
Owen20 April 2020 at 23 h 02 min #15885
Yes definitely: you can take a look at the example scene in examples/Components/constraint/BilateralInteractionConstraint.scn
I let you close the topic whenever it suits you.
Hugo21 April 2020 at 15 h 48 min #15899
Thank you Hugo. I am gonna close the topic now.
- You must be logged in to reply to this topic.