Home › Forum › SOFA › Using SOFA › Beam collision mapping
Tagged: 64_bits, SOFA_other, Windows_10
- This topic has 5 replies, 2 voices, and was last updated 5 years, 6 months ago by CamilleK.
-
AuthorPosts
-
1 April 2019 at 01:02 #13304CamilleKBlocked
Hello,
I’m trying to associate a collision model to connected beam elements (on which I used the BeamFEMForceField component). Ideally I would have associated the collision model directly to the topology and MechanicalObject of my beams, using the TLineModel component. However I believe that this component is not ‘instantiable’ on Rigid3d DOFs, which is the type of nodes used in the beam elements.
Consequently, I duplicated my DOFs and edge topology in a dedicated collision node. I successfully added the TLineModel component in the same node. Then I tried to use a mapping between the ‘Rigid3d’ MechanicalObject associated to the force field and the ‘Vec3d’ MechanicalObject corresponding to the collision model, but I encountered some difficulties.
– Trying with an IdentityMapping or a BarycentricMapping results in an error message at runtime:
[ERROR] [InfoComponent(Not created (IdentityMapping))] Object type IdentityMapping<Rigid3d,Vec3d> was not created The object is in the factory but cannot be created. Requested template: Rigid3d,Vec3d(Rigid3d,Vec3d) Available templates: Rigid2d,Rigid2d, Rigid2d,Vec2d, Rigid3d,ExtVec3d, Rigid3d,Rigid3d, Rigid3d,Vec3d, Vec1d,Vec1d, Vec2d,Vec2d, Vec3d,ExtVec3d, Vec3d,Vec3d, Vec6d,ExtVec3d, Vec6d,Vec3d, Vec6d,Vec6d, [ERROR] [SceneLoaderXML] Node initialization failed.
– Trying with the BeamLinearMapping component either generate the same error if I specify the template, input and output fields, or creates a collision model which seems to only be mapped to the first node of the beams, if I don’t specify anything.
NB: I found these topics on the forum, which could be related but where I couldn’t find a solution:
Mapping between BeamFEMForceField behavioral model and oglmodel
Below is the scene file I’m using :
<Node name="root" dt="5e-4" gravity="0 -9.81 0" bbox="-1e-3 -1e-3 -1e-3 1e-3 1e-3 1e-3"> <RequiredPlugin name="SofaMiscCollision"/> <CollisionPipeline verbose="0" depth="10" draw="0" /> <BruteForceDetection name="N2" /> <MinProximityIntersection name="Proximity" alarmDistance="5e-4" contactDistance="1e-4" /> <CollisionResponse name="Response" response="default" /> <VisualStyle name="visualStyle1" displayFlags="showBehaviorModels showForceFields showCollisionModels" /> <Node name="Object"> <EulerImplicitSolver name="cg_odesolver" printLog="0" rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver template="GraphScattered" name="linear solver" iterations="25" tolerance="1e-09" threshold="1e-09" /> <MechanicalObject template="Rigid3d" name="DoFs" position="0 1e-3 0 0 0 0 1 1e-3 1e-3 0 0 0 0 1 2e-3 1e-3 0 0 0 0 1 3e-3 1e-3 0 0 0 0 1 4e-3 1e-3 0 0 0 0 1" /> <UniformMass name="uniformMass1" totalMass="1e-6" showAxisSizeFactor="1e-4"/> <MeshTopology lines="0 1 1 2 2 3 3 4" /> <BeamFEMForceField template="Rigid3d" name="FF" radius="1e-4" poissonRatio="0.3" youngModulus="2e6" /> <Node name="Collision model"> <MechanicalObject template="Vec3d" name="collisionDoFs" position="0 1e-3 0 1e-3 1e-3 0 2e-3 1e-3 0 3e-3 1e-3 0 4e-3 1e-3 0" /> <MeshTopology lines="0 1 1 2 2 3 3 4" /> <TLineModel template="Vec3d"/> <TPointModel /> <!-- <BeamLinearMapping isMechanical="true"/> --> <IdentityMapping template="Rigid3d,Vec3d" input="@../DoFs" output="@collisionDOFs"/> <!-- <BeamLinearMapping isMechanical="true" input="@../DoFs" output="@collisionDOFs"/> --> <!-- <BarycentricMapping template="Vec3d,Rigid3d" input="@../DoFs" output="@collisionDOFs"/> --> </Node> </Node> <Node name="Floor"> <MeshObjLoader name="loader" filename="floor2b.obj" scale="1e-4" translation="0 10.245 0" /> <Mesh src="@loader" /> <MechanicalObject src="@loader" dy="-10.25" /> <TTriangleModel name="T" simulated="0" moving="0" /> <TLineModel name="L" simulated="0" moving="0" /> <TPointModel name="P" simulated="0" moving="0" /> </Node> </Node>
I commented the lines corresponding to the different mapping scenarios I mentioned above.
Does anyone have a clue on what I am missing ?
Best regards,
Camille
PS: The mesh file I’m using for the ‘floor’ is part of the SOFA sources.
I’m using SOFA’s master version (commit 95d33bff from 12/02/2019), on Windows 10 64bits1 April 2019 at 13:28 #13307CamilleKBlockedHello again,
I have some update regarding the IdentityMapping. By changing the line
<IdentityMapping template="Rigid3d,Vec3d" input="@../DoFs" output="@collisionDOFs"/>
into simply
<IdentityMapping />
the mapping is created normally and seems to work as expected.I still have no clue regarding the BeamLinearMapping and the BarycentricMapping. And I don’t know if I’m doing something wrong by specifying the input and output in the IdentityMapping.
Cheers,
Camille
1 April 2019 at 21:19 #13328HugoKeymasterHi @krewcunc
I don’t if this topic is still a bottleneck for your work (it appears from your other post that it isn’t).
But the problem of template comes from the fact that Rigid and Vec3 are really different since they do not include the same nb of degrees of freedom (DOFs) at each vertex. Vec3d has 3 double per node whereas Rigid3d has (x,y,z)+quaternion so 7 DOFs per node. The IdentityMapping works since there might be a hack to ease the mapping between the two templates and keep only the position information and remove the orientation.
About the BeamLinearMapping, I never used this class myself. I don’t really know the level or realism we can expect from it..
Hope this helps
Hugo
4 April 2019 at 14:16 #13371CamilleKBlockedHi @Hugo,
Thanks for your answer!
Indeed this is not a bottleneck any more: thanks to the change of lines I mentioned in my second post, the IdentityMapping works well.
Yes, I imagined that there was something in the IdentityMapping which allowed to map Vec3d DoFs to the 3 positions DoFs of the Rigid3d nodes. I thought that this mechanism had been extended for the BarycentricMapping, as I was receiving an error message indicating that the template <Vec3d,Rigid3d> was available for the component:
[ERROR] [InfoComponent(Not created (BarycentricMapping))] Object type BarycentricMapping<Vec3d,Rigid3d> was not created The object is in the factory but cannot be created. Requested template: Vec3d,Rigid3d(Vec3d,Rigid3d) Available templates: Vec3d,ExtVec3d, Vec3d,Rigid3d, Vec3d,Vec3d,
However I had a look in BarycentricMapping.cpp, and I have the impression that it is only instanciated on templates <Vec3d,vec3d> and <Vec3d,ExtVec3d>. Maybe there is just a problem in the error message ?
Regarding the IdentityMapping, is there something I’m doing wrong when specifying the input and output as in the following line ?
<IdentityMapping template="Rigid3d,Vec3d" input="@../DoFs" output="@collisionDOFs"/>
This raises an error at runtime, but not specifying anything doesn’t, and apparently the mapping is created on the same MechanicalObjects I wanted to explicitly give.
I dind’t check how the BeamLinearMapping works, but apparently it has the same issue (regardless of what happens once it is created).As my initial problem was to be able to create a mapping to associate a collision model to a BeamFEMForceField, I think we can close this topic.
Camille
28 April 2019 at 18:34 #13433HugoKeymasterHi @krewcunc
Thanks for pointing out this issue of template recognition in mappings. I get it as well. Could you create an issue on GitHub point this and adding damienmarchal as well ?
Best,
Hugo
29 April 2019 at 12:59 #13440CamilleKBlocked -
AuthorPosts
- You must be logged in to reply to this topic.