Forum Replies Created
-
AuthorPosts
-
Hugo
KeymasterHi @nicklj
Thank you for your report regarding the SoftRobot project! It’s nice to see it so active!
I unfortunately do not know it very well.Please let me poke the experts: @damien-marchaluniv-lille1-fr and @bmarques
Best
Hugo
Hugo
KeymasterIs your problem the same than the issue reported in the other topic: Volumetric Mesh Generation Error ?
Is it related to the SoftRobot plugin? or the CGAL one ?
Best
Hugo
Hugo
KeymasterHi @lakehanne
I am glad to see that you are already using the ROS plugin from Dr. Aichele, Olalekan! Congrats.
Are you talking about changing the point of view in the scene?
Hugo
Hugo
KeymasterHi @simonau866
Thank you for sharing your issue and even the solution to it!
Congratulations!We stay at your disposal (with our latency, sorry about it!)
BestHugo
Hugo
KeymasterWoaw, you’re on the v17.06, it starts being a bit outdated. Even if your issues are not directly linked to this, I advise you to update your SOFA version soon.
To fix your issue, you can use the following script:
import Sofa class KeyboardControl(Sofa.PythonScriptController): # called once graph is created, to init some stuff... def initGraph(self,node): print 'initGraph called (python side)' self.MechanicalState = node.getObject('DOFs') gravity = node.findData('gravity').value print gravity self.rootNode = node.getRoot() #self.clothMesh = self.rootNode.getChild('SquareGravity') self.ballMesh = self.rootNode.getChild('ball') self.node = node # print self.ballMesh.getObject('ballState').scale return 0 # key and mouse events; use this to add some user interaction to your scripts def onKeyPressed(self,k): # free_position is a scalar array : [tx,ty,tz,rx,ry,rz,rw] free_position=self.MechanicalState.position print free_position # translation speed speed = 1 # UP key : front if ord(k)==19: self.rootNode.reset() # DOWN key : rear if ord(k)==21: self.rootNode.cleanup() # LEFT key : left if ord(k)==23: free_position[0][1]-=speed print free_position self.MechanicalState.findData('position').value=free_position # RIGHT key : right if ord(k)==22: free_position[0][1]+=speed print free_position self.MechanicalState.findData('position').value=free_position # PAGEUP key : up if ord(k)==18: free_position[0][0]-=speed print free_position self.MechanicalState.findData('position').value=free_position # PAGEDN key : down if ord(k)==20: free_position[0][0]+=speed print free_position self.MechanicalState.findData('position').value=free_position print self.ballMesh.getObject('ballState').position, self.MechanicalState.position return 0
I just now access the position and not the free position (the free position is a temporary position used in the FreeAnimationLoop when solving the constrained system with Lagrange multipliers).
Let me know it works.
Best wishes,Hugo
Hugo
KeymasterHi @jangirrishabh ,
Are you sure the github version is up to date ?
I don’t have any green ball and the red one is not moving.Hugo
Hugo
KeymasterHi @ma1991
At my best knowledge, some parameters (facetSize and cellSize) depend on the dimension. They therefore need to be set accordingly.
If you do not succeed, you can share your mesh so that we can assist you.
Hugo
Hugo
KeymasterHi @ma1991
What do you call a “discrete version of a mesh”?
@damien-marchaluniv-lille1-fr do you see what could be the problem?Best
Hugo
Hugo
KeymasterGreat, it’s nice to see your involvement in the SOFA project.
Do not hesitate to have a look at the DiffusionForceField available in SOFA!
Best,
Hugo
Hugo
KeymasterHi @fleonard
This looks strange to me.
What is your CMake-gui output when configuring?
Is there anything related to newmat?Hugo
Hugo
KeymasterHi @amit
Thank you for re-detailing everything. It helps.
You can forget about my remark concerning the FreeAnimationLoop, the AttachConstraint seems to be well respected using the usual DefaultAL.The approach based on AttachConstraint in order to model the fatty tissue linking the two organs can work but I think this won’t look very really realistic. If you decrease/update the radius of the NearestROI you can see that the objects will suddenly detach (I tested changing radius from 0.5 to 0.000005).
Another approach that could look more physically realistic would be to go for springs (not necessarily linear!) linking the two objects. You could implement the stiffness law you wish and when the elongation exceeds a threshold, set the stiffness to zero. This would really give the feeling to tear the fatty tissue and detach the organs step by step.
To do so, you could inherit from SpringForceField, define the law you want and the threshold regarding the elongation as a Data.I hope this helps.
Best wishes,Hugo
Hugo
KeymasterHi @simonau866
Welcome to the SOFA forum and thank you for your interest in SOFA!
Congratulations for having already solved your own issue and shared the solution. It is always very useful to the community.I will therefore close this topic. Do not hesitate to open a new one if you face any other issue. Best,
Hugo
Hugo
KeymasterHi @asalimil ,
Welcome on the SOFA forum. Sorry for our delay and thank you for your interest in SOFA!
First of all, when you have a new question (like you have here) please do not hesitate to open a new forum thread.
Regarding your question, there is not in the SOFA public version a class computing such liquid environment. I know there was some years ago a Buoyant force implemented in a private code. I am working on making these codes open but this will take time. Let me know if you feel confident to implement your own 😉
Best
Hugo
Hugo
KeymasterHi @fleonard
I think many fixes were actually done on Cuda since v18.12.
Regarding the information-less trace, I would rather go for using the master branch or cherry-picking all changes in the SofaCUDA plugin in master since v18.12.Afterwards, let us know whether you still have exec errors.
Best wishes,Hugo
Hugo
KeymasterHi @amit
Sorry for the delay, I’ve been away for several days.
AttachConstraint is computing/enforcing two objects that are really attach, connected together.If you want to mimic the interaction / collision of two objects, you should better use the collision pipeline for this. See an example in examples/Components/animationloop/FreeAnimationLoop.scn showing different objects interacting. At each collision, it creates a constraint solved using the Lagrange multiplier method.
If you want to model two objects that can be torn apart, using an AttachConstraint which can remove the constraints when the object are detached from another, your approach is a good one.
I hope this helps
Hugo
Hugo
KeymasterHi @zahra
This is a good question. I never asked me this before.
I don’t think there is an existing way to get the normals while the object is moving. Have you found any way? At my best knowledge, normals can be found in Loaders (MeshVTK/Obj/STLLoader) at init.This could be a nice feature to expose the normals as a datafield in the SetGeometryAlgorithms and pull-request this ! Would you feel confident to try it?
Best,
Hugo
Hugo
KeymasterHi @noura
You understood it well, you have to set youngModulus in MPa. and the force in Newton.
Regarding the file, indeed, whatever the translation, the dimension are in mm.
I will therefore close the topic if this is fine for you.
Best,Hugo
Hugo
KeymasterHi @jangirrishabh ,
My question about the boarder was just to understand your purpose. This will not have a strong impact on perf. Thanks for the screenshot.
I am no expert of these LocalMinDistance and MinProximityIntersection.
What I know is that these are classes proposing methods to compute collision detection using a set of two primitives. The difference of LocalMinDistance seems to be that it is specific for constraint-based approaches.Hugo
Hugo
KeymasterHi @jangirrishabh ,
I am glad it helped.
The typos are actually not typos but just due to the fact that I am working with the master branch of SOFA (which evolved since our last release).Regarding the ways to accelerate your simulation here are some clues.
From a numerical / physical point of view, you could use a coarser mesh for the collision mesh of the cloth (and keep the current mesh for the mechanics).
Other wise you are already using quite simple/optimizied approach (diagonal mass, iterative solver). Could you just explain the reason why you need to have an additional stiffness model on the boarder of the cloth? (MeshSpringForceField)Finally, a last step would be to go for GPU (see SofaCUDA plugin) or multi-CPU (see the Multithreading plugin) approach. Note that a indie dev is currently working on multithreaded collisions. I could connect you if needed.
Best
Hugo
Hugo
KeymasterDear @amit
Your CMakeList seems perfect! Good work!!
The error is mine.
In the TemplateAttachConstraint.h, you should have#include <SofaGeneralObjectInteraction/AttachConstraint.h>
instead of#include <sofa/component/projectiveconstraintset/AttachConstraint.h>
In the TemplateAttachConstraint.h, you should have
#include "TemplateAttachConstraint.h"
instead of#include <SofaGeneralObjectInteraction/TemplateAttachConstraint.h>
Let me know if this works.
Hugo
Hugo
KeymasterHi Noura,
Good to ask the question, since as you know it is an important point to understand.
If the file mesh you load has values between 0 and 40, then your file is in mm. Your Young’s modulus should be set in MPa, thereforeyoungModulus="1.5"
.Your dimension are in mm, your stress in MPa. Since MPa = N / mm^2 you can set your force in Newton.
Best,
Hugo
Hugo
KeymasterHi @faragassorobot-t-u-tokyo-ac-jp
I am glad it helped.
Please do not hesitate to open any new topic for questions regarding SOFA.Best
Hugo
Hugo
KeymasterHi @fleonard
You are right, compiling the sources of the SOFA release v18.12 with the SofaCUDA plugin activated fails. The error has been fixed since then in the master branch. The release v19.06 (released this June) will include this fix.
To get it working with your v18.12 sources, you can pick the commit fixing your issue. To do so, here are the steps to follow:
–git fetch origin
(if the remote github.com/sofa-framework/sofa is “origin” as by default)
–git cherry-pick 0e0f80a34aaf1c5b77852efb88df6a3d88ae47bd
Let me know if you face any issue.
Best wishes,Hugo
Hugo
KeymasterHi @jangirrishabh ,
Here is a simplified version of your scene. There was an issue with the collision mesh of the cloth. I suspect the Gmsh format doing something weird here but I am not 100% sure.
I also increase the distance of contact which was too small. Be also careful with the timestep, not chosing it too large for stability issue.
Hoping this helps:
<Node name="root" dt="0.05" gravity="0 -9.810 0"> <VisualStyle displayFlags="hideBehaviorModels showCollisionModels hideMappings hideForceFields showVisualModels showInteractionForceFields" /> <RequiredPlugin name='SofaMiscCollision'/> <FreeMotionAnimationLoop solveVelocityConstraintFirst="0" /> <LCPConstraintSolver maxIt="1000" tolerance="1e-6" initial_guess="false" build_lcp="true" multi_grid="false" printLog="0" mu="0.9"/> <CollisionPipeline depth="15" verbose="0" draw="0" /> <BruteForceDetection name="N2" /> <LocalMinDistance name="Proximity" alarmDistance="03" contactDistance="01" useLMDFilters="0" /> <CollisionResponse name="Response" response="FrictionContact" /> <MeshGmshLoader name="loader" filename="mesh/square3.msh" createSubelements="true" rotation="90 0 0" scale="100" /> <Node name="cloth"> <EulerImplicitSolver name="cg_odesolver" printLog="false" rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" /> <TriangleSetTopologyContainer name="algo" src="@../loader"/> <TriangleSetGeometryAlgorithms name="algo" template="Vec3d" recomputeTrianglesOrientation="1"/> <MechanicalObject name='cloth' src="@../loader" template="Vec3d" /> <DiagonalMass massDensity="0.01" /> <FixedConstraint indices="1" /> <TriangularFEMForceField name="FEM" youngModulus="1000" template="Vec3d" poissonRatio="0.1" method="large" /> <TriangularBendingSprings name="FEM-Bend" stiffness="10" template="Vec3d" damping="1.0" /> <!-- <TriangleSet /> --> <!-- <Triangle name="models" /> <Line /> <Point /> --> <UncoupledConstraintCorrection compliance="100"/> <Node name="TriangularSurface"> <TriangleSetTopologyContainer name="Container" /> <TriangleSetTopologyModifier name="Modifier" /> <Tetra2TriangleTopologicalMapping input="@../topo" output="@Container" /> <Triangle name="models" /> <Line /> <Point /> </Node> <Node name="clothVisual"> <OglModel name="Visual" src="@../loader" color="red" template="ExtVec3d"/> <IdentityMapping input="@.." output="@Visual" /> </Node> <Node name="Edge Mesh"> <EdgeSetTopologyContainer name="Container" /> <EdgeSetTopologyModifier name="Modifier" /> <EdgeSetGeometryAlgorithms template="Vec3d" name="GeomAlgo" drawEdges="1" /> <EdgeSetTopologyAlgorithms template="Vec3d" name="TopoAlgo" /> <Triangle2EdgeTopologicalMapping name="Mapping" input="@../Container" output="@Container" /> <MeshSpringForceField template="Vec3d" stiffness="300" damping="1.0" /> </Node> </Node> <Node name="CUBE"> <EulerImplicitSolver name="cg_odesolver" printLog="false" rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" /> <MechanicalObject template="Rigid3d" scale="2.0" translation="-10 10 -40" /> <UniformMass totalMass="10.0" /> <UncoupledConstraintCorrection compliance="0.1"/> <Node name="Visu"> <OglModel name="Visual" fileMesh="mesh/smCube27.obj" color="0.0 0.5 0.5 1.0" scale="2.0" /> <RigidMapping input="@.." output="@Visual" /> </Node> <Node name="Surf2"> <MeshObjLoader name="loader" filename="mesh/smCube27.obj" triangulate="true" /> <MeshTopology src="@loader"/> <MechanicalObject src="@loader" scale="2.0" /> <Triangle/> <Line/> <Point/> <RigidMapping /> </Node> </Node> <Node name="Floor"> <MeshObjLoader name="loader" filename="mesh/floorFlat.obj" triangulate="true" scale="10" translation="50 -10 50" /> <MeshTopology src="@loader" /> <MechanicalObject src="@loader" name="DOFs" template="Vec3d" /> <Triangle simulated="0" moving="0" contactFriction="100"/> <Line simulated="0" moving="0" contactFriction="100"/> <Point simulated="0" moving="0" contactFriction="100"/> <OglModel name="FloorV" /> </Node> </Node>
Best
Hugo
27 May 2019 at 18:57 in reply to: [SOLVED] Using Python to move some points or parts of an object #13535Hugo
KeymasterHi @baymin
There is actually several ways of enforcing displacement:
– You could first use the component LinearMovementConstraint (see example scene in examples/Components/constraint/LinearMovementConstraint.scn): with this component you can impose a sequential linear movement between target positions
– another option is to create another MechanicalObject with your moving target positions and define springs between these nodes and your object
There is maybe other ways that I am forgetting, but the above-mentioned ones can be easily tested. I hope this helps.
Hugo
-
AuthorPosts