Page 1 of 1

Possible bug/undocumented quirk in AddEntity() with multiple physics engines

Posted: Thu Feb 06, 2020 1:17 am
by jharwell
Hi Carlo,

I've discovered what is either an undocumented quirk of the AddEntity() method in the loop functions, or a bug, depending on your intended usage of the function.

When I am adding an entity with only a single physics engine in the arena I can do:

1. Create entity with new (i.e. new CFootBotEntity()).
2. Move entity to collision free location, possibly requiring multple tries to find a location that does not cause ARGoS to throw an exception using MoveTo().

But when I have multiple physics engines, the above sequence can result in a fatal error from one of the physics engines, either on the same timestep or the one right after. This is due to the new entity having a location at the origin and therefore being added as a member of engine X during AddEntity(), but being immediately scheduled for transfer to engine Y as a result of the MoveTo() operation completing successfully on step 2 above. This 1-2 process does not appear to be correctly handled in the case of multiple physics engines. But, if I pass the desired location to the entity constructor (and not use MoveTo()), performing the "find a non-colliding location" with the fully specified entity, and deleting it and trying to create a new one if there is a collision, then everything works fine (which is what I switched to doing at the moment).

In my case, the fatal error I see is something like "Dynamics2D model id fbXX not found in dynamics 2D engine dyn2dYY" from line 247 of dynamics2d_engine.cpp.

My guess is that it is more of a quirk that needs documenting (perhaps in the examples?), but I thought I would post it here in case in was not.

- John

Re: Possible bug/undocumented quirk in AddEntity() with multiple physics engines

Posted: Thu Feb 06, 2020 2:05 am
by pincy
Well spotted. I'd say it's a bug, because MoveTo() should always work.

Re: Possible bug/undocumented quirk in AddEntity() with multiple physics engines

Posted: Fri Feb 07, 2020 8:47 pm
by jharwell
Ah so that is a bug. Is it an easy fix that I could do, if you point me to where to look? I tried trying to track the problem through the various layers of ARGoS but did not end up having any luck finding where to change/add a few lines.

Re: Possible bug/undocumented quirk in AddEntity() with multiple physics engines

Posted: Fri Mar 20, 2020 5:37 pm
by jharwell
Any update on this?

Re: Possible bug/undocumented quirk in AddEntity() with multiple physics engines

Posted: Sat Apr 11, 2020 2:11 am
by pincy
Finally found some time to work on it. Will report back.

Re: Possible bug/undocumented quirk in AddEntity() with multiple physics engines

Posted: Mon Feb 01, 2021 10:53 pm
by jharwell
Have you made any headway on this issue ?

- John

Re: Possible bug/undocumented quirk in AddEntity() with multiple physics engines

Posted: Tue Feb 02, 2021 7:32 pm
by pincy
Nope, but I'll add it to my TODO list.