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