Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can agents/entities be spawned at runtime? #419

Closed
UltronDestroyer opened this issue Mar 4, 2020 · 7 comments
Closed

Can agents/entities be spawned at runtime? #419

UltronDestroyer opened this issue Mar 4, 2020 · 7 comments

Comments

@UltronDestroyer
Copy link

Currently it looks like SCRIMMAGE must take an .xml config file to get it going - is it possible to spawn agents in at a later date and modify the simulation at runtime?

@SyllogismRXS
Copy link
Contributor

Yes, entities can be generated later at run-time if their entity description is provided in the mission xml file. Any plugin can publish on the "generate_entities" topic, which the main simulation loop receives and generates an entity. Take a look at the Straight.cpp example:

https://github.com/gtri/scrimmage/blob/master/src/plugins/autonomy/Straight/Straight.cpp#L198
https://github.com/gtri/scrimmage/blob/master/src/plugins/autonomy/Straight/Straight.cpp#L239

You also have to specify the entity description in the scrimmage mission xml file, with a of 0, so the entity is not generated at the start of the simulation:
https://github.com/gtri/scrimmage/blob/master/src/plugins/autonomy/Straight/Straight.cpp#L239

The entity tag is used to specify which entity to generate in the "generate_entities" message:

@UltronDestroyer
Copy link
Author

I'm kind of new to this - if an entity is described in the mission XML file, does that mean I can spawn X number of compies of it later using the above method? Or just spawn that one one time at a later date?

@SyllogismRXS
Copy link
Contributor

Every time you publish to the "generate_entities" topic, you will be able to spawn an additional entity. So, if within a single time step, your plugin publishes multiple messages to the "generate_entities" topic, multiple entities will be generated.

@UltronDestroyer
Copy link
Author

UltronDestroyer commented Mar 15, 2020

What should I be using/linking against to write code that will publish against the generate_entities topic? Are there CLI tools to debug this/see topics for a running SCRIMMAGE simulator?

I couldn't find anything in the documentation marking this functionality, any help would be appreciated!

@UltronDestroyer
Copy link
Author

I tried with 0 but that gives me a segfault. Am I missing something? I followed the tutorial about this but when count is 0 I segfault

@UltronDestroyer
Copy link
Author

#434

I investigated this further and made a bug report.

@SyllogismRXS
Copy link
Contributor

Closing this since it is being tracked in another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants