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

Discussions regarding ARGoS bugs. Report bugs here.
jharwell
Posts: 56
Joined: Thu Jan 25, 2018 4:12 am

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

Postby jharwell » Thu Feb 06, 2020 1:17 am

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

pincy
Site Admin
Posts: 466
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

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

Postby pincy » Thu Feb 06, 2020 2:05 am

Well spotted. I'd say it's a bug, because MoveTo() should always work.
I made ARGoS.

jharwell
Posts: 56
Joined: Thu Jan 25, 2018 4:12 am

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

Postby jharwell » Fri Feb 07, 2020 8:47 pm

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.

jharwell
Posts: 56
Joined: Thu Jan 25, 2018 4:12 am

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

Postby jharwell » Fri Mar 20, 2020 5:37 pm

Any update on this?

pincy
Site Admin
Posts: 466
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

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

Postby pincy » Sat Apr 11, 2020 2:11 am

Finally found some time to work on it. Will report back.
I made ARGoS.


Return to “Bugs”



cron