The Wayback Machine - https://web.archive.org/web/20201017212629/https://github.com/sofa-framework/sofa/issues/1014
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rigid3d - template recognition in Mappings #1014

Open
Camille-K opened this issue Apr 29, 2019 · 8 comments
Open

Rigid3d - template recognition in Mappings #1014

Camille-K opened this issue Apr 29, 2019 · 8 comments

Comments

@Camille-K
Copy link

@Camille-K Camille-K commented Apr 29, 2019

Hello,

There seem to be an issue in template recognition when creating mappings involving Rigid3d DoFs.

Namely, when creating a BarycentricMapping or a BeamLinearMapping between a mechanical model and a collision model of connected beam elements, I receive the following error messages:

[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,
[ERROR] [SceneLoaderXML] Node initialization failed.

[ERROR] [InfoComponent(Not created (BeamLinearMapping))] Object type BeamLinearMapping<Rigid3d,Vec3d> was not created The object is in the factory but cannot be created. Requested template: Rigid3d,Vec3d(Rigid3d,Vec3d) Available templates: Rigid3d,ExtVec3d, Rigid3d,Vec3d,
[ERROR] [SceneLoaderXML] Node initialization failed.

The template specialisation in BarycentricMapping.cpp suggests that the component is actually not specialised for <Vec3d,Rigid3d>, which could partly explain the error. Nevertheless the BeamLinearMapping component seems to be specialised for <Rigid3d,Vec3d>.

I attached to this issue an example scene file, reproducing the errors. I commented the lines corresponding to the different scenarios mentioned above.
NB: the "floor2b.obj" object I use for collisions is directly taken from Sofa sources.

Rigid3d_Mapping.zip

NB: the related forum topic is Beam collision mapping


Suggested labels: bug (minor)

@damienmarchal
Copy link
Contributor

@damienmarchal damienmarchal commented Apr 29, 2019

Hi Camille,

Thanks a lot for the detailed reports. I just tested the files and can confirm the issue.

@damienmarchal
Copy link
Contributor

@damienmarchal damienmarchal commented Apr 29, 2019

Well after a quick look in the scene you provided:

I'm not surprised the BarycentricMapping is not able to work .

Let's me explain:

  • Object.DoFs is of type Rigid3d
  • Object.Mechanical model.collisionDofs is of type Vec3d

What your are specifying by setting the input & output field of BarycentricMapping is that you are driving the collisionDofs(type Vec3d) from the one from the one of type Dofs(type Rigid3). So the corresponding mapping should be Rigid3d, Vec3d (an not Vec3d, Rigid3d).
The possible available templates shows that this is not supposed to work, because a BarycentricMapping can only have Vec3 as input. Overriding the template values with one that exists in BarycentricMapping will not work because this will lead to a mismatch between the input/output types and thes type manually set in the template.

Now about the BeamLinearMapping...the situation is a bit different. There is a valid template from Rigid3 to Vec3. This is why:

<BeamLinearMapping template="Rigid3d,Vec3d"/>

And

<BeamLinearMapping"/>

Work the same.
You get an error in your case because there is a typo "@collisionDOFs" instead of "@collisionDoFs".

Now I have no idea why the BeamLinearMapping is not working as you expect:

  • maybe there is a real issue there ?

NB to anyone:
It would be nice to have PRs to improve the error messages as they are mis-leading.

@Camille-K
Copy link
Author

@Camille-K Camille-K commented Apr 29, 2019

Hi Damien,

Thanks a lot for your answer!

Regarding the BarycentricMapping, I indeed wasn't sure of which of the input and the output was driving the other (although I knew that the mechanical model was supposed to drive the collision model). It is definitely clear with your explanation. So I understand that there is no bug regarding the behaviour of the BarycentricMapping (as you pointed out), as it is not suppose to work for another input types than Vec3d.
For me, the (very minor) issue would rather be with the error message, as you said in your NB.

My apologies for the typo, indeed, I hadn't paid attention...
As for the unexpected behaviour, I haven't tried yet to track down what is happening. As I'm looking to use a reduced topology for my collision model, I might investigate it more in a near future. If so, I'll report here anything I find unsettling.

@hugtalbot
Copy link
Contributor

@hugtalbot hugtalbot commented Apr 30, 2019

@Camille-K if I understand well, you want to make a beam structure (Rigid3d with its collision model) collide with a surface. Since the collision model is only instantiable in Vec3d you created a subnode with a mapping. Correct ?
@remibessard how do you manage this usually?

@Camille-K
Copy link
Author

@Camille-K Camille-K commented Apr 30, 2019

@hugtalbot Correct! This actually works with the IdentityMapping, but I'd be interested in using a reduced topology for the collision model.

@hugtalbot
Copy link
Contributor

@hugtalbot hugtalbot commented May 2, 2019

are you coming to the STC @remibessard and @Camille-K ? it could be nice having you to work on this.
Otherwise this could be solved later

@Camille-K
Copy link
Author

@Camille-K Camille-K commented May 5, 2019

Unfortunately, I won't be able to come to Sophia Antipolis for the next STC... But if I haven't investigated the issue until then, I'll try to block 1 or 2 days during the STC to work on it from distance.
I'll keep you updated in the meantime.

@hugtalbot
Copy link
Contributor

@hugtalbot hugtalbot commented Jul 9, 2019

Hi @remibessard
I am getting back to this topic.
I know students (Alban for instance) were struggling also with the BeamLinearMapping.
Can you update us on this topic ?
Is it working well for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.