Forum Replies Created
-
AuthorPosts
-
shangBlocked
Hi,Hugo
Sorry for late reply.
Thank you for your advice, I will follow the tips and have a try.
You can close this thread.24 November 2018 at 05:47 in reply to: [SOLVED] How to stabilize the beam model using BeamFEMForceField? #1253424 November 2018 at 05:32 in reply to: [SOLVED] Could sofa use full Python instead of being embedded in XML file using component #12533shangBlockedOK~
shangBlockedThank you Ant0nin,
It is explained in detail very much!
I will find out the configuration of friction for my scene.15 November 2018 at 03:15 in reply to: [SOLVED] Could sofa use full Python instead of being embedded in XML file using component #12458shangBlockedThank you Hugo
I am exactly using python to interact with the scene, and need to print data to console platform. So, I used PythonScriptController component in xml.
I also tried to compile SOFA in debug mode in cpp project.However, it is very slow and time-consuming in compilation and debugging process.So,I gave up cpp compilation.14 November 2018 at 14:46 in reply to: [SOLVED] How can I construct a stable beam force field while the beams are not straight? #12443shangBlockedHi,Christiane
You mean that my definition of mesh and MechanicalObject of the beams is totally right? But the catheter that I simulated using this node above is not stable at all, I am confused of this.PS:I am wondering whether your definition for the orientation of each point is the first 4 value of the position(which is type of Rigid)?
14 November 2018 at 12:37 in reply to: [SOLVED] How can I construct a stable beam force field while the beams are not straight? #12438shangBlockedDear Christiane
I have tried spline function with input:x-axis y-axis z-axis value of the initial position of my beams. And I calculate them in matlab. Because the x-axis value is linear as you can see in the scene file, and the y and z-axis value are all zeros. The spline interpolation was only done on x-values, and the spline result xx is same as x. The matlab code is list below:x = load('xx.txt')'; len=length(x); t=1:len; p=spline(t,x) tt = 0:0.1:len; xx=ppval(p,tt); plot(t,x) hold on plot(tt,xx)
and I also want to know whether the definition of “3D slope” that you mentioned is calculated with equation: sqrt(x^2 + y^2 + z^2).The result of this equation is a scalar.How to transform this value to a quaternion? And where to set the orientations you mentioned,which represent the x-axis of beams? Could the quaternions be set in “position” tag of the MechanicalObject of our beam mesh?
14 November 2018 at 10:58 in reply to: [SOLVED] How can I construct a stable beam force field while the beams are not straight? #12436shangBlockedHi,Christiane
Does “beam points” the mesh for the beam? Does the “instantaneous slope” means the value of x-axis value of the position for the MechanicalObject in “beam” node? and What is your input of the spline function in matlab? is the x-axis value of the position of beam MechanicalObject? I am a little bit confused, thank you for helping me with this issue.Here is my definition of my beam:
<Node name="beam" gravity="0 9.8 0"> <EulerImplicit rayleighStiffness="0.1" printLog="false" /> <CGLinearSolver template="GraphScattered" iterations="20" threshold="1e-008" tolerance="1e-5" /> <MechanicalObject template="Rigid" name="catheterDOFs" rotation="0 -90 0" position=" 0 0 0 0 0 0 1 0.5 0 0 0 0 0 1 1 0 0 0 0 0 1 1.5 0 0 0 0 0 1 2 0 0 0 0 0 1 2.5 0 0 0 0 0 1 3 0 0 0 0 0 1 3.5 0 0 0 0 0 1 4 0 0 0 0 0 1 4.5 0 0 0 0 0 1 5 0 0 0 0 0 1 5.5 0 0 0 0 0 1 6 0 0 0 0 0 1 6.5 0 0 0 0 0 1 7 0 0 0 0 0 1 7.5 0 0 0 0 0 1 8 0 0 0 0 0 1 8.5 0 0 0 0 0 1 9 0 0 0 0 0 1 9.5 0 0 0 0 0 1 10 0 0 0 0 0 1 10.5 0 0 0 0 0 1 11 0 0 0 0 0 1 11.5 0 0 0 0 0 1 12 0 0 0 0 0 1 12.5 0 0 0 0 0 1 13 0 0 0 0 0 1 13.5 0 0 0 0 0 1 14 0 0 0 0 0 1 14.5 0 0 0 0 0 1 15 0 0 0 0 0 1 15.5 0 0 0 0 0 1 16 0 0 0 0 0 1 16.5 0 0 0 0 0 1 17 0 0 0 0 0 1 17.5 0 0 0 0 0 1 18 0 0 0 0 0 1 18.5 0 0 0 0 0 1 19 0 0 0 0 0 1 19.5 0 0 0 0 0 1 20 0 0 0 0 0 1 20.5 0 0 0 0 0 1 21 0 0 0 0 0 1 21.5 0 0 0 0 0 1 22 0 0 0 0 0 1 22.5 0 0 0 0 0 1 23 0 0 0 0 0 1 23.5 0 0 0 0 0 1 24 0 0 0 0 0 1 24.5 0 0 0 0 0 1 25 0 0 0 0 0 1 25.5 0 0 0 0 0 1 26 0 0 0 0 0 1 26.5 0 0 0 0 0 1 27 0 0 0 0 0 1 27.5 0 0 0 0 0 1 28 0 0 0 0 0 1 28.5 0 0 0 0 0 1 29 0 0 0 0 0 1 29.5 0 0 0 0 0 1 " /> <Mesh name="lines" lines=" 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 53 54 54 55 55 56 56 57 57 58 58 59" /> <Monitor name="catheterInfo" template="Rigid" listening="1" indices="0 1 2 3 4" showPositions="0" PositionsColor="1 1 0 1" showMinThreshold="0.01" TrajectoriesPrecision="0.1" TrajectoriesColor="1 1 0 1" sizeFactor="1" /> <FixedConstraint name="FixedConstraint" indices="0" /> <UniformMass totalmass="6" /> <BeamFEMForceField name="FEM" radius="10" youngModulus="2000000" poissonRatio="0.9"/> <UncoupledConstraintCorrection /> <ConstantForceField /> <Node name="Collision"> <CylinderGridTopology name="coli" nx="6" ny="6" nz="59" length="59" radius="0.3" axis="1 0 0" /> <MechanicalObject /> <BeamLinearMapping isMechanical="true" /> <Triangle /> <Line /> <Point /> </Node> <Node name="visu"> <CylinderGridTopology name="coli" nx="6" ny="6" nz="59" length="59" radius="0.3" axis="1 0 0" /> <OglModel color="gray" /> <BeamLinearMapping isMechanical="true" /> </Node> <PythonScriptController name="catheter" filename="ScriptEvents.py" classname="catheter"/> </Node>
13 November 2018 at 11:02 in reply to: [SOLVED] How can I construct a stable beam force field while the beams are not straight? #12364shangBlockedhello,@Christiane
I am wondering how you created the spline corresponding to the FEM beams, is the spline created by SOFA components? I am coming to the same issue with yours, I am appreciate that you can share your idea. Thank you!3 November 2018 at 01:23 in reply to: [SOLVED] Could sofa use full Python instead of being embedded in XML file using component #12328shangBlockedhi @Hugo
I mean loading the python scene file directly instead of call the python script using PythonScriptController in xml scene file.And step debugging is only allowed in cpp scene,right? I am thinking step debugging is simple in debugging a scene code.
shangBlockedhi Hugo, I have reformated my .msh file with like the format, namely the text style as the “mesh/liver”, and it worked fine, I successfully load the msh file and simulated the scene with TetrahedralTensorMassForceField using the .msh file.
I will make this issue as solved, thank you!shangBlockedyes, Hugo, you’re right, the first scene works fine, I noticed that the bug in the .msh file too, I guess that I have to reformat my msh file like the format of file ” mesh/liver”. I will have a try,thank you , I will update the issue if it is solved!
shangBlockedexactly, this episode is right below
<Node name="root" dt="0.005" gravity="0 -9.81 0" > <VisualStyle displayFlags="hideBehaviorModels hideCollisionModels hideMappings hideForceFields" /> <RequiredPlugin name="Geomagic plugin" pluginName="Geomagic" /> <CollisionPipeline name="pipeline" depth="6" verbose="0"/> <BruteForceDetection name="detection" /> <NewProximityIntersection name="Proximity" alarmDistance="0.3" contactDistance="0.2" /> <CollisionResponse name="response" response="FrictionContact" /> <CollisionGroup name="Group" /> <FreeMotionAnimationLoop/> <GenericConstraintSolver tolerance="0.001" maxIt="1000"/> <Node name="Liver" gravity="0 -9.81 0"> <EulerImplicitSolver name="cg_odesolver" /> <CGLinearSolver name="linear solver" iterations="25" tolerance="1e-09" threshold="1e-09" /> <MeshGmshLoader name="meshLoader" filename="mesh/liver.msh" /> <TetrahedronSetTopologyContainer name="topo" src="@meshLoader" /> <MechanicalObject name="dofs" src="@meshLoader" /> <TetrahedronSetGeometryAlgorithms template="Vec3d" name="GeomAlgo" /> <DiagonalMass name="computed using mass density" massDensity="1" /> <TetrahedralTensorMassForceField name="TM" youngModulus="6000" poissonRatio="0.3" /> <PrecomputedConstraintCorrection recompute="true"/> <FixedConstraint name="FixedConstraint" indices="3 39 64" /> <Node name="Visu" tags="Visual" gravity="0 -9.81 0"> <OglModel name="VisualModel" fileMesh="mesh/liver-smooth.obj" /> <BarycentricMapping name="visual mapping" input="@../dofs" output="@VisualModel" /> </Node> <Node name="Surf" gravity="0 -9.81 0"> <SphereLoader filename="mesh/liver.sph" /> <MechanicalObject name="spheres" position="@[-1].position" /> <TSphereModel name="CollisionModel" listRadius="@[-2].listRadius"/> <BarycentricMapping name="sphere mapping" input="@../dofs" output="@spheres" /> </Node> </Node> </Node>
and this episode caused crush with “################ SIG11 – SIGSEGV: segfault ##########”
<Node name="root" dt="0.005" gravity="0 -9.81 0" > <VisualStyle displayFlags="hideBehaviorModels hideCollisionModels hideMappings hideForceFields" /> <RequiredPlugin name="Geomagic plugin" pluginName="Geomagic" /> <CollisionPipeline name="pipeline" depth="6" verbose="0"/> <BruteForceDetection name="detection" /> <NewProximityIntersection name="Proximity" alarmDistance="0.3" contactDistance="0.2" /> <CollisionResponse name="response" response="FrictionContact" /> <CollisionGroup name="Group" /> <FreeMotionAnimationLoop/> <GenericConstraintSolver tolerance="0.001" maxIt="1000"/> <Node name="Liver" gravity="0 -9.81 0"> <EulerImplicitSolver name="cg_odesolver" /> <CGLinearSolver name="linear solver" iterations="25" tolerance="1e-09" threshold="1e-09" /> <MeshGmshLoader name="meshLoader" filename="mesh/liver2.msh" /> <TetrahedronSetTopologyContainer name="topo" src="@meshLoader" /> <MechanicalObject name="dofs" src="@meshLoader" /> <TetrahedronSetGeometryAlgorithms template="Vec3d" name="GeomAlgo" /> <DiagonalMass name="computed using mass density" massDensity="1" /> <TetrahedralTensorMassForceField name="TM" youngModulus="6000" poissonRatio="0.3" /> <PrecomputedConstraintCorrection recompute="true"/> <FixedConstraint name="FixedConstraint" indices="3 39 64" /> <Node name="Visu" tags="Visual" gravity="0 -9.81 0"> <OglModel name="VisualModel" fileMesh="mesh/liver-smooth.obj" /> <BarycentricMapping name="visual mapping" input="@../dofs" output="@VisualModel" /> </Node> <Node name="Surf" gravity="0 -9.81 0"> <SphereLoader filename="mesh/liver.sph" /> <MechanicalObject name="spheres" position="@[-1].position" /> <TSphereModel name="CollisionModel" listRadius="@[-2].listRadius"/> <BarycentricMapping name="sphere mapping" input="@../dofs" output="@spheres" /> </Node> </Node> </Node>
shangBlockedI find there exists some bug in component ‘TetrahedralTensorMassForceField’ I simulated successfully with the tetrahedral mesh “mesh/liver.msh” but the exe crushed with only changing the gmsh file with “mesh/liver2.msh” ,so there exists with some problems with this component, does any know about this?
shangBlockeddear Hugo, it is solved! thank you!!
shangBlockedSorry for my late reply, Hugo, it is very nice of you to help me, I see where the error comes from, I will try the correct version of .scn file ASAP, thank you again!
shangBlockedhi,Hugo, I am using the version 16.12 SOFA and I use the sources and compiled it by myself, there are no error but the runsofa will crush and wait for a long time and then failed to load the scene file if I load the scene file where there is large and complicated(lot of data) model for the topology of the force field.
shangBlockedoh,sorry,I wrote the wrong param, my .msh file is larger than 500KB, it always takes a long time(more than minutes to load the file), or sometimes runsofa will crush while loading so large files.
my computer is 32GB RAM, 24 kernel 2.1Hz CPU, 64bit OS, and the GPU is NVIDIA Quadra K4000, is there any problem with configuration of my machine? @BassamshangBlockedSorry,Hugo,it doesn’t work, there is not collision response,either.
I did replace the episode
<Node name="Collision"> <CylinderGridTopology name="coli" nx="5" ny="5" nz="115" length="21" radius="0.05" axis="1 0 0" /> <MechanicalObject /> <BeamLinearMapping isMechanical="true" /> <Triangle /> </Node>
with
<Line name="BeamCollisionModel"/>
but the console shows “object type ‘Line’ Creation Failed”
so I replaced
<Triangle />
with
<Line name="BeamCollisionModel"/>
and collision response did not show up, it seems that that object does not work.Is there any other solution alternative?
Thank you so much!14 July 2017 at 04:10 in reply to: [SOLVED] Mapping between BeamFEMForceField behavioral model and oglmodel #9792shangBlockedok,Hugo, it’s ok to close this topic!
2 June 2017 at 14:50 in reply to: [SOLVED] Issue of error simulating catheter using CatmullRomSplineMapping etc components #9248shangBlockedok, that’s ok, sorry being so late!
20 May 2017 at 04:19 in reply to: [SOLVED] Issue of error simulating catheter using CatmullRomSplineMapping etc components #9138shangBlockedI have figured out the problems, it is about the python syntax problems, I have accomplished to control the catheter by keyboard, but I still can not successfully map the position value between virtual catheter(the FEM beam) and the geomagic device. And I am trying to revise my python code to have a try. Than you very much! @Hugo
19 May 2017 at 11:09 in reply to: [SOLVED] Issue of error simulating catheter using CatmullRomSplineMapping etc components #9137shangBlockedDear Hugo,
thank you for asking, actually, I followed your advice and adopted the BeamFEMforceField to simulate the catheter that I need, and what i need to do next is to link the geomagic device, Touch X with the virtual catheter. but as we can see in the “catheter” node<Node name="catheter"> <EulerImplicit rayleighStiffness="0" printLog="false" /> <BTDLinearSolver template="BTDMatrix6d" printLog="false" verbose="false" /> <MechanicalObject template="Rigid" name="DOFs" position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 2 0 0 0 0 0 1 3 0 0 0 0 0 1 4 0 0 0 0 0 1 5 0 0 0 0 0 1 6 0 0 0 0 0 1 7 0 0 0 0 0 1" /> <Mesh name="lines" lines="0 1 1 2 2 3 3 4 4 5 5 6 6 7" /> <FixedConstraint name="FixedConstraint" indices="0" /> <UniformMass mass="1 1 0.01 0 0 0 0.1 0 0 0 0.1" printLog="false" /> <BeamFEMForceField name="FEM" radius="0.1" youngModulus="20000000" poissonRatio="0.49"/> <Node name="Collision"> <CubeTopology nx="15" ny="2" nz="2" min="0 -0.1 -0.1" max="7 0.1 0.1" /> <MechanicalObject /> <BeamLinearMapping isMechanical="true" /> <Triangle /> </Node> </Node>
I have no idea how to map position of the first point of the catheter to the Touch X geomagic device, so I tried to write python scripts using PythonScriptController component to realize this goal,and the python script is as follows:
import sofa class geomagic(Sofa.PythonScriptController): def onLoaded(self,node): self.rootNode = node.getRoot() self.MechanicalState = node.getObject('deviceDOFs') return 0 def onBeginAnimationStep(self,dt): data = self.MechanicalState.position self.rootNode.sendScriptEvent('geoPos',data) return 0 class catheter(Sofa.PythonScriptController): def onLoaded(self,node): self.MechanicalState = node.getObject('catheterDOFs') return 0 catheterPos = self.MechanicalState.position def onScriptEvent(self,senderNode,eventName,data): if eventName = 'geoPos' catheterPos[0] = data self.MechanicalState.position = catheterPos return 0
the callback of PythonScriptController component in XML is like
<PythonScriptController name="device" filename="catheterScripts.py" classname="geomagic"/>
but error occured like the image shows
3 May 2017 at 00:51 in reply to: [SOLVED] Issue of error simulating catheter using CatmullRomSplineMapping etc components #9038shangBlockedwow,that may exactly be the problem, thank you a lot, Hugo! I will try it.
27 April 2017 at 15:27 in reply to: [SOLVED] Issue of error simulating catheter using CatmullRomSplineMapping etc components #9016shangBlockedhi hugo, actually, the scene file I posted is not the file CatmullRomSplineMapping.scn in examples/Components/mapping/CatmullRomSplineMapping.scn, I changed it and made a certain scene file of myself. I want to simulate the catheter and give it a forcefield and map it with the geomagic device. But it seems that there exists many problems of the communication between geomagic device and the catheter model with a forcefield or other components. Is this really true that no one can solve this problem? @Hugo
-
AuthorPosts