gtri / scrimmage

Multi-Agent Robotics Simulator
https://www.scrimmagesim.org
Other
156 stars 94 forks source link

Bypassing Sensor/Autonomy/Controller/Motion model system #370

Open flaviut opened 4 years ago

flaviut commented 4 years ago

I'm trying to add DIS (basically a standardized, networked way of saying "there's an entity here") support to Scrimmage, which basically means that I need to replace the red circled part with something custom: plugin-order

The goal is to both send outgoing DIS messages for entities being simulated by Scrimmage, and also to accept DIS messages from other simulations and make those entities visible in Scrimmage.

Anyway, I'm looking to get some suggestions on how to do that. Right now, I'm looking at placing a function call after run_sensors(), and reading & writing to this->ents_. I'd use Entity.properties() to discriminate between the DIS entities and local entities.

Would this be a reasonable approach?

Fyi this work will be done internally at https://git.elsys.gtri.org/projects/DISSCRIMM, but I see no reason this discussion shouldn't be public so that others may benefit from it.

SyllogismRXS commented 4 years ago

Instead of bypassing the Sensor, autonomy, controller, and motion model plugins, which would result in the loss of the functionality in some plugins, I would recommend that you create a DISReader that is implemented as a Entity interaction plugin that receives DIS messages from external systems and generates those entities in the scrimmage environment. Also, each entity that is fully controlled by the scrimmage environment should instantiate a DISWriter (autonomy) plugin that constructs the DIS message for its own state and sends it to the external DIS processes. While the DISWriter is an autonomy plugin, it doesn't perform any decision making for the entity, it just reports the state information to other DIS processes. This is possible within scrimmage because entities can use multiple autonomy plugins.