Page 1 of 1

Temporality removing robots from simulation

Posted: Thu Dec 12, 2019 6:42 pm
by jharwell
Hi Carlo,

I'm currently investigating how swarm performance changes (or doesn't) as the swarm population size changes dynamically, and am wondering if there is a way to temporarily remove robots from simulation (or alternatively, just move them out of sight for a period of time) ? I want to be able to do this to simulate robots being removed for repair before being reintroduced back into service once they are fixed.

I can disable their controllers so they don't move, but right now the entity is still in the arena, acting as a movable obstacle. If I try to move a robot out of bounds somewhere, I get a physics engine error with what I've tried so far.

Thanks!

- John

Re: Temporality removing robots from simulation

Posted: Thu Dec 12, 2019 7:45 pm
by pincy
The way I have done in the past is by making the arena larger and put robots outside. It's just enough to have boundary walls that prevent the robots inside from colliding with the robots outside.

A possible patch I can add is that, when robots are disabled, they also get removed from the physics engines and the media. This way they won't be simulated at all. Then, when the robots are added back, they get added at the last location they occupied.

Re: Temporality removing robots from simulation

Posted: Thu Dec 12, 2019 9:14 pm
by jharwell
The second way sounds like the "correct" way to provide this functionality--is this a simple patch that I could implement, if you point me to where things needs to be changed, or will it require more extensive modifications?

Re: Temporality removing robots from simulation

Posted: Fri Jan 03, 2020 7:03 am
by pincy
I'll try to find some time to study this in the weekend.

Re: Temporality removing robots from simulation

Posted: Fri Jan 10, 2020 7:05 am
by pincy
There are two ways to implement this functionality.

The first is to add specific behavior to CEmbodiedEntity when SetEnabled(false) is called. The new behavior should physically remove the entity from the physics engine. This has a the added benefit of being "generic", meaning that we don't need to implement any engine-specific logic to make it work. This requires quite a bit of work, because at the moment things are not designed to support this use case.

The second option is to disable the physics model in the physics engine. This might the "correct" way for some physics engines, but not all physics engines support this use case. Also, the drawback of this method is that this feature must be implemented for each physics engine individually.