-
Notifications
You must be signed in to change notification settings - Fork 7
Proposal to add support for managing simulation worlds #4
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
base: main
Are you sure you want to change the base?
Conversation
I think it's a good idea. However, I'm missing an additional simulator state. Setting up a new world will take time, and we should consider that. I suggest adding something like this to
|
Good PR, I would love to follow up and propose changes soon, will submit as a PR targeting this one. |
@pijaro Thanks, great idea! Added STATE_INITIALIZING to |
Signed-off-by: Adam Dąbrowski <adam.dabrowski@robotec.ai>
ayushgnv#1 - there's the PR |
Signed-off-by: Adam Dąbrowski <adam.dabrowski@robotec.ai>
suggested changes to simulation interface worlds
@mjcarroll @peci1 @DLu could you take a look at this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through this and left a few comments.
Co-authored-by: Martin Pecka <peci1@seznam.cz>
Co-authored-by: Martin Pecka <peci1@seznam.cz>
Co-authored-by: Adam Dąbrowski <adam.dabrowski@robotec.ai>
@peci1 any more feedback here or are we good? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the late review.
The thing that confuses me is what actually goes in the URI. I imagined them as unique ids, but LoadWorld.srv
specifies them as having a specific format, like SDF.
uint8 STATE_NO_WORLD = 4 # Simulation world is currently unloaded and a new world has not finished loading yet. | ||
# The simulation is inactive and cannot be started, stopped, or paused. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like NO_WORLD
is a little too specific in this context and STATE_TRANSITIONAL
would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint8 STATE_NO_WORLD = 4 # Simulation world is currently unloaded and a new world has not finished loading yet. | |
# The simulation is inactive and cannot be started, stopped, or paused. | |
uint8 STATE_NO_WORLD = 4 # Simulation world is currently unloaded, and/or a new world has not finished loading yet. | |
# The simulation is inactive and cannot be started, stopped, or paused. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure with my English here. Would TRANSITIONAL also semantically cover the instant where no world is loaded and no world is commanded to be loading?
# URI which will be accepted by LoadWorld service, unique per world. | ||
string uri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we already have the Spawnable.msg in this package that has a string uri
, string description
and a spawn_bounds
. I think this would be cleaner if we eliminated the non-unique name from this message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think semantically any Spawnable object is spawned while simulation is running. Whereas a world would be something you load by stopping sim, opening a new world which resets the current simulation. We could look into renaming or updating the descriptions in Spawnable.msg if we would still like to reuse this message type for loading worlds.
@adamdbrw @peci1 @mjcarroll any thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what repeats here is uri and description, which could be abstracted into "Resource", but a world is essentially quite a different type of thing - something that is required for spawning anything (in it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its fine to have Spawnable and WorldResource. My point was to highlight the difference that both have a uri and description, but only worlds have names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also okay with keeping this separate message. However, see further.
string uri | ||
|
||
# Simulation world passed as a string. This field is used if the uri field is empty. | ||
string resource_string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make more sense to have two separate services.
- Add World, which takes in a resource_string and makes it available for use
- Load World, which only takes a uri
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would does "makes it available for use" entail for the simulator? Is there any pre-processing that needs to happen before loading a world in your case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does "adding" have a value from the perspective of external interface node / automation? I am of opinion that it is an implementation detail, some resources need to be downloaded and other will be available; I would expect the simulator to handle that.
Perhaps it would be useful to document that loading can take a bit and make things clearer through error codes, suggesting async service call etc, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So from an abstract perspective, here's what I imagine.
As an external client, I call GetAvailableWorlds.srv
and get a list of unique world uri.
worlds: [
- {uri: 'factory1'}
- {uri: 'competition_2'}
- {uri: 'moon}
]
I could then call LoadWorld.srv
with uri: 'moon'
. However, if instead I wanted to load in some other world that is not specified yet, I could call AddWorld.srv
with the resource_string
(which I assume would be SDF or similar), and then that new world be listed in the available worlds.
The core issue here is that I think it is semantically cleaner to run separate Add/Load calls than it is to have the single Load call with different behavior if the uri field is empty or not. Also, what happens when uri is nonempty and resource_string is nonempty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me it could be beneficial to create a Resource message like this:
string uri
string resource_string # only used if uri is empty
This could then be used in Spawnable, WorldResource and here.
The proposal with AddWorld/LoadWorld seems too complicated to me.
@DLu At least from an Isaac Sim perspective we would load USD files by accessing the filepaths in the URI field. Happy to update the |
Might just be me, but I could benefit from a description of how you envision these services being used, similar to the "call this one, then this one" example I gave above. |
# URI which will be accepted by LoadWorld service, unique per world. | ||
string uri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also okay with keeping this separate message. However, see further.
|
||
# Optional field for additional sources (local or remote) to search, | ||
# specified as standard URIs if possible. | ||
string[] sources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string[] sources | |
string[] additional_sources |
Also, it's not clear to me what should I type in this field. Is it https://app.gazebosim.org/fuel/worlds or https://fuel.gazebosim.org/1.0 or something else?
Last, what to do if there are standard online source (like the Fuel database), but we'd like to allow these use-cases without the user needing to look up docs for some particular URI?
- Search only locally available worlds, not connecting to the Internet
- Search also the default online locations
As one possibility, I think the worlds could get a virtual tag LOCAL or ONLINE which would tell whether they are locally available or not. The implementations could then first check for this particular tag filter and skip the online search when it is not needed. But what if the implementation doesn't support world tags?
uint8 STATE_NO_WORLD = 4 # Simulation world is currently unloaded and a new world has not finished loading yet. | ||
# The simulation is inactive and cannot be started, stopped, or paused. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure with my English here. Would TRANSITIONAL also semantically cover the instant where no world is loaded and no world is commanded to be loading?
string uri | ||
|
||
# Simulation world passed as a string. This field is used if the uri field is empty. | ||
string resource_string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me it could be beneficial to create a Resource message like this:
string uri
string resource_string # only used if uri is empty
This could then be used in Spawnable, WorldResource and here.
The proposal with AddWorld/LoadWorld seems too complicated to me.
Proposal for World Management Services for Simulation Interfaces Standard
These interfaces provide standardized world management across simulation_interfaces.
The proposed API introduces functionality to dynamically load and unload worlds, enabling automated testing across diverse simulation environments without restarting the simulator. This would allow for workflows where users can load a world file, spawn entities, and run SIL testing facilitating continuous operation on remote systems (sometimes in headless mode).
For Isaac Sim and O3DE (@adamdbrw), these services would likely be useful as these platforms support loading worlds dynamically.
Unlike Entities only one world should be loaded at a time. Attempting to load a world when a world already exists should result in automatically unloading the previously loaded world before loading the current one.
Change Summary: