Home › Forum › SOFA › Programming with SOFA › [SOLVED] How to create my own contact class?
Tagged: Collsion Response, SOFA_2006, Windows_10
- This topic has 2 replies, 2 voices, and was last updated 3 years, 6 months ago by Hugo.
-
AuthorPosts
-
27 May 2021 at 07:46 #19582yupengBlocked
As I mentioned in this topic
I want to create a needle insertion application. I’ve talked with @hugo about this. We reach a consensus about the implementation.
Needle insertion step:
1. Before insertion, the soft tissue resists the insertion of the needle by creating
unilateralInteractionConstraint
2. When the contact force computed fromunilateralInteractionConstraint
beyond some threshold, we should create aslidingConstraint
other thanunilateralInteractionConstraint
.The creation of this kind of constraint is implemented in a contact class (for example
frictionContact
class). Thus, I create my own plugin which could create my own contact class:NeedleContact
and sliding constraint:NSlidingConstraint
.Then I start to use this scene to test my needle insertion plugin. When the tool has contacts with the soft tissue, I get the errors as below:
[INFO] [LCPcalc] dim should be dividable by 3 in nlcp_gaussseidel [ERROR] [DefaultContactManager(response)] Contact NeedleContact between SphereCollisionModel and PointCollisionModel creation failed Supported models for contact NeedleContact: NeedleContact<PointCollisionModel<StdVectorTypes<Vec<3,double>,Vec<3,double>,double> >,PointCollisionModel<StdVectorTypes<Vec<3,double>,Vec<3,double>,double> >,StdVectorTypes<Vec<3,double>,Vec<3,double>,double> > NeedleContact<PointCollisionModel<StdVectorTypes<Vec<3,double>,Vec<3,double>,double> >,SphereCollisionModel<StdVectorTypes<Vec<3,double>,Vec<3,double>,double> >,StdVectorTypes<Vec<3,double>,Vec<3,double>,double> > NeedleContact<LineCollisionModel<StdVectorTypes<Vec<3,double>,Vec<3,double>,double> >,SphereCollisionModel<StdVectorTypes<Vec<3,double>,Vec<3,double>,double> >,StdVectorTypes<Vec<3,double>,Vec<3,double>,double> > [ERROR] [DefaultContactManager(response)] Contact NeedleContact between SphereCollisionModel and PointCollisionModel creation failed [ERROR] [DefaultContactManager(response)] Contact NeedleContact between SphereCollisionModel and PointCollisionModel creation failed [ERROR] [DefaultContactManager(response)] Contact NeedleContact between SphereCollisionModel and PointCollisionModel creation failed further messages suppressed. [INFO] [LCPcalc] dim should be dividable by 3 in nlcp_gaussseidel [INFO] [LCPcalc] dim should be dividable by 3 in nlcp_gaussseidel
The error messages show that I failed to create the contacts in
NeedleContact.cpp
. How should I correct this?Creator<sofa::core::collision::Contact::Factory, NeedleContact< PointCollisionModel<sofa::defaulttype::Vec3Types>, PointCollisionModel<sofa::defaulttype::Vec3Types>> > PointPointNeedleContactClass("NeedleContact",true); Creator<sofa::core::collision::Contact::Factory, NeedleContact< PointCollisionModel<sofa::defaulttype::Vec3Types>, SphereCollisionModel<sofa::defaulttype::Vec3Types>> > SpherePointNeedleContactClass("NeedleContact", true); Creator<sofa::core::collision::Contact::Factory, NeedleContact< LineCollisionModel<sofa::defaulttype::Vec3Types>, SphereCollisionModel<sofa::defaulttype::Vec3Types>> > SphereLineNeedleContactClass("NeedleContact", true);
27 May 2021 at 09:43 #19584yupengBlockedThe 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"
11 June 2021 at 11:09 #19673HugoKeymasterLet’s close this topic since this one is already open on the topic.
Hugo
-
AuthorPosts
- You must be logged in to reply to this topic.