Home › Forum › SOFA › Using SOFA › [SOLVED] HOW TO carving by phantom device ?
- This topic has 10 replies, 3 voices, and was last updated 3 years, 10 months ago by Davacas.
-
AuthorPosts
-
16 February 2017 at 14:42 #8595SenBlocked
Hi,everyone
I have q question. I can carving by mouse.And I can force feedback by phantom device.I can touch rigid body an I feel force by phantom device.But I need to touch rigid boby,meanwhile carve it by phantom device.Now I only touch rigid body ,I can feel foce ,but touching rigid cannot carve it .But i can carving by mouse.How to cut it while touching it and give it a feedback .16 February 2017 at 16:39 #8601HugoKeymasterHi Sen,
You can have a look at the SofaCarving plugin.
I never used it personally (I never worked on cutting) but it could help.
Otherwise you can have a look at the follow discussion:Hope this helps.
Cheers,Hugo
17 February 2017 at 12:08 #8606SenBlockedHi Hugo,
I may know the reasons. I may know why, when I phantom device to touch the rigid body , it is actually in the collision model, is exposed to a boundary, and no contact with the object, and I use the mouse event contact to the surface of the hard object, so it can be carve. So, how to modify the boundaries of the collision model, so that the boundary on the surface or on the surface of the inside.@Hugo17 February 2017 at 12:11 #8607HugoKeymasterWhat do you mean by modifying the boundaries of the collision model ?
You want to edit the mesh ?18 February 2017 at 04:22 #8616SenBlockedWhat I mean is that I’m going to touch it, it comes in contact with the boundary of the collision model, without touching the boundary of the mesh, which leads to not carve, and I’m in contact with the mesh boundary, so he can carve.Can I give you my SCN file, can you help me to look at it?
18 February 2017 at 12:20 #8618HugoKeymasterYes please, share it with us.
It always helps.19 February 2017 at 14:50 #8622SenBlocked<?xml version=”1.0″?> <Node name=”root” gravity=”10 0 0″ dt=”0.005″ > <RequiredPlugin name=”Sensable Plugin” printLog=”1″ pluginName=”Sensable” /> <RequiredPlugin name=”Carving” printLog=”1″ pluginName=”SofaCarving” /> <VisualStyle name=”visualStyle1″ displayFlags=”hideBehaviorModels hideForceFields hideCollisionModels hideMappings” /> <DefaultPipeline name=”pipeline” verbose=”0″ depth=”6″ /> <BruteForceDetection name=”detection” /> <DefaultContactManager name=”response” response=”FrictionContact” /> <LocalMinDistance name=”proximity” alarmDistance=”0.15″ contactDistance=”0.05″ angleCone=”0″ /> <FreeMotionAnimationLoop name=”freeMotionAnimationLoop1″ /> <CarvingManager name=”carvingManager1″ listening=”1″ active=”1″ /> <LCPConstraintSolver name=”lCPConstraintSolver1″ tolerance=”0.001″ maxIt=”1000″ group=”0″ /> <Node name=”Tooth” > <EulerImplicitSolver name=”cg_odesolver” printLog=”0″ /> <CGLinearSolver template=”GraphScattered” name=”linear solver” iterations=”25″ tolerance=”1e-009″ threshold=”1e-009″ /> <MeshGmshLoader name=”GmshLoader” filename=”d:/src/installables/sofa/git/sofafromgit/sofa/share/mesh/cylinder.msh” tetrahedraGroups=” -1 0 2430″ createSubelements=”1″ /> <MechanicalObject template=”Vec3d” name=”dofs” position=”@GmshLoader.position” velocity=”0 0 0″ force=”0 0 0″ externalForce=”0 0 0″ restScale=”1″ scale3d=”1 1 1″ /> <TriangleSetTopologyContainer name=”topo” position=”@GmshLoader.position” edges=”@GmshLoader.edges” triangles=”@GmshLoader.triangles” /> <TriangleSetTopologyModifier name=”modif” /> <TriangleSetTopologyAlgorithms template=”Vec3d” name=”algo” /> <TriangleSetGeometryAlgorithms template=”Vec3d” name=”triGeo” showPointIndices=”0″ showEdgeIndices=”0″ drawEdges=”0″ /> <DiagonalMass template=”Vec3d” name=”diagonalMass1″ massDensity=”0.15″ /> <FixedConstraint template=”Vec3d” name=”fixedConstraint1″ indices=”0 1″ /> <TriangularFEMForceField template=”Vec3d” name=”FEM” method=”large” poissonRatio=”0.3″ youngModulus=”100″ /> <TriangularBendingSprings template=”Vec3d” name=”FEM-Bend” stiffness=”300″ damping=”1″ /> <TTriangleModel template=”Vec3d” name=”tTriangleModel1″ /> <Node name=”VisualModel” > <OglModel template=”ExtVec3f” name=”VisualModel” material=”Default Diffuse 1 0.74902 0.74902 0.74902 1 Ambient 1 0.2 0.2 0.2 1 Specular 0 1 1 1 1 Emissive 0 0 0 0 0 Shininess 0 45 ” primitiveType=”DEFAULT” blendEquation=”GL_FUNC_ADD” sfactor=”GL_SRC_ALPHA” dfactor=”GL_ONE_MINUS_SRC_ALPHA” /> <IdentityMapping template=”Vec3d,ExtVec3f” name=”mapping” input=”@..” output=”@VisualModel” /> </Node> </Node> <Node name=”Omni” > <MechanicalObject template=”Rigid3d” name=”DOFs” position=”0 0 0 0 0 0 1″ velocity=”0 0 0 0 0 0″ force=”0 0 0 0 0 0″ externalForce=”0 0 0 0 0 0″ restScale=”1″ /> <MechanicalStateController template=”Rigid3d” name=”mechanicalStateController1″ listening=”1″ handleEventTriggersUpdate=”1″ mainDirection=”-1 0 0″ /> <OmniDriver name=”omniDriver0″ listening=”1″ scale=”100″ omniVisu=”0″ /> <Node name=”RefModel” > <MeshObjLoader name=”loader” filename=”d:/wqf/dental_instrument_centerline.obj” /> <MeshTopology name=”meshTopology1″ position=”@loader.position” edges=”@loader.edges” triangles=”@loader.triangles” quads=”@loader.quads” tetrahedra=”@loader.tetras” hexahedra=”@loader.hexas” /> <MechanicalObject template=”Vec3d” name=”instrumentCollisionState” position=”@loader.position” velocity=”0 0 0″ force=”0 0 0″ externalForce=”0 0 0″ restScale=”1″ translation=”-0.3 0 3.5″ rotation=”0 -180 -90″ /> <RigidMapping template=”Rigid3d,Vec3d” name=”rigidMap2″ input=”@../” output=”@./” /> </Node> </Node> <Node name=”Instrument” > <EulerImplicitSolver name=”cg_odesolver” printLog=”0″ /> <CGLinearSolver template=”GraphScattered” name=”linear solver” iterations=”25″ tolerance=”1e-009″ threshold=”1e-009″ /> <MechanicalObject template=”Rigid3d” name=”instrumentState” tags=”Omni” position=”0 0 0 0 0 0 1″ velocity=”0 0 0 0 0 0″ force=”0 0 0 0 0 0″ externalForce=”0 0 0 0 0 0″ restScale=”1″ /> <UniformMass template=”Rigid3d” name=”mass” totalmass=”0.05″ /> <LCPForceFeedback template=”Rigid3d” name=”lCPForceFeedback1″ listening=”1″ activate=”1″ forceCoef=”0.005″ /> <UncoupledConstraintCorrection template=”Rigid3d” name=”uncoupledConstraintCorrection1″ /> <Node name=”VisualModel” > <OglModel template=”ExtVec3f” name=”InstrumentVisualModel” fileMesh=”d:/wqf/dental_instrument.obj” translation=”-0.412256 -0.067639 3.35″ rotation=”180 0 150″ scale3d=”1 1 1″ material=”Default Diffuse 1 1 0.2 0.2 1 Ambient 1 0.2 0.0392157 0.0392157 1 Specular 0 1 0.2 0.2 1 Emissive 0 1 0.2 0.2 1 Shininess 0 45 ” primitiveType=”DEFAULT” blendEquation=”GL_FUNC_ADD” sfactor=”GL_SRC_ALPHA” dfactor=”GL_ONE_MINUS_SRC_ALPHA” /> <RigidMapping template=”Rigid3d,ExtVec3f” name=”MM->VM mapping” input=”@../” output=”@./” /> </Node> <Node name=”CollisionModel” > <MechanicalObject template=”Vec3d” name=”Particle” position=”-0.2 -0.2 -0.2″ velocity=”0 0 0″ force=”0 0 0″ externalForce=”0 0 0″ restScale=”1″ /> <TPointModel template=”Vec3d” name=”ParticleModel” tags=”CarvingTool” contactStiffness=”2″ /> <RigidMapping template=”Rigid3d,Vec3d” name=”MM->CM mapping” input=”@../” output=”@./” /> </Node> <VectorSpringForceField template=”Vec3d” stiffness=”10″ viscosity=”0″ object1=”@Omni/RefModel/instrumentCollisionState” /> <JointSpringForceField template=”Rigid3d” name=”jointSpringFF4″ spring=”BEGIN_SPRING 0 0 END_SPRING ” object1=”@Omni” object2=”@instrumentState” /> </Node> </Node>
19 February 2017 at 15:02 #8623SenBlockedWhy I can use the mouse to carve,Not by by phantom device
20 February 2017 at 12:09 #8631HugoKeymasterHi Sen,
First, indenting you file would help the reading.
Moreover, that’s already quite a large scene to debut remotely.Can you move the phantom in the scene ?
Are the collisions well detected and do you get force feedback ?
Is there any message in the command window when you start the scene ?You know there is a more recent plugin dealing with Geomagic haptic devices. Have a look here. I can only advise you to use it, there is example how to use it.
Cheers,
Hugo
13 January 2021 at 05:34 #18197DavacasBlockedHello, everyone.
I think I’m having the same doubt as Sen. I have a scene where I can carve and interact with an object with my mouse, but I would like to do both things a Phantom Device, like this. At the moment, I can interact with the object and get force feedback with the Phantom device, but I don’t know how to make the carving work.
I found that you should be able to do this with the SofaCarving plugin, but I can’t find any information about it, so any pointers would be very appreciated.
To answer Hugo’s questions, yes, I can move the Phantom in the scene, I do get force feedback and I’m not getting any errors or warnings in the console.
Thanks in advance!
24 February 2021 at 23:00 #18740DavacasBlockedI know I’m over four years late, but I think I solved it and I would like to share my solution for anyone who’s having the same problem.
<?xml version="1.0" ?> <Node name="root" dt="0.05" showBoundingTree="0" gravity="0 0 0"> <RequiredPlugin name="SofaOpenglVisual"/> <RequiredPlugin name='SofaMiscCollision'/> <RequiredPlugin name="Geomagic"/> <RequiredPlugin name='SofaHaptics'/> <RequiredPlugin name="SofaCarving" /> <VisualStyle displayFlags="" /> <DefaultPipeline verbose="0" /> <BruteForceDetection name="N2" /> <DefaultContactManager name="response" response="FrictionContact" /> <MinProximityIntersection name="Proximity" alarmDistance="0.08" contactDistance="0.05" useSurfaceNormals="false"/> <LocalMinDistance name="proximity" alarmDistance="0.15" contactDistance="0.05" angleCone="0.1" /> <GeomagicDriver name="GeomagicDevice" deviceName="Default Device" scale="1" drawDevice="0" drawDeviceFrame="0" positionBase="1 0 5" orientationBase="0 0 0 1" /> <LCPConstraintSolver tolerance="0.001" maxIt="1000"/> <FreeMotionAnimationLoop/> <CarvingManager active="true" carvingDistance="0.1"/> <Node name="Tumor"> <EulerImplicitSolver name="cg_odesolver" printLog="false" rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver name="linear solver" iterations="25" tolerance="1.0e-9" threshold="1.0e-9" /> <MeshGmshLoader name="loader" filename="./Modelos/MSH/TumorLimpio500faces_2.msh" /> <MechanicalObject src="@loader" name="Volume" /> <include href="Objects/TetrahedronSetTopology.xml" src="@loader" /> <DiagonalMass massDensity="1" /> <TetrahedralCorotationalFEMForceField name="CFEM" youngModulus="360" poissonRatio="0.3" method="large" /> <FixedConstraint indices="180 200 212 148 203 215 228 155 193 232 99 134 12" /> <PrecomputedConstraintCorrection recompute="true"/> <Node name="T"> <include href="Objects/TriangleSetTopology.xml" /> <Tetra2TriangleTopologicalMapping input="@../Container" output="@Container" /> <TriangleCollisionModel tags="CarvingSurface"/> <Node name="Visual"> <OglModel name="VisualModel" color="red"/> <IdentityMapping input="@../../Volume" output="@VisualModel" /> </Node> </Node> </Node> <Node name="Omni"> <MechanicalObject template="Rigid3d" name="DOFs" position="@GeomagicDevice.positionDevice"/> <MechanicalStateController template="Rigid3d" listening="true" mainDirection="-1.0 0.0 0.0" handleEventTriggersUpdate="true"/> </Node> <Node name="Instrument" > <EulerImplicitSolver name="cg_odesolver" printLog="false" /> <CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" /> <MechanicalObject template="Rigid3d" name="instrumentState" position="@GeomagicDevice.positionDevice" /> <UniformMass name="mass" totalMass="0.5" /> <LCPForceFeedback activate="true" forceCoef="3"/> <!-- ADDED : Compute a force-feedback for the device --> <UncoupledConstraintCorrection/> <Node name="VisualModel" > <MeshObjLoader name="meshLoader_0" filename="mesh/dental_instrument_light.obj" translation="-0.412256 -0.067639 3.35" rotation="180 0 150" handleSeams="1" /> <OglModel name="InstrumentVisualModel" src="@meshLoader_0" /> <RigidMapping name="MM->VM mapping" input="@instrumentState" output="@InstrumentVisualModel" /> </Node> <Node name="CollisionModel" > <MechanicalObject name="Particle" position="-0.2 -0.2 -0.2" /> <PointCollisionModel name="ParticleModel" contactStiffness="2" tags="CarvingTool" /> <RigidMapping name="MM->CM mapping" input="@instrumentState" output="@Particle" /> </Node> </Node> </Node>
This should let you touch a tetrahedron, give some haptic feedback and almost immediately make that tetrahedron and the feedback disappear, simulating carving and touching all at once.
-
AuthorPosts
- You must be logged in to reply to this topic.