-
Notifications
You must be signed in to change notification settings - Fork 9
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
Open
ayushgnv
wants to merge
21
commits into
ros-simulation:main
Choose a base branch
from
ayushgnv:simulation_world
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9997b6c
Added new interfaces for simulation worlds
ayushgnv 8dbbf05
Fix formatting
ayushgnv 7d109c6
Updated descriptions
ayushgnv 7d05855
Added STATE_INITIALIZING in SimulationState.msg
ayushgnv c4f5ec6
suggested changes to simulation interface worlds
adamdbrw 90dab29
Applied review remarks + added extra feature field
adamdbrw cb5ff48
Update srv/GetAvailableWorlds.srv
ayushgnv fdc0537
Update srv/LoadWorld.srv
ayushgnv d0b5ece
Removed urdf mention in LoadWorld service
ayushgnv e1a3044
Update srv/LoadWorld.srv
ayushgnv 1a43d33
Added WorldResource in LoadWorld and renamed to STATE_NO_WORLD in Si…
ayushgnv e9f04a3
Fix formatting
ayushgnv df77fa1
Update msg/SimulationState.msg
ayushgnv f036645
Update srv/GetAvailableWorlds.srv
ayushgnv 04962fc
Added Resource message type
ayushgnv dcdbdb8
Populate resource msgs with new Resource msg type
ayushgnv 45ab916
Added Loading World state
ayushgnv 2b0a5c1
Fixed formatting and updated the world services
ayushgnv de3ad42
Updated documentation for Resource message
ayushgnv e3a1af0
Update Spawn Entity to use Resource Message
ayushgnv e87f399
Bumped package version due to breaking changes
ayushgnv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This message is used to specify a resource, either by a URI or by its string content. | ||
|
||
string uri # If uri field is empty, resource_string must not be empty. | ||
|
||
string resource_string # An entity definition file passed as a string, only used if uri is empty. | ||
# If uri field is not empty, resource_string field will be ignored. | ||
# Simulators may support spawning from a file generated on the fly (e.g. XACRO). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
# Simulation states used in SetSimulationState and returned in GetSimulationState | ||
|
||
uint8 STATE_STOPPED = 0 # Simulation is stopped, which is equivalent to pausing and resetting with ALL. | ||
# This is typically the default state when simulator is launched. | ||
# Stopped simulation can be played. It can also be paused, which means | ||
# starting simulation in a paused state immediately, | ||
# without any time steps for physics or simulated clock ticks. | ||
uint8 STATE_PLAYING = 1 # Simulation is playing, can be either paused or stopped. | ||
uint8 STATE_PAUSED = 2 # Simulation is paused, can be either stopped (which will reset it) or played. | ||
uint8 STATE_QUITTING = 3 # Closing the simulator application. Switching from STATE_PLAYING or STATE_PAUSED | ||
# states is expected to stop the simulation first, and then exit. | ||
# Simulation interfaces will become unavailable after quitting. | ||
# Running simulation application is outside of the simulation interfaces as | ||
# there is no service to handle the call when the simulator is not up. | ||
uint8 STATE_STOPPED = 0 # Simulation is stopped, which is equivalent to pausing and resetting with ALL_PAUSED. | ||
# This is typically the default state when simulator is launched. | ||
# Stopped simulation can be played. It can also be paused, which means | ||
# starting simulation in a paused state immediately, | ||
# without any time steps for physics or simulated clock ticks. | ||
|
||
uint8 STATE_PLAYING = 1 # Simulation is playing, can be either paused or stopped. | ||
|
||
uint8 STATE_PAUSED = 2 # Simulation is paused, can be either stopped (which will reset it) or played. | ||
|
||
uint8 STATE_QUITTING = 3 # Closing the simulator application. Switching from STATE_PLAYING or STATE_PAUSED | ||
# states is expected to stop the simulation first, and then exit. | ||
# Simulation interfaces will become unavailable after quitting. | ||
# Running simulation application is outside of the simulation interfaces as | ||
# there is no service to handle the call when the simulator is not up. | ||
|
||
uint8 STATE_NO_WORLD = 4 # Simulation world is currently unloaded. | ||
# The simulation is inactive and cannot be started, stopped, or paused. | ||
|
||
uint8 STATE_LOADING_WORLD = 5 # Simulation world is currently loading. | ||
# The simulation is inactive while world is loading and cannot be started, stopped, or paused. | ||
uint8 state |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Robot or other object which can be spawned in simulation runtime. | ||
|
||
string uri # URI which will be accepted by SpawnEntity service. | ||
Resource entity_resource # The resource (e.g. URDF, SDF) for the model to be spawned. | ||
|
||
string description # Optional description for the user, e.g. "robot X with sensors A,B,C". | ||
|
||
Bounds spawn_bounds # Optional spawn area bounds which fully encompass this object. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# World is a virtual environment in which the simulation happens. | ||
# Worlds are also known as scenes or levels in some simulators. | ||
# Depending on the world format, loading of a world might be associated with changes | ||
# in certain parameters, including physics settings such as gravity. | ||
# World resources may be defined in standard or simulation-specific formats, | ||
# and, depending on the simulator, loaded from local or remote repositories. | ||
|
||
|
||
string name # World name, which is not necessarily unique. | ||
|
||
Resource world_resource # The resource for the world to be loaded. | ||
|
||
string description # Optional custom description of the world | ||
|
||
string[] tags # Optional tags describing the world (e.g., "indoor", "outdoor", "warehouse") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Return a list of available world resources which can be used with LoadWorld. | ||
# Support for this interface is indicated through the AVAILABLE_WORLDS value in GetSimulatorFeatures. | ||
# By default, a simulator will search its default local and online sources. If some | ||
# default sources can't be accessed (e.g. due to connectivity issues), the | ||
# DEFAULT_SOURCES_FAILED error result code will be returned. | ||
|
||
string[] additional_sources # Optional field for additional sources (local or remote) to search, | ||
# specified as standard URIs if possible. | ||
|
||
TagsFilter filter # Only get worlds with tags matching the filter. The filter is optional and matches everything by default. | ||
# This feature is supported if WORLD_TAGS feature is included in output of GetSimulatorFeatures. | ||
|
||
bool offline_only # If true, only offline/local sources should be searched. Defaults to false. | ||
|
||
bool continue_on_error # If true, the simulator will continue to search sources even if some fail. | ||
# The service will return success if any source yielded worlds. Defaults to false. | ||
--- | ||
|
||
uint8 DEFAULT_SOURCES_FAILED = 101 # Some default sources could not be accessed. | ||
|
||
Result result # Standard result message. A specific result code should be used if some sources were not accessible. | ||
|
||
WorldResource[] worlds # Available world resources. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Get information about the currently loaded world in the simulation. | ||
# Support for this interface is indicated through the WORLD_INFO_GETTING value in GetSimulatorFeatures. | ||
|
||
--- | ||
|
||
uint8 NO_WORLD_LOADED = 101 # No world is loaded at the moment. | ||
|
||
Result result # Standard result message | ||
|
||
WorldResource world # Information about the currently loaded world. Only valid if result is RESULT_OK. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Load a simulation world from a file or resource. | ||
ayushgnv marked this conversation as resolved.
Show resolved
Hide resolved
ayushgnv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# This means clearing the current scene (removing all entities), loading the new world and setting the simulation to the stopped state. | ||
# Support for this interface is indicated through the WORLD_LOADING value in GetSimulatorFeatures. | ||
# resource_string field support is indicated through the WORLD_RESOURCE_STRING value in GetSimulatorFeatures. | ||
# Currently loaded worlds will be unloaded before attempting to load a new one. | ||
# Any previously spawned entities will be removed. Once a world is loaded, simulation will be left in a Stopped state. | ||
|
||
string uri # Resource such as SDF, USD, MJCF, or other simulator-native format world file. | ||
|
||
string resource_string # Simulation world passed as a string. This field is used if the uri field is empty. | ||
|
||
bool fail_on_unsupported_element # Fail on unsupported elements (such as SDFormat sub-tags). By default, such elements are ignored. | ||
|
||
|
||
bool ignore_missing_or_unsupported_assets # Ignore missing or unsupported assets. By default, missing or unsupported assets result in failure. | ||
|
||
--- | ||
|
||
uint8 UNSUPPORTED_FORMAT = 101 # Format for uri or resource string is unsupported. | ||
uint8 NO_RESOURCE = 102 # Both uri and resource string are empty. | ||
uint8 RESOURCE_PARSE_ERROR = 103 # Resource file or string failed to parse. | ||
uint8 MISSING_ASSETS = 104 # At least one of resource assets (such as meshes) was not found. | ||
uint8 UNSUPPORTED_ASSETS = 105 # At least one of resource assets (such as meshes) is not supported. | ||
uint8 UNSUPPORTED_ELEMENTS = 106 # At least one of world definition elements such as format tags is unsupported. | ||
|
||
|
||
Result result # Standard result message | ||
|
||
WorldResource world # Information about the loaded world. Only valid if result is RESULT_OK. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Unload the current simulation world. | ||
# Support for this interface is indicated through the WORLD_UNLOADING value in GetSimulatorFeatures. | ||
# Any previously spawned entities will be removed. | ||
|
||
--- | ||
|
||
uint8 NO_WORLD_LOADED = 101 # No world is loaded at the moment. | ||
|
||
Result result # Standard result message |
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.
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.
This seems to be applied to Spawnable, but not to SpawnEntity interface.
Both of these changes are breaking currently released interfaces. I am not opposed to having a quick version uptick for the package with Worlds feature in though.
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.
Thanks for catching! Applied it to SpawnEntity as well.
Bumped the version to 2.0.0 due to the breaking changes