Robots escaping from physics engines

Requests regarding how to set up experiments in ARGoS.
jharwell
Posts: 64
Joined: Thu Jan 25, 2018 4:12 am

Robots escaping from physics engines

Postby jharwell » Fri Feb 08, 2019 5:30 am

So I've been trying to track down why robots are able to escape from physics engines, and have gotten stuck. I'm not sure if this is a configuration error on my part, or a bug in ARGoS (I'm leaning toward the latter, though I am not sure). Here's what I've seen so far:

- It does not happen with less that 4096 robots, or at least so rarely I have not seen it in my testing so far.
- It does not happen with slow moving robots (those that wander around), though it happens within the first minute or so of starting a simulation with faster moving footbots (those that speed toward their target at 10cm/s).
- The robots always escape through one of the engines that lie against the "wall_north" entitie (i.e. along the top of the arena) or the "wall_east" entity (i.e. along the right side of the arena).
- Using thicker walls (1.0 instead of the 0.1 shown in the examples), helps the exception/crash to happen later (usually around the 10 minute mark), as does making the physics engines around the edges of the arena extend beyond the edges (e.g. with a 32x16 arena the area covered by physics engines will extend -1 to 33 in X and -1 to 17 in Y)
- Increasing the # of physics engine iterations per tick from 10 to 50 also helps make the crash happen less often, but does not eliminate it.

What I think is happening is that faster moving robots near the edges of the arena end up moving in 3D space between ticks far enough that their velocity carries them out of bounds and somehow the "bounce back" functionality that usually keeps robots in bounds is not triggering (e.g. bounce off of walls). This is supported by the crashes not happening with slower robots, which do not move far enough in between ticks to cause this to happen.

I can work around this by just having all my robots run really slowly (max 5 cm/s), but I feel like they should be able to run faster than that because when there is a single physics engine, it can handle higher speeds just fine.

Is there a configuration setting that I could tweak to work around this? I'm basing my configuration of physics engines on the one in the example repo, though my engines may be numbered differently in terms of how they are laid out:

15 14 13 12
11 10 9 8
7 6 5 4
0 1 2 3

Does ARGoS expect a particular layout scheme?

Thanks for any help!
- John

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

Re: Robots escaping from physics engines

Postby pincy » Fri Feb 08, 2019 5:34 am

Can you specify what kind of "crash" you're experiencing? Segfault, internal exception, ... ? If you shared a runnable example, I'd be able to have a better look a it. With the information you're providing I can't really formulate a guess.
I made ARGoS.

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

Re: Robots escaping from physics engines

Postby jharwell » Fri Feb 08, 2019 5:46 am

The crash I get is an exception in the "AddEntitiesToPhysicsEngine()" function in space.cpp:

[FATAL] No physics engines available to house entity "fb4882" (the name of the footbot is different each time)

Here is the .argos file I'm running (project-specific bits removed)

Code: Select all

<argos-configuration> <framework> <system method="balance_quantity" threads="16" /> <experiment length="10000" random_seed="33" ticks_per_second="5" /> </framework> <controllers> <dpo_controller id="ffc" library="libfordyca"> <actuators> <differential_steering implementation="default" /> </actuators> <sensors> <footbot_proximity implementation="default" show_rays="true" /> <footbot_light implementation="rot_z_only" show_rays="false" /> <footbot_motor_ground implementation="rot_z_only" /> </sensors> <params> </params> </dpo_controller> </controllers> <loop_functions label="depth0_loop_functions" library="libfordyca"> </loop_functions> <arena center="16.0, 8.0, 1" size="32, 16, 2"> <floor id="floor" pixels_per_meter="50" source="loop_functions" /> <box id="wall_north" movable="false" size="32, 0.1, 0.5"> <body orientation="0,0,0" position="16.0, 15.95, 0" /> </box> <box id="wall_south" movable="false" size="32, 0.1, 0.5"> <body orientation="0,0,0" position="16.0, 0, 0 " /> </box> <box id="wall_east" movable="false" size="0.1, 16.1, 0.5"> <body orientation="0,0,0" position="31.95, 8.0, 0" /> </box> <box id="wall_west" movable="false" size="0.1, 16.1, 0.5"> <body orientation="0,0,0" position="0, 8.0, 0" /> </box> <distribute> <position max="30.0, 14.0, 0" method="uniform" min="2.0, 2.0, 0" /> <orientation max="360,0,0" method="uniform" min="0,0,0" /> <entity max_trials="1000" quantity="8192"> <foot-bot id="fb"> <controller config="ffc" /> </foot-bot> </entity> </distribute> </arena> <media> <led id="leds" /> </media> <physics_engines> <dynamics2d id="dyn2d0" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="-1.0, -1.0" /> <vertex point="9.0, -1.0" /> <vertex point="9.0, 5.0" /> <vertex point="-1.0, 5.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d1" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="7.0, -1.0" /> <vertex point="17.0, -1.0" /> <vertex point="17.0, 5.0" /> <vertex point="7.0, 5.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d2" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="15.0, -1.0" /> <vertex point="25.0, -1.0" /> <vertex point="25.0, 5.0" /> <vertex point="15.0, 5.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d3" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="23.0, -1.0" /> <vertex point="33.0, -1.0" /> <vertex point="33.0, 5.0" /> <vertex point="23.0, 5.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d4" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="23.0, 3.0" /> <vertex point="33.0, 3.0" /> <vertex point="33.0, 9.0" /> <vertex point="23.0, 9.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d5" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="15.0, 3.0" /> <vertex point="25.0, 3.0" /> <vertex point="25.0, 9.0" /> <vertex point="15.0, 9.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d6" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="7.0, 3.0" /> <vertex point="17.0, 3.0" /> <vertex point="17.0, 9.0" /> <vertex point="7.0, 9.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d7" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="-1.0, 3.0" /> <vertex point="9.0, 3.0" /> <vertex point="9.0, 9.0" /> <vertex point="-1.0, 9.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d8" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="-1.0, 7.0" /> <vertex point="9.0, 7.0" /> <vertex point="9.0, 13.0" /> <vertex point="-1.0, 13.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d9" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="7.0, 7.0" /> <vertex point="17.0, 7.0" /> <vertex point="17.0, 13.0" /> <vertex point="7.0, 13.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d10" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="15.0, 7.0" /> <vertex point="25.0, 7.0" /> <vertex point="25.0, 13.0" /> <vertex point="15.0, 13.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d11" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="23.0, 7.0" /> <vertex point="33.0, 7.0" /> <vertex point="33.0, 13.0" /> <vertex point="23.0, 13.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d12" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="23.0, 11.0" /> <vertex point="33.0, 11.0" /> <vertex point="33.0, 17.0" /> <vertex point="23.0, 17.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d13" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="15.0, 11.0" /> <vertex point="25.0, 11.0" /> <vertex point="25.0, 17.0" /> <vertex point="15.0, 17.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d14" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="7.0, 11.0" /> <vertex point="17.0, 11.0" /> <vertex point="17.0, 17.0" /> <vertex point="7.0, 17.0" /> </sides> </boundaries> </dynamics2d> <dynamics2d id="dyn2d15" iterations="50"> <boundaries> <top height="1" /> <bottom height="0" /> <sides> <vertex point="-1.0, 11.0" /> <vertex point="9.0, 11.0" /> <vertex point="9.0, 17.0" /> <vertex point="-1.0, 17.0" /> </sides> </boundaries> </dynamics2d> </physics_engines> </argos-configuration>
If there is other information I could provide, such as a gdb backtrace, valgrind results, etc., I would be happy to provide it!

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

Re: Robots escaping from physics engines

Postby jharwell » Fri Feb 08, 2019 6:00 am

I would also add that I know the condition that is triggering the exception is that there is no engine available to house the entity (the exception text was modified to that effect), which can happen if the robot's position is outside of the bounds of the arena. Interestingly, I've seen robots somehow move THROUGH the arena walls and get themselves outside of the arena bounds (and therefore the extent of the physics engines), which is pretty strange.

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

Re: Robots escaping from physics engines

Postby pincy » Fri Feb 08, 2019 6:09 am

How fast are you having the robots go? Robots going through walls happens if they go too fast.
I made ARGoS.

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

Re: Robots escaping from physics engines

Postby jharwell » Fri Feb 08, 2019 1:31 pm

I set their max speed to 10 cm/s, which works fine for lower counts of robots in the arena.

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

Re: Robots escaping from physics engines

Postby jharwell » Fri Feb 08, 2019 6:27 pm

I also tried setting the max speed to 5 cm/s, as in the example for using multiple physics engines, and the simulation ran for a MUCH longer time (~3 hrs), but then still crashed with the same exception. So the issue may be related to the speed of the robots, but just making the robots move slower may not be the answer, unfortunately.

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

Re: Robots escaping from physics engines

Postby pincy » Sat Feb 09, 2019 7:17 pm

If you give me a minimal working example of your setting, I'll look into it. I don't know what the problem could be.
I made ARGoS.

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

Re: Robots escaping from physics engines

Postby jharwell » Wed Feb 13, 2019 4:35 pm

Still working on trying to reproduce in a minimalistic example (no luck so far). However, one thing I did notice and fix, which seemed to make things a bit better, was the placement of the arena walls, which I discovered after some visual inspection and placing with arena wall placement in the input file. The numbers I use below are for a 12x6 arena with 4 walls each of 0.1m thickness.

The south and east walls are placed such they extend [-0.05,0.05] and [-0.05,0.05] respectively (i.e. the accessible part of the arena for robots starts at x=0.05, y=0.05). This is good for physics engines that extend to x=0,y=0 in the arena, because it keeps the robots further from the boundaries of the engines, and therefore makes them less likely to escape via moving too quickly (or whatever it is that is allowing them to escape).

For the north and west walls, ARGoS appears to place them such that they extend [12,12.1] and [6,6.1] respectively (i.e. inner edge is at the maximum dimensions for the arena, rather than their center being at that location). This results in the inner edge of the north/west walls ending being coincident with the limit of the physics engines along those boundaries, making the part of the arena accessibey to robots end at x=12,y=6. The fact that the limit of the accessible space for robots is coincident with physics engine boundaries makes it much more "risky" that a robot can escape all physics engines, because they can physically move right up to the limits of the engines along the arena boundaries.

I'm not sure if this is a minor bug in how ARGoS places obstacles/walls in the arena, or an intended behavior that just warrants some tweaks to the example input files in the examples repo (it is feasible, but unlikely, that this can happen even with low swarm sizes in the examples provided with walls in this configuration with even 1 physics engine).

What do you thnk?

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

Re: Robots escaping from physics engines

Postby pincy » Thu Feb 21, 2019 7:48 am

Can you try with thicker outer walls? The thickness values you use are very close to the speed per second that you use, and to the diameter of a robot. Just want to be sure that this does not result in some numerical oddity.
I made ARGoS.


Return to “How to... ?”



cron