Home › Forum › SOFA › Using SOFA › [SOLVED] Geomagic Plugin in cpp with SofaCarving
Tagged: 64_bits, SOFA_1806, using sofa, Windows_10
- This topic has 20 replies, 3 voices, and was last updated 6 years, 1 month ago by Harris.
-
AuthorPosts
-
24 September 2018 at 22:50 #12000HarrisBlocked
Hi,
I am making a simulation in c++ and I am trying to combine SofaCarving and Geomagic Plugins(the latest ).While SofaCarving worked well(using CarvingManager), Geomagic produces the following error:LNK2019 Error unresolved external symbol “public: __cdecl sofa::component::controller::GeomagicDriver::GeomagicDriver(void)” (??0GeomagicDriver@controller@component@sofa@@QEAA@XZ) referenced in function “public: __cdecl sofa::core::objectmodel::New::New(void)” (??$?0$$V@?$New@VGeomagicDriver@controller@component@sofa@@@objectmodel@core@sofa@@QEAA@XZ) runSofa
I added Geomagic.lib (properties->linker->input) but the problem still exists.
My code in c++ is the following:sofa::component::controller::GeomagicDriver::SPtr geomDriver= sofa::core::objectmodel::New(); geomDriver->setName(“GeomagicDevice”); geomDriver->d_deviceName.setValue(“Default Device”); geomDriver->d_scale.setValue(1); geomDriver->d_frameVisu.setValue(true); geomDriver->d_positionBase.setValue(sofa::defaulttype::Vector3(0, 0, 0)); //drawDevice geomDriver->d_orientationBase.setValue(sofa::defaulttype::Quat(0, 0.707, 0,-0.707)); groot->addObject(geomDriver);
I ran the demo Geomagic-FEM in XML and it works.
Could you help me solve this problem?Thank you,
Harris25 September 2018 at 09:07 #12003HugoKeymasterHi Harris
instead of your first line:
sofa::component::controller::GeomagicDriver::SPtr geomDriver= sofa::core::objectmodel::New();
I would write:
sofa::component::controller::GeomagicDriver::SPtr geomDriver = addNew<sofa::component::controller::GeomagicDriver>(groot);
This should work.
Best,Hugo
25 September 2018 at 12:53 #12005HarrisBlockedHi Hugo,
I wrote :
sofa::component::controller::GeomagicDriver::SPtr geomDriver = sofa::modeling::addNew <sofa::component::controller::GeomagicDriver>(groot);
but now I have the following error:
LNK2019 Error unresolved external symbol “public: __cdecl sofa::component::controller::GeomagicDriver::GeomagicDriver(void)” (??0GeomagicDriver@controller@component@sofa@@QEAA@XZ) referenced in function “public: __cdecl sofa::modeling::addNew<class sofa::component::controller::GeomagicDriver>::addNew<class sofa::component::controller::GeomagicDriver>(class boost::intrusive_ptr<class sofa::simulation::Node>,char const *)” (??0?$addNew@VGeomagicDriver@controller@component@sofa@@@modeling@sofa@@QEAA@V?$intrusive_ptr@VNode@simulation@sofa@@@boost@@PEBD@Z)
Thank you for your time,
Harris25 September 2018 at 16:03 #12009HugoKeymasterHi Harris,
Is this c++ code somewhere in one of your own plugins?
If yes, did you check in the CMakeLists.txt of this plugin that it correctly depends on the Geomagic plugin?Hugo
25 September 2018 at 16:21 #12011HarrisBlockedHi Hugo,
No, I wrote this code in runSofa project in Main.cpp.
I only added additional dependencie : Geomagic.lib and the
I did the same for the SofaCarving and I did not had a problem.Harris
25 September 2018 at 16:47 #12014HugoKeymasterHi Harris
You mean that you add in the simulation created in runSofa, new components like the GeomagicDriver?
And what do you mean exactly by “I did the same for the SofaCarving and I did not had a problem”. Could you show the corresponding lines of code?
Instead of overwriting runSofa, I would rather advise you later to create your own plugin/applications separately from SOFA. See the doc.
Cheers
Hugo
25 September 2018 at 17:15 #12016HarrisBlockedHi Hugo,
Yes I tried to implement Geomagic-FEMLiver.scn (the whole scene) in c++ to see how it works because I need it in my c++ application.
Before I implemented in c++ the SimpleCarving_withPenetration.scn (the whole scene) without errors.
Here is the code:sofa::component::collision::CarvingManager::SPtr carv= sofa::core::objectmodel::New<sofa::component::collision::CarvingManager>();
carv->d_active.setValue(true);
carv->d_carvingDistance.setValue(-0.09);
carv->setName(“carving”);
groot->addObject(carv);I also added the CarvingSurface and CarvingTool.
In addition, before start implementing the components of the scene I wrote this code for loading the plugins:
vector<string> plugins;
//ADD PLUGINS: SofaCarving , Geomagic
plugins.push_back(“SofaCarving”);
plugins.push_back(“Geomagic”);
and the plugins are loaded.I know I have to create my own plugin but for now I wanted to just check if I can implement all the components that I need in cpp.
Harris
25 September 2018 at 17:34 #12017HarrisBlockedHi Hugo,
I just informed by Eric Pernod from InfinityTech3D that there is a bug in the export dll of sofa geomagic plugin and tha it will be fixed in this week.
Best,
Harris25 September 2018 at 17:35 #12018HugoKeymasterHi Harris,
As Erik wrote you privately, it might be related to a current issue with the Geomagic plugin. A PR will be done within the week. Stay tuned, you’ll be able to test the fix very soon.
Cheers
Hugo
3 October 2018 at 20:43 #12090HarrisBlockedHi,
I tested the fix and now I do not have a problem.
However, I can’t write the following XML line:
<MechanicalObject template=”Rigid” name=”DOFs” position=”@GeomagicDevice.positionDevice”/>
in cpp.I can’t find a way to add a tag to the position of the MechanicalObject.
Could you help me?
Thank you,
Harris3 October 2018 at 20:48 #12092HugoKeymaster3 October 2018 at 21:05 #12093HarrisBlockedHi Hugo,
I don’t get an error but as I ran the Geomagic-FEMLiver.scn,I saw in the node of the Mechanical object that its position is the same with @GeomagicDevice.positionDevice.So I want to do the same in cpp but I can not make this connection between Mechanical Object and Geomagic Device.
Harris
11 October 2018 at 16:09 #12162HarrisBlockedHi,
I solved the problem that I asked in the previous post.
Now, I can move the device in the scene but when the device collides with an object of the scene, I have the following error:
Exception thrown at 0x00007FFCCE6BF070 (SofaBaseMechanics.dll) in runSofa.exe: 0xC0000005: Access violation reading location 0x00000000000007F8.
I tried to write in cpp all the components decribed in: Geomagic-RigidSkull.scn and only the component “FreeMotionAnimationLoop” I couldn’t write.(I had an error with the constructor)
Could you help me fix this error?
Thank you,
Harris12 October 2018 at 12:06 #12173HugoKeymasterHi @hkomninos,
it appears that you are having an issue due to an wrong access in memory (un-initialized vector, or pointer). The creation of the FreeMotionAnimationLoop should not be an issue in cpp. Could you share with us you cpp scene ?
Best
Hugo
12 October 2018 at 12:45 #12177HarrisBlockedHi Hugo,
here is my cpp scene:
Node::SPtr groot = sofa::simulation::getSimulation()->createNewGraph("Root"); groot->setGravity(sofa::defaulttype::Vector3(0, -9.81, 0)); groot->setDt(0.005); sofa::component::visualmodel::VisualStyle::SPtr style = sofa::core::objectmodel::New<sofa::component::visualmodel::VisualStyle>(); sofa::core::visual::DisplayFlags& flags = *style->displayFlags.beginEdit(); flags.setShowCollisionModels(true); flags.setShowVisualModels(false); style->displayFlags.endEdit(); groot->addObject(style); sofa::component::collision::DefaultPipeline::SPtr pipeline = sofa::core::objectmodel::New<sofa::component::collision::DefaultPipeline>(); pipeline->setName("CollisionPipeline"); pipeline->d_depth.setValue(6); groot->addObject(pipeline); sofa::component::collision::BruteForceDetection::SPtr bruteforce = sofa::core::objectmodel::New<sofa::component::collision::BruteForceDetection>(); bruteforce->setName("N2"); groot->addObject(bruteforce); sofa::component::collision::DefaultContactManager::SPtr response = sofa::core::objectmodel::New<sofa::component::collision::DefaultContactManager>(); response->setName("Collision Response"); response->setDefaultResponseType("FrictionContact"); //response->response.setName("FrictionContact"); groot->addObject(response); sofa::component::collision::LocalMinDistance::SPtr localMinDist = sofa::core::objectmodel::New<sofa::component::collision::LocalMinDistance>(); localMinDist->setName("Proximity"); localMinDist->alarmDistance.setValue(0.15); localMinDist->contactDistance.setValue(0.05); localMinDist->angleCone.setValue(0.0); //localMinDist->coneFactor.setValue(0.5); groot->addObject(localMinDist); sofa::component::constraintset::LCPConstraintSolver::SPtr lpcSolver = sofa::core::objectmodel::New<sofa::component::constraintset::LCPConstraintSolver>(); lpcSolver->tol.setValue(0.001); lpcSolver->maxIt.setValue(1000); lpcSolver->mu.setValue(0.6); groot->addObject(lpcSolver); sofa::component::controller::GeomagicDriver::SPtr geomDriver = sofa::core::objectmodel::New<sofa::component::controller::GeomagicDriver>(); geomDriver->setName("GeomagicDevice"); geomDriver->d_deviceName.setValue("Default Device"); geomDriver->d_scale.setValue(1); geomDriver->d_frameVisu.setValue(true); geomDriver->d_positionBase.setValue(sofa::defaulttype::Vector3(0, 0, 0)); geomDriver->d_orientationBase.setValue(sofa::defaulttype::Quat(0, 0.707, 0, - 0.707)); geomDriver->f_listening.setValue(true); groot->addObject(geomDriver); /*-----------------Rigid Obj----------------------------------------*/ sofa::simulation::Node::SPtr thoracNode = groot.get()->createChild("Rigid-SKull"); //Collision sofa::simulation::Node::SPtr thoracsurf = thoracNode.get()->createChild("Thorac Surf"); //ObjLoader (coarser) sofa::component::loader::MeshObjLoader::SPtr thoracLoader = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); thoracLoader->setFilename(sofa::helper::system::DataRepository.getFile("mesh/diploma/liver-smooth.obj")); thoracLoader->load(); thoracsurf->addObject(thoracLoader); //Topology sofa::component::topology::MeshTopology::SPtr thoracTopology = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); thoracTopology->setSrc("", thoracLoader.get()); thoracsurf->addObject(thoracTopology); //Mechanical Obj MechanicalObject3::SPtr thoracMech = sofa::core::objectmodel::New<MechanicalObject3>(); thoracMech->setName("instrumentCollisionState"); thoracMech->setSrc("", thoracLoader.get()); thoracMech->setTranslation(0, 0, 10); thoracsurf->addObject(thoracMech); //Triangle TTriangle_3::SPtr thoracTrian = sofa::core::objectmodel::New<TTriangle_3>(); thoracTrian->setName("Triangles"); thoracTrian->setContactStiffness(100); thoracTrian->setContactFriction(0.01); thoracTrian->setSimulated(false); thoracTrian->setMoving(false); thoracsurf->addObject(thoracTrian); //Line TLine_3::SPtr thoracLines = sofa::core::objectmodel::New<TLine_3>(); thoracLines->setName("Lines"); thoracLines->setContactStiffness(100); thoracLines->setSimulated(false); thoracLines->setContactFriction(0.01); thoracLines->setMoving(false); thoracsurf->addObject(thoracLines); //Point TPoint_3::SPtr thoracPoints = sofa::core::objectmodel::New<TPoint_3>(); thoracPoints->setName("Points"); thoracPoints->setContactStiffness(100); thoracPoints->setContactFriction(0.01); thoracPoints->setSimulated(false); thoracPoints->setMoving(false); thoracsurf->addObject(thoracPoints); /*---------------------------Omni---------------------------------------------------*/ sofa::simulation::Node::SPtr carvingElement = groot.get()->createChild("Omni"); MechanicalObjectRigid3::SPtr dofRigid = sofa::core::objectmodel::New<MechanicalObjectRigid3>(); dofRigid->setName("DofsRigid"); dofRigid->x.setParent(geomDriver->d_posDevice.getData()); carvingElement->addObject(dofRigid); //MechanicalStateController sofa::component::controller::MechanicalStateController<sofa::defaulttype::Rigid3dTypes>::SPtr controller = sofa::core::objectmodel::New<sofa::component::controller::MechanicalStateController<sofa::defaulttype::Rigid3dTypes>>(); controller->f_listening.setValue(true); controller->setMainDirection(sofa::defaulttype::Vec3d(-1, 0, 0)); controller->handleEventTriggersUpdate.setValue(true); carvingElement->addObject(controller); sofa::simulation::Node::SPtr visuAvatar = carvingElement.get()->createChild("VisuAvatar"); visuAvatar->setActive(false); OglModel::SPtr visual1 = sofa::core::objectmodel::New<OglModel>(); visual1->setName("Visual"); visual1->load(sofa::helper::system::DataRepository.getFile("mesh/sphere.obj"), "", ""); visual1->setColor("gray"); visual1->setScale(0.1, 0.1, 0.1); visuAvatar->addObject(visual1); //RigidMapping RigidMapping_Rigid_to_Extevec3F::SPtr rigidMap2 = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Extevec3F>(); rigidMap2->setName("VM Mapping"); rigidMap2->setModels(dofRigid.get(), visual1.get()); visuAvatar->addObject(rigidMap2); sofa::simulation::Node::SPtr refModel = carvingElement.get()->createChild("RefModel"); sofa::component::loader::MeshObjLoader::SPtr loaderFixed = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); loaderFixed->setFilename(sofa::helper::system::DataRepository.getFile("mesh/dental_instrument_centerline.obj")); loaderFixed->load(); refModel->addObject(loaderFixed); sofa::component::topology::MeshTopology::SPtr meshTorusFEM = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); meshTorusFEM->setSrc("", loaderFixed.get()); refModel->addObject(meshTorusFEM); MechanicalObject3::SPtr instrumentColState = sofa::core::objectmodel::New<MechanicalObject3>(); instrumentColState->setName("instrumentCollisionState"); instrumentColState->setSrc("", loaderFixed.get()); instrumentColState->setRotation(0, -180, -90); instrumentColState->setTranslation(-0.3, 0, 3.5); refModel->addObject(instrumentColState); RigidMapping_Rigid_to_Vec3d::SPtr rigidMap3 = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Vec3d>(); rigidMap3->setModels(dofRigid.get(), instrumentColState.get()); refModel->addObject(rigidMap3); sofa::simulation::Node::SPtr refModelRight = carvingElement.get()->createChild("RefModelRight"); sofa::component::loader::MeshObjLoader::SPtr loaderFixedright = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); loaderFixedright->setFilename(sofa::helper::system::DataRepository.getFile("mesh/dental_instrument_centerline.obj")); loaderFixedright->load(); refModelRight->addObject(loaderFixedright); sofa::component::topology::MeshTopology::SPtr meshTorusFEMRight = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); meshTorusFEMRight->setSrc("", loaderFixedright.get()); refModelRight->addObject(meshTorusFEMRight); MechanicalObject3::SPtr instrumentColStateRight = sofa::core::objectmodel::New<MechanicalObject3>(); instrumentColStateRight->setName("instrumentCollisionState"); instrumentColStateRight->setSrc("", loaderFixedright.get()); instrumentColStateRight->setRotation(0, -180, -90); instrumentColStateRight->setTranslation(-0.3, 0.5, 3.5); refModelRight->addObject(instrumentColStateRight); RigidMapping_Rigid_to_Vec3d::SPtr rigidMap3right = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Vec3d>(); rigidMap3right->setModels(dofRigid.get(), instrumentColStateRight.get()); refModelRight->addObject(rigidMap3right); sofa::simulation::Node::SPtr refModelleft = carvingElement.get()->createChild("RefModelLeft"); sofa::component::loader::MeshObjLoader::SPtr loaderFixedleft = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); loaderFixedleft->setFilename(sofa::helper::system::DataRepository.getFile("mesh/dental_instrument_centerline.obj")); loaderFixedleft->load(); refModelleft->addObject(loaderFixedleft); sofa::component::topology::MeshTopology::SPtr meshTorusFEMleft = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); meshTorusFEMleft->setSrc("", loaderFixedleft.get()); refModelleft->addObject(meshTorusFEMleft); MechanicalObject3::SPtr instrumentColStateleft = sofa::core::objectmodel::New<MechanicalObject3>(); instrumentColStateleft->setName("instrumentCollisionState"); instrumentColStateleft->setSrc("", loaderFixedleft.get()); instrumentColStateleft->setRotation(0, -180, -90); instrumentColStateleft->setTranslation(-0.3, -0.5, 3.5); refModelleft->addObject(instrumentColStateleft); RigidMapping_Rigid_to_Vec3d::SPtr rigidMap3left = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Vec3d>(); rigidMap3left->setModels(dofRigid.get(), instrumentColStateleft.get()); refModelleft->addObject(rigidMap3left); /*------------------------Instrument---------------------------------------------*/ sofa::simulation::Node::SPtr instrum = groot.get()->createChild("Instrument"); EulerImplicitSolver::SPtr solverInstrum = sofa::core::objectmodel::New<EulerImplicitSolver>(); solverInstrum->setName("ODE solver"); solverInstrum->f_rayleighStiffness.setValue(0.05); solverInstrum->f_rayleighMass.setValue(1.0); instrum->addObject(solverInstrum); CGLinearSolver3::SPtr linearSolverIntrum = sofa::core::objectmodel::New<CGLinearSolver3>(); linearSolverIntrum->setName("linear solver"); linearSolverIntrum->f_maxIter.setValue(25); linearSolverIntrum->f_tolerance.setValue(1e-10); linearSolverIntrum->f_smallDenominatorThreshold.setValue(10e-10); instrum->addObject(linearSolverIntrum); MechanicalObjectRigid3::SPtr dofRigidInstrum = sofa::core::objectmodel::New<MechanicalObjectRigid3>(); dofRigidInstrum->setName("instrumentState"); dofRigidInstrum->x.setParent(geomDriver->d_posDevice.getData()); instrum->addObject(dofRigidInstrum); UniformMassRigid3::SPtr uniMassCarvInstrum = sofa::core::objectmodel::New<UniformMassRigid3>(); uniMassCarvInstrum->setTotalMass(0.05); uniMassCarvInstrum->setName("Mass"); instrum->addObject(uniMassCarvInstrum); sofa::component::controller::LCPForceFeedback<sofa::defaulttype::Rigid3dTypes>::SPtr lcpContr = sofa::core::objectmodel::New<sofa::component::controller::LCPForceFeedback<sofa::defaulttype::Rigid3dTypes>>(); lcpContr->f_activate.setValue(true); lcpContr->forceCoef.setValue(0.001); instrum->addObject(lcpContr); sofa::component::constraintset::UncoupledConstraintCorrection<sofa::defaulttype::Rigid3dTypes>::SPtr constrUncoup= sofa::core::objectmodel::New<sofa::component::constraintset::UncoupledConstraintCorrection<sofa::defaulttype::Rigid3dTypes>>(); instrum->addObject(constrUncoup); sofa::simulation::Node::SPtr collModelInstrument = instrum.get()->createChild("CollisionModel"); sofa::component::loader::MeshObjLoader::SPtr loaderColl = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); loaderColl->setName("loader"); loaderColl->setFilename(sofa::helper::system::DataRepository.getFile("mesh/dental_instrument_centerline.obj")); loaderColl->load(); collModelInstrument->addObject(loaderColl); sofa::component::topology::MeshTopology::SPtr meshColl = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); meshColl->setSrc("", loaderColl.get()); collModelInstrument->addObject(meshColl); MechanicalObject3::SPtr mechColl = sofa::core::objectmodel::New<MechanicalObject3>(); mechColl->setName("instrumentCollisionState"); mechColl->setSrc("", loaderColl.get()); mechColl->setRotation(0, -180, -90); mechColl->setTranslation(-0.3, 0, 3.5); collModelInstrument->addObject(mechColl); //Lines TLine_3::SPtr line_coll_instr = sofa::core::objectmodel::New<TLine_3>(); line_coll_instr->setName("Lines"); line_coll_instr->setContactStiffness(10.0); line_coll_instr->setContactFriction(0.01); collModelInstrument->addObject(line_coll_instr); //Points TPoint_3::SPtr points_col_instr = sofa::core::objectmodel::New<TPoint_3>(); points_col_instr->setName("Points"); points_col_instr->setContactStiffness(10.0); points_col_instr->setContactFriction(0.01); collModelInstrument->addObject(points_col_instr); //RigidMapping RigidMapping_Rigid_to_Vec3d::SPtr rigidMapInstrCol = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Vec3d>(); rigidMapInstrCol->setName("VM Mapping"); rigidMapInstrCol->setModels(dofRigidInstrum.get(), mechColl.get()); collModelInstrument->addObject(rigidMapInstrCol); //Right sofa::simulation::Node::SPtr collModelInstrumentRight = instrum.get()->createChild("RefModelRight"); sofa::component::loader::MeshObjLoader::SPtr loaderCollRight = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); loaderCollRight->setFilename(sofa::helper::system::DataRepository.getFile("mesh/dental_instrument_centerline.obj")); loaderCollRight->load(); collModelInstrumentRight->addObject(loaderCollRight); sofa::component::topology::MeshTopology::SPtr meshCollRight = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); meshCollRight->setSrc("", loaderCollRight.get()); collModelInstrumentRight->addObject(meshCollRight); MechanicalObject3::SPtr mechCollRight = sofa::core::objectmodel::New<MechanicalObject3>(); mechCollRight->setName("instrumentCollisionState"); mechCollRight->setSrc("", loaderCollRight.get()); mechCollRight->setRotation(0, -180, -90); mechCollRight->setTranslation(-0.3, 0.5, 3.5); collModelInstrumentRight->addObject(mechCollRight); //RigidMapping RigidMapping_Rigid_to_Vec3d::SPtr rigidMapInstrColRight = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Vec3d>(); rigidMapInstrColRight->setName("VM Mapping"); rigidMapInstrColRight->setModels(dofRigidInstrum.get(), mechCollRight.get()); collModelInstrumentRight->addObject(rigidMapInstrColRight); //Left sofa::simulation::Node::SPtr collModelInstrumentLeft = instrum.get()->createChild("RefModelLeft"); sofa::component::loader::MeshObjLoader::SPtr loaderCollLeft = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); loaderCollLeft->setFilename(sofa::helper::system::DataRepository.getFile("mesh/dental_instrument_centerline.obj")); loaderCollLeft->load(); collModelInstrumentLeft->addObject(loaderCollLeft); sofa::component::topology::MeshTopology::SPtr meshCollLeft = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); meshCollLeft->setSrc("", loaderCollLeft.get()); collModelInstrumentLeft->addObject(meshCollLeft); MechanicalObject3::SPtr mechCollLeft = sofa::core::objectmodel::New<MechanicalObject3>(); mechCollLeft->setName("instrumentCollisionState"); mechCollLeft->setSrc("", loaderCollLeft.get()); mechCollLeft->setRotation(0, -180, -90); mechCollLeft->setTranslation(-0.3, -0.5, 3.5); collModelInstrumentLeft->addObject(mechCollLeft); //RigidMapping RigidMapping_Rigid_to_Vec3d::SPtr rigidMapInstrColLeft = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Vec3d>(); rigidMapInstrColLeft->setName("VM Mapping"); rigidMapInstrColLeft->setModels(dofRigidInstrum.get(), mechCollLeft.get()); collModelInstrumentLeft->addObject(rigidMapInstrColLeft); //VectorSpringForceField sofa::component::interactionforcefield::VectorSpringForceField<sofa::defaulttype::Vec3dTypes>::SPtr vSpringForc = sofa::core::objectmodel::New<sofa::component::interactionforcefield::VectorSpringForceField<sofa::defaulttype::Vec3dTypes>>(); //vSpringForc->addTag() vSpringForc->setPathObject1("@Omni/RefModel/instrumentCollisionState"); vSpringForc->setPathObject2("@Instrument/CollisionModel/instrumentCollisionState"); vSpringForc->m_stiffness.setValue(10); vSpringForc->m_viscosity.setValue(0); instrum->addObject(vSpringForc); sofa::component::interactionforcefield::VectorSpringForceField<sofa::defaulttype::Vec3dTypes>::SPtr vSpringForc2 = sofa::core::objectmodel::New<sofa::component::interactionforcefield::VectorSpringForceField<sofa::defaulttype::Vec3dTypes>>(); vSpringForc2->setPathObject1("@Omni/RefModelRight/instrumentCollisionState"); vSpringForc2->setPathObject2("@Instrument/RefModelRight/instrumentCollisionState"); vSpringForc2->m_stiffness.setValue(10); vSpringForc2->m_viscosity.setValue(0); instrum->addObject(vSpringForc2); sofa::component::interactionforcefield::VectorSpringForceField<sofa::defaulttype::Vec3dTypes>::SPtr vSpringForc3 = sofa::core::objectmodel::New<sofa::component::interactionforcefield::VectorSpringForceField<sofa::defaulttype::Vec3dTypes>>(); vSpringForc3->setPathObject1("@Omni/RefModelLeft/instrumentCollisionState"); vSpringForc3->setPathObject2("@Instrument/RefModelLeft/instrumentCollisionState"); vSpringForc3->m_stiffness.setValue(10); vSpringForc3->m_viscosity.setValue(0); instrum->addObject(vSpringForc3);
In order to link the position of GeomagicDriver with the position og mechanical object(“Instrument”) I wrote:
“dofRigidInstrum->x.setParent(geomDriver->d_posDevice.getData());”
Is it possible when the objects (Rigid and Instrument) collide, mechanicalInstrument to conflict between the response of the collision and the position of the GeomagicDevice?Thank you for your time,
Harris14 October 2018 at 15:16 #12213WongBlockedHi @hkomninos,
FreeMotionAnimationLoop::SPtr loop = sofa::core::objectmodel::New<FreeMotionAnimationLoop>(groot.get()); loop->setName("Loop"); groot->addObject(loop);
16 October 2018 at 12:53 #12227HarrisBlockedHi @outtt,
Thank you for your help.Now I can use the haptic device.
Also, I want to do the carving with the hatic device.
I observed that “CollisionResponse” response=”default” in SofaCarving plugin but response=”FrictionContact” in Geomagic plugin.If I use response=”FrictionContact”,I get the following error when the carvingTool collides with carvingSurface:
Exception thrown at 0x00007FFF80F9B9BA (SofaConstraint.dll) in runSofa.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
Could you help me fix this?
Thank you,
Harris22 October 2018 at 11:47 #12252HarrisBlockedHi,
I solved the problems that I had before.
I would like to know how the component: “PrecomputedConstraintCorrection” works.
Is there any related paper which describes the functionality of this component?Best
Harris26 October 2018 at 18:18 #12275HugoKeymasterHi @hkomninos,
how did you solve your issue? what was the problem?
Regarding the PrecomputedConstraintCorrection, you can find some explanation in the updated doc.
I think the paper entitled “GPU-based real-time soft tissue deformation with cutting and haptic feedback” used it.
Best,
Hugo
29 October 2018 at 11:19 #12283HugoKeymasterSince it is solved, I mark it solved.
Do not hesitate to let me know whether the links were useful or the reason of your previous issue.Best
Hugo
30 October 2018 at 11:20 #12309HarrisBlockedHi Hugo,
I solved the problem that I mentioned in a previous message and some issues with the distance of the collision in Geomagic.
Also,thank you for the links I will check if the algorithms are exactly the same in a few days.
Could I ask you here for more theoretical and software issues in the future?Best,
Harris -
AuthorPosts
- You must be logged in to reply to this topic.