Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This might be of interest for others as well. It would be nicer if we could just pass a .world string instead of a file to stage, but I wanted to touch as little as possible.
I needed a way to dynamically configure a .world file when starting stage from a .launch file, e.g., spawn a parametrizable number of robots (in principle, idea similar to xacro for urdf). Since I didn't find a way, I added the following new option:
-c <script> [args] <worldfile>
<script>
is a custom script to configure the .world file (see below)[args]
are optional arguments to the script (all args following -c will be passed, so -u or -g need to preceed -c)<worldfile>
as usual, the used .world file stays the last argument and will be as well passed to the script as targetAn arbitrary custom script can be used for configuration as long as it writes its result to
<worldfile>
. For convenience and reference, I added the scriptrosparam_instantiate.py
to this PR:It accepts a rosparam namespace and instantiates all objects into the world
worldfile_in
. It can be used in a launchfile like the following example:which will spawn the following object:
Note the following two aspects: