Forum Replies Created
-
AuthorPosts
-
yupengBlocked
The error didn’t reappear anymore when I using
SphereCollsionModel
as the first template parameter inNeedleContact.cpp
.Creator<sofa::core::collision::Contact::Factory, NeedleContact< SphereCollisionModel<sofa::defaulttype::Vec3Types>, PointCollisionModel<sofa::defaulttype::Vec3Types>> > PointSphereNeedleContactClass("NeedleContact", true); Creator<sofa::core::collision::Contact::Factory, NeedleContact< SphereCollisionModel<sofa::defaulttype::Vec3Types>, LineCollisionModel<sofa::defaulttype::Vec3Types>> > LineSphereNeedleContactClass("NeedleContact", true);
But the haptic force is too large and not stable.
LCPConstraintSolver.cpp
Functionnlcp_gaussseidel_unbuild
spites outmsg_error()<< " WARNING dim should be dividable by 3 in nlcp_gaussseidel"
yupengBlockedDear @Hugo,
Thanks for your kind advice.You said people didn’t use Tetra as a collision model, then how did they know which Tetra contains needle points? Is there a more convenient approach to do that?
@agnesenardi, I am also working on this simulation, maybe we could collaborate and see what we could do.yupengBlockedHi @Hugo,
Using the scene file you proposed, I could use the
TetrahedronCollisionmodel
now. But, when the haptic device (PointCollisionModel
) contacts with liver, the program corrupt. I found it has a relation with the mapping method.When detecting a collision, the Mapper for
TetrahedronCollisionModel
(derived fromBarycentricContactMapper
) would create aBarycentricMapperMeshTopology
from TetrahedronCollisionModel’s topology which isnullptr
.// model->getCollisionTopology() is nullptr mapper = sofa::core::objectmodel::New<mapping::BarycentricMapperMeshTopology<InDataTypes, typename BarycentricContactMapper::DataTypes> >(model->getCollisionTopology(), (topology::PointSetTopologyContainer*)nullptr); //call stack is as bellow SofaMiscCollision.dll!sofa::component::collision::BarycentricContactMapper<sofa::component::collision::TetrahedronCollisionModel,sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>>::createMapping(const char * name) Line 74 C++
This topology would be used when function
apply()
called.
The debugging call stack is as follow:SofaCore.dll!sofa::core::topology::BaseMeshTopology::getLines() Line 237 C++ SofaBaseMechanics.dll!sofa::component::mapping::BarycentricMapperMeshTopology<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>,sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>>::apply(sofa::helper::vector<sofa::defaulttype::Vec<3,double>,sofa::helper::CPUMemoryManager<sofa::defaulttype::Vec<3,double>>> & out, const sofa::helper::vector<sofa::defaulttype::Vec<3,double>,sofa::helper::CPUMemoryManager<sofa::defaulttype::Vec<3,double>>> & in) Line 1027 C++ SofaBaseMechanics.dll!sofa::component::mapping::BarycentricMapping<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>,sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>>::apply(const sofa::core::MechanicalParams * mparams, sofa::core::objectmodel::Data<sofa::helper::vector<sofa::defaulttype::Vec<3,double>,sofa::helper::CPUMemoryManager<sofa::defaulttype::Vec<3,double>>>> & out, const sofa::core::objectmodel::Data<sofa::helper::vector<sofa::defaulttype::Vec<3,double>,sofa::helper::CPUMemoryManager<sofa::defaulttype::Vec<3,double>>>> & in) Line 308 C++ SofaCore.dll!sofa::core::Mapping<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>,sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>>::apply(const sofa::core::MechanicalParams * mparams, sofa::core::TMultiVecId<1,1> outPos, sofa::core::TMultiVecId<1,0> inPos) Line 157 C++ SofaMiscCollision.dll!sofa::component::collision::BarycentricContactMapper<sofa::component::collision::TetrahedronCollisionModel,sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>>::update() Line 101 C++ SofaMiscCollision.dll!sofa::component::collision::FrictionContact<sofa::component::collision::TetrahedronCollisionModel,sofa::component::collision::PointCollisionModel<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>>,sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>>::activateMappers() Line 205 C++ SofaMiscCollision.dll!sofa::component::collision::FrictionContact<sofa::component::collision::TetrahedronCollisionModel,sofa::component::collision::PointCollisionModel<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>>,sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>>::createResponse(sofa::core::objectmodel::BaseContext * group) Line 215 C++ SofaBaseCollision.dll!sofa::component::collision::DefaultPipeline::doCollisionResponse() Line 260 C++ SofaSimulationCore.dll!sofa::simulation::PipelineImpl::computeCollisionResponse() Line 126 C++ [Inline Frame] SofaSimulationCore.dll!sofa::simulation::Visitor::for_each(sofa::simulation::CollisionVisitor *) Line 118 C++ SofaSimulationCore.dll!sofa::simulation::CollisionVisitor::processNodeTopDown(sofa::simulation::Node * node) Line 36 C++ SofaSimulationGraph.dll!sofa::simulation::graph::DAGNode::executeVisitorTopDown(sofa::simulation::Visitor * action, std::list<sofa::simulation::graph::DAGNode *,std::allocator<sofa::simulation::graph::DAGNode *>> & executedNodes, std::map<sofa::simulation::graph::DAGNode *,sofa::simulation::graph::DAGNode::StatusStruct,std::less<sofa::simulation::graph::DAGNode *>,std::allocator<std::pair<sofa::simulation::graph::DAGNode * const,sofa::simulation::graph::DAGNode::StatusStruct>>> & statusMap, sofa::simulation::graph::DAGNode * visitorRoot) Line 693 C++ SofaSimulationGraph.dll!sofa::simulation::graph::DAGNode::doExecuteVisitor(sofa::simulation::Visitor * action, bool precomputedOrder) Line 612 C++ SofaSimulationCore.dll!sofa::simulation::CollisionAnimationLoop::computeCollision(const sofa::core::ExecParams * params) Line 76 C++ SofaConstraint.dll!sofa::component::animationloop::FreeMotionAnimationLoop::step(const sofa::core::ExecParams * params, double dt) Line 234 C++ SofaSimulationCore.dll!sofa::simulation::Simulation::animate(sofa::simulation::Node * root, double dt) Line 245 C++ SofaGuiQt.dll!sofa::gui::qt::RealGUI::step() Line 2147 C++
The scene file is updated here
16 January 2021 at 15:52 in reply to: [SOLVED] Geomagic Plugin: Printing haptic force in Console #18238yupengBlocked17 December 2020 at 10:58 in reply to: [SOLVED] Geomagic Plugin: Printing haptic force in Console #18047yupengBlockedOh, I make a stupid mistake: choosing the wrong component when clicking
printlog
. The precedure above is right. I could print out the haptic force.What’s more, how can I store the haptic force into a file?
yupengBlocked@Hugo, Thanks for your reply. It helps a lot.
I’ve read the paper you suggested. And I’m trying to implement the method in it.About the code, I wonder how can I register TetrahedronDiscreteIntersection into the factory. The error log is shown as the first post.
yupengBlockedHi @Hugo, thanks for your reply.
The function of TetrahedronDiscreteIntersection is just what I want to use.
When my needle inserts into the tet mesh, I have to determine which tetrahedron collides with the needle (represented as a point collision model currently).
However, there are no intersection methods that can handle this. -
AuthorPosts