From 9997b6c06bc960baf1647d7db7192bc63478b617 Mon Sep 17 00:00:00 2001 From: Ayush Ghosh Date: Tue, 1 Apr 2025 13:06:44 -0700 Subject: [PATCH 01/21] Added new interfaces for simulation worlds --- CMakeLists.txt | 5 +++++ README.md | 4 ++++ msg/SimulatorFeatures.msg | 5 +++++ msg/WorldResource.msg | 16 ++++++++++++++++ srv/GetAvailableWorlds.srv | 10 ++++++++++ srv/GetCurrentWorld.srv | 8 ++++++++ srv/LoadWorld.srv | 23 +++++++++++++++++++++++ srv/UnloadWorld.srv | 7 +++++++ 8 files changed, 78 insertions(+) create mode 100644 msg/WorldResource.msg create mode 100644 srv/GetAvailableWorlds.srv create mode 100644 srv/GetCurrentWorld.srv create mode 100644 srv/LoadWorld.srv create mode 100644 srv/UnloadWorld.srv diff --git a/CMakeLists.txt b/CMakeLists.txt index 7636213..4e983dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ set(msg_files "msg/SimulatorFeatures.msg" "msg/Spawnable.msg" "msg/TagsFilter.msg" + "msg/WorldResource.msg" ) set(srv_files @@ -48,6 +49,10 @@ set(srv_files "srv/SetSimulationState.srv" "srv/SpawnEntity.srv" "srv/StepSimulation.srv" + "srv/LoadWorld.srv" + "srv/UnloadWorld.srv" + "srv/GetCurrentWorld.srv" + "srv/GetAvailableWorlds.srv" ) set(action_files diff --git a/README.md b/README.md index d468902..918135e 100644 --- a/README.md +++ b/README.md @@ -23,3 +23,7 @@ Some interfaces represent optional utility and are considered lower priority: - [GetNamedPoses](srv/GetNamedPoses.srv) - [GetSpawnables](srv/GetSpawnables.srv) - [SetEntityInfo](srv/SetEntityInfo.srv) +- [GetAvailableWorlds](srv/GetAvailableWorlds.srv) +- [LoadWorld](srv/LoadWorld.srv) +- [UnloadWorld](srv/UnloadWorld.srv) +- [GetCurrentWorld](srv/GetCurrentWorld.srv) diff --git a/msg/SimulatorFeatures.msg b/msg/SimulatorFeatures.msg index 023c80d..244d7db 100644 --- a/msg/SimulatorFeatures.msg +++ b/msg/SimulatorFeatures.msg @@ -31,6 +31,11 @@ uint8 STEP_SIMULATION_MULTIPLE = 32 # Supports multi-stepping through simu # service or through SimulateSteps action. uint8 STEP_SIMULATION_ACTION = 33 # Supports SimulateSteps action interface. +uint8 WORLD_LOADING = 40 # Supports LoadWorld interface +uint8 WORLD_LOADING_RESOURCE_STRING = 41 # Supports LoadWorld resource_string field +uint8 WORLD_UNLOADING = 42 # Supports UnloadWorld interface +uint8 WORLD_INFO_GETTING = 43 # Supports GetCurrentWorld interface +uint8 AVAILABLE_WORLDS = 44 # Supports GetAvailableWorlds interface uint16[] features # A list of simulation features as specified by the list above. diff --git a/msg/WorldResource.msg b/msg/WorldResource.msg new file mode 100644 index 0000000..3f5b3a4 --- /dev/null +++ b/msg/WorldResource.msg @@ -0,0 +1,16 @@ +# World resource that can be loaded into the simulation + +# World name +string name + +# URI which will be accepted by LoadWorld service +string uri + +# Optional description of the world +string description + +# Optional tags describing the world (e.g., "indoor", "outdoor", "warehouse") +string[] tags + +# Whether this is the simulator's default/initial world +bool is_default \ No newline at end of file diff --git a/srv/GetAvailableWorlds.srv b/srv/GetAvailableWorlds.srv new file mode 100644 index 0000000..8a4b9c5 --- /dev/null +++ b/srv/GetAvailableWorlds.srv @@ -0,0 +1,10 @@ +# Return a list of available world resources which are valid as LoadWorld uri fields + +# Optional field for additional sources (local or remote) to search +string[] sources +--- +# Standard result message +simulation_interfaces/Result result + +# Available world resources with URI and additional information +simulation_interfaces/WorldResource[] worlds \ No newline at end of file diff --git a/srv/GetCurrentWorld.srv b/srv/GetCurrentWorld.srv new file mode 100644 index 0000000..586f77b --- /dev/null +++ b/srv/GetCurrentWorld.srv @@ -0,0 +1,8 @@ +# Get information about the currently loaded world in the simulation + +--- +# Standard result message +simulation_interfaces/Result result + +# Information about the currently loaded world +simulation_interfaces/WorldResource world \ No newline at end of file diff --git a/srv/LoadWorld.srv b/srv/LoadWorld.srv new file mode 100644 index 0000000..ebfa8d7 --- /dev/null +++ b/srv/LoadWorld.srv @@ -0,0 +1,23 @@ +# Load a simulation world from a file or resource + +# Resource such as SDF, URDF, USD, or MJCF world file +string uri + +# World definition passed as a string +string resource_string + +# If true, existing entities will be cleared before loading the new world +bool clear_entities +--- +# Error Codes +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 + +# Standard result message +simulation_interfaces/Result result + +# Information about the loaded world +simulation_interfaces/WorldResource world diff --git a/srv/UnloadWorld.srv b/srv/UnloadWorld.srv new file mode 100644 index 0000000..2491202 --- /dev/null +++ b/srv/UnloadWorld.srv @@ -0,0 +1,7 @@ +# Unload the current simulation world + +# If true, existing dynamically spawned entities will remain +bool keep_entities +--- +# Standard result message +simulation_interfaces/Result result \ No newline at end of file From 8dbbf053cdb27857d1ac3fd9cd4e017eebf20fc4 Mon Sep 17 00:00:00 2001 From: Ayush Ghosh Date: Tue, 1 Apr 2025 13:09:31 -0700 Subject: [PATCH 02/21] Fix formatting --- msg/WorldResource.msg | 2 +- srv/GetAvailableWorlds.srv | 2 +- srv/GetCurrentWorld.srv | 2 +- srv/UnloadWorld.srv | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/msg/WorldResource.msg b/msg/WorldResource.msg index 3f5b3a4..dbfb307 100644 --- a/msg/WorldResource.msg +++ b/msg/WorldResource.msg @@ -13,4 +13,4 @@ string description string[] tags # Whether this is the simulator's default/initial world -bool is_default \ No newline at end of file +bool is_default diff --git a/srv/GetAvailableWorlds.srv b/srv/GetAvailableWorlds.srv index 8a4b9c5..5250719 100644 --- a/srv/GetAvailableWorlds.srv +++ b/srv/GetAvailableWorlds.srv @@ -7,4 +7,4 @@ string[] sources simulation_interfaces/Result result # Available world resources with URI and additional information -simulation_interfaces/WorldResource[] worlds \ No newline at end of file +simulation_interfaces/WorldResource[] worlds diff --git a/srv/GetCurrentWorld.srv b/srv/GetCurrentWorld.srv index 586f77b..566584c 100644 --- a/srv/GetCurrentWorld.srv +++ b/srv/GetCurrentWorld.srv @@ -5,4 +5,4 @@ simulation_interfaces/Result result # Information about the currently loaded world -simulation_interfaces/WorldResource world \ No newline at end of file +simulation_interfaces/WorldResource world diff --git a/srv/UnloadWorld.srv b/srv/UnloadWorld.srv index 2491202..2cd44ca 100644 --- a/srv/UnloadWorld.srv +++ b/srv/UnloadWorld.srv @@ -4,4 +4,4 @@ bool keep_entities --- # Standard result message -simulation_interfaces/Result result \ No newline at end of file +simulation_interfaces/Result result From 7d109c6cd84788c9aef20f2ea9fe5a930f5ada43 Mon Sep 17 00:00:00 2001 From: Ayush Ghosh Date: Tue, 1 Apr 2025 14:51:56 -0700 Subject: [PATCH 03/21] Updated descriptions --- srv/GetAvailableWorlds.srv | 2 ++ srv/GetCurrentWorld.srv | 2 ++ srv/LoadWorld.srv | 5 +++++ srv/UnloadWorld.srv | 2 ++ 4 files changed, 11 insertions(+) diff --git a/srv/GetAvailableWorlds.srv b/srv/GetAvailableWorlds.srv index 5250719..80a7ee2 100644 --- a/srv/GetAvailableWorlds.srv +++ b/srv/GetAvailableWorlds.srv @@ -1,4 +1,6 @@ # Return a list of available world resources which are valid as LoadWorld uri fields +# +# Support for this interface is indicated through the AVAILABLE_WORLDS value in GetSimulatorFeatures. # Optional field for additional sources (local or remote) to search string[] sources diff --git a/srv/GetCurrentWorld.srv b/srv/GetCurrentWorld.srv index 566584c..5473f8b 100644 --- a/srv/GetCurrentWorld.srv +++ b/srv/GetCurrentWorld.srv @@ -1,4 +1,6 @@ # Get information about the currently loaded world in the simulation +# +# Support for this interface is indicated through the WORLD_INFO_GETTING value in GetSimulatorFeatures. --- # Standard result message diff --git a/srv/LoadWorld.srv b/srv/LoadWorld.srv index ebfa8d7..756923d 100644 --- a/srv/LoadWorld.srv +++ b/srv/LoadWorld.srv @@ -1,4 +1,9 @@ # Load a simulation world from a file or resource +# +# Support for this interface is indicated through the WORLD_LOADING value in GetSimulatorFeatures. +# Support for the resource_string field is indicated through the WORLD_LOADING_RESOURCE_STRING value in GetSimulatorFeatures. + +# Existing worlds will be unloaded before attempting to load a new one. # Resource such as SDF, URDF, USD, or MJCF world file string uri diff --git a/srv/UnloadWorld.srv b/srv/UnloadWorld.srv index 2cd44ca..1004429 100644 --- a/srv/UnloadWorld.srv +++ b/srv/UnloadWorld.srv @@ -1,4 +1,6 @@ # Unload the current simulation world +# +# Support for this interface is indicated through the WORLD_UNLOADING value in GetSimulatorFeatures. # If true, existing dynamically spawned entities will remain bool keep_entities From 7d058552c4075a06de8d3fdefd398132f8827327 Mon Sep 17 00:00:00 2001 From: Ayush Ghosh Date: Thu, 10 Apr 2025 19:46:58 -0700 Subject: [PATCH 04/21] Added STATE_INITIALIZING in SimulationState.msg --- msg/SimulationState.msg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/msg/SimulationState.msg b/msg/SimulationState.msg index 41e3942..65d3bd6 100644 --- a/msg/SimulationState.msg +++ b/msg/SimulationState.msg @@ -13,4 +13,6 @@ uint8 STATE_QUITTING = 3 # Closing the simulator application. Swit # 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_INITIALIZING = 4 # Simulation resources are being loaded. The simulation is inactive + # and cannot be started, stopped, or paused. uint8 state From c4f5ec6bba3af1895f025ed595b317de7fc3bd5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20D=C4=85browski?= Date: Thu, 17 Apr 2025 13:45:42 +0200 Subject: [PATCH 05/21] suggested changes to simulation interface worlds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adam Dąbrowski --- msg/SimulatorFeatures.msg | 2 +- msg/WorldResource.msg | 14 ++++++++------ srv/GetAvailableWorlds.srv | 17 +++++++++++------ srv/GetCurrentWorld.srv | 12 +++++++----- srv/LoadWorld.srv | 39 +++++++++++++++++++------------------- srv/UnloadWorld.srv | 11 ++++++----- 6 files changed, 53 insertions(+), 42 deletions(-) diff --git a/msg/SimulatorFeatures.msg b/msg/SimulatorFeatures.msg index 244d7db..a4ca133 100644 --- a/msg/SimulatorFeatures.msg +++ b/msg/SimulatorFeatures.msg @@ -32,7 +32,7 @@ uint8 STEP_SIMULATION_MULTIPLE = 32 # Supports multi-stepping through simu uint8 STEP_SIMULATION_ACTION = 33 # Supports SimulateSteps action interface. uint8 WORLD_LOADING = 40 # Supports LoadWorld interface -uint8 WORLD_LOADING_RESOURCE_STRING = 41 # Supports LoadWorld resource_string field +uint8 WORLD_LOADING_STRING = 41 # Supports LoadWorld resource_string field uint8 WORLD_UNLOADING = 42 # Supports UnloadWorld interface uint8 WORLD_INFO_GETTING = 43 # Supports GetCurrentWorld interface uint8 AVAILABLE_WORLDS = 44 # Supports GetAvailableWorlds interface diff --git a/msg/WorldResource.msg b/msg/WorldResource.msg index dbfb307..db92f48 100644 --- a/msg/WorldResource.msg +++ b/msg/WorldResource.msg @@ -1,9 +1,14 @@ -# World resource that can be loaded into the simulation +# 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. -# World name +# World name, which is not necessarily unique. string name -# URI which will be accepted by LoadWorld service +# URI which will be accepted by LoadWorld service, unique per world. string uri # Optional description of the world @@ -11,6 +16,3 @@ string description # Optional tags describing the world (e.g., "indoor", "outdoor", "warehouse") string[] tags - -# Whether this is the simulator's default/initial world -bool is_default diff --git a/srv/GetAvailableWorlds.srv b/srv/GetAvailableWorlds.srv index 80a7ee2..4232c9e 100644 --- a/srv/GetAvailableWorlds.srv +++ b/srv/GetAvailableWorlds.srv @@ -1,12 +1,17 @@ -# Return a list of available world resources which are valid as LoadWorld uri fields -# +# 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. -# Optional field for additional sources (local or remote) to search +# Optional field for additional sources (local or remote) to search, +# specified as standard URIs if possible. string[] sources + +# Only get worlds with tags matching the filter +TagsFilter filter + --- + # Standard result message -simulation_interfaces/Result result +Result result -# Available world resources with URI and additional information -simulation_interfaces/WorldResource[] worlds +# Available world resources. +WorldResource[] worlds diff --git a/srv/GetCurrentWorld.srv b/srv/GetCurrentWorld.srv index 5473f8b..4ab9aad 100644 --- a/srv/GetCurrentWorld.srv +++ b/srv/GetCurrentWorld.srv @@ -1,10 +1,12 @@ -# Get information about the currently loaded world in the simulation -# +# 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. + # Standard result message -simulation_interfaces/Result result +Result result -# Information about the currently loaded world -simulation_interfaces/WorldResource world +# Information about the currently loaded world. Only valid if result is RESULT_OK. +WorldResource world diff --git a/srv/LoadWorld.srv b/srv/LoadWorld.srv index 756923d..a5a3cfd 100644 --- a/srv/LoadWorld.srv +++ b/srv/LoadWorld.srv @@ -1,28 +1,29 @@ -# Load a simulation world from a file or resource -# +# Load a simulation world from a file or resource. # Support for this interface is indicated through the WORLD_LOADING value in GetSimulatorFeatures. -# Support for the resource_string field is indicated through the WORLD_LOADING_RESOURCE_STRING 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. -# Existing worlds will be unloaded before attempting to load a new one. - -# Resource such as SDF, URDF, USD, or MJCF world file +# Resource such as SDF, URDF, USD, MJCF, or other simulator-native format world file. string uri -# World definition passed as a string +# Simulation world passed as a string. This field is used if the uri field is empty. string resource_string -# If true, existing entities will be cleared before loading the new world -bool clear_entities +# Fail on unsupported elements (such as SDFormat sub-tags). By default, such elements are ignored. +bool fail_on_unsupported_element + +# Ignore missing or unsupported assets. By default, missing or unsupported assets result in failure. +bool ignore_missing_or_unsupported_assets + --- -# Error Codes -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 -# Standard result message -simulation_interfaces/Result result +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. -# Information about the loaded world -simulation_interfaces/WorldResource world +# Standard result message +Result result diff --git a/srv/UnloadWorld.srv b/srv/UnloadWorld.srv index 1004429..49ced6a 100644 --- a/srv/UnloadWorld.srv +++ b/srv/UnloadWorld.srv @@ -1,9 +1,10 @@ -# Unload the current simulation world -# +# 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. -# If true, existing dynamically spawned entities will remain -bool keep_entities --- + +uint8 NO_WORLD_LOADED = 101 # No world is loaded at the moment. + # Standard result message -simulation_interfaces/Result result +Result result From 90dab2940b15d0cecd95a7a0bc8dd08d6876daa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20D=C4=85browski?= Date: Tue, 22 Apr 2025 10:44:30 +0200 Subject: [PATCH 06/21] Applied review remarks + added extra feature field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adam Dąbrowski --- msg/SimulatorFeatures.msg | 9 +++++---- srv/GetAvailableWorlds.srv | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/msg/SimulatorFeatures.msg b/msg/SimulatorFeatures.msg index a4ca133..2ea1ce3 100644 --- a/msg/SimulatorFeatures.msg +++ b/msg/SimulatorFeatures.msg @@ -32,10 +32,11 @@ uint8 STEP_SIMULATION_MULTIPLE = 32 # Supports multi-stepping through simu uint8 STEP_SIMULATION_ACTION = 33 # Supports SimulateSteps action interface. uint8 WORLD_LOADING = 40 # Supports LoadWorld interface -uint8 WORLD_LOADING_STRING = 41 # Supports LoadWorld resource_string field -uint8 WORLD_UNLOADING = 42 # Supports UnloadWorld interface -uint8 WORLD_INFO_GETTING = 43 # Supports GetCurrentWorld interface -uint8 AVAILABLE_WORLDS = 44 # Supports GetAvailableWorlds interface +uint8 WORLD_RESOURCE_STRING = 41 # Supports LoadWorld resource_string field +uint8 WORLD_TAGS = 42 # Supports world tags and tag filtering +uint8 WORLD_UNLOADING = 43 # Supports UnloadWorld interface +uint8 WORLD_INFO_GETTING = 44 # Supports GetCurrentWorld interface +uint8 AVAILABLE_WORLDS = 45 # Supports GetAvailableWorlds interface uint16[] features # A list of simulation features as specified by the list above. diff --git a/srv/GetAvailableWorlds.srv b/srv/GetAvailableWorlds.srv index 4232c9e..c47a4a0 100644 --- a/srv/GetAvailableWorlds.srv +++ b/srv/GetAvailableWorlds.srv @@ -5,7 +5,8 @@ # specified as standard URIs if possible. string[] sources -# Only get worlds with tags matching the filter +# Only get worlds with tags matching the filter. The filter is optional and none by default. +# This feature is supported if WORLD_TAGS feature is included in output of GetSimulatorFeatures. TagsFilter filter --- From cb5ff480ef1268c1c05423946dcd6e05a954b9af Mon Sep 17 00:00:00 2001 From: Ayush Ghosh <149644562+ayushgnv@users.noreply.github.com> Date: Fri, 2 May 2025 00:38:01 +0200 Subject: [PATCH 07/21] Update srv/GetAvailableWorlds.srv Co-authored-by: Martin Pecka --- srv/GetAvailableWorlds.srv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srv/GetAvailableWorlds.srv b/srv/GetAvailableWorlds.srv index c47a4a0..5ca6e07 100644 --- a/srv/GetAvailableWorlds.srv +++ b/srv/GetAvailableWorlds.srv @@ -5,7 +5,7 @@ # specified as standard URIs if possible. string[] sources -# Only get worlds with tags matching the filter. The filter is optional and none by default. +# 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. TagsFilter filter From fdc053732ee563d967c7021e25d4c0490da2c850 Mon Sep 17 00:00:00 2001 From: Ayush Ghosh <149644562+ayushgnv@users.noreply.github.com> Date: Fri, 2 May 2025 00:40:18 +0200 Subject: [PATCH 08/21] Update srv/LoadWorld.srv Co-authored-by: Martin Pecka --- srv/LoadWorld.srv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srv/LoadWorld.srv b/srv/LoadWorld.srv index a5a3cfd..b2bb60f 100644 --- a/srv/LoadWorld.srv +++ b/srv/LoadWorld.srv @@ -1,6 +1,6 @@ # Load a simulation world from a file or resource. # 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. +# 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. From d0b5ece8052530b17d08f17e28768fa064675f64 Mon Sep 17 00:00:00 2001 From: Ayush Ghosh <149644562+ayushgnv@users.noreply.github.com> Date: Fri, 2 May 2025 00:47:11 +0200 Subject: [PATCH 09/21] Removed urdf mention in LoadWorld service --- srv/LoadWorld.srv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srv/LoadWorld.srv b/srv/LoadWorld.srv index b2bb60f..6b3e91f 100644 --- a/srv/LoadWorld.srv +++ b/srv/LoadWorld.srv @@ -4,7 +4,7 @@ # Currently loaded worlds will be unloaded before attempting to load a new one. # Any previously spawned entities will be removed. -# Resource such as SDF, URDF, USD, MJCF, or other simulator-native format world file. +# Resource such as SDF, USD, MJCF, or other simulator-native format world file. string uri # Simulation world passed as a string. This field is used if the uri field is empty. From e1a3044bf65f7772b9eb7060fda335e6ee660b7c Mon Sep 17 00:00:00 2001 From: Ayush Ghosh <149644562+ayushgnv@users.noreply.github.com> Date: Mon, 5 May 2025 17:05:10 +0200 Subject: [PATCH 10/21] Update srv/LoadWorld.srv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Adam Dąbrowski --- srv/LoadWorld.srv | 1 + 1 file changed, 1 insertion(+) diff --git a/srv/LoadWorld.srv b/srv/LoadWorld.srv index 6b3e91f..32c19aa 100644 --- a/srv/LoadWorld.srv +++ b/srv/LoadWorld.srv @@ -1,4 +1,5 @@ # Load a simulation world from a file or resource. +# 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. From 1a43d33cba8ddaf84c557f59b4f21a14df770602 Mon Sep 17 00:00:00 2001 From: Ayush Ghosh <149644562+ayushgnv@users.noreply.github.com> Date: Tue, 6 May 2025 12:50:17 +0200 Subject: [PATCH 11/21] Added WorldResource in LoadWorld and renamed to STATE_NO_WORLD in SimulationState --- msg/SimulationState.msg | 4 ++-- srv/LoadWorld.srv | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/msg/SimulationState.msg b/msg/SimulationState.msg index 65d3bd6..c5e4175 100644 --- a/msg/SimulationState.msg +++ b/msg/SimulationState.msg @@ -13,6 +13,6 @@ uint8 STATE_QUITTING = 3 # Closing the simulator application. Swit # 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_INITIALIZING = 4 # Simulation resources are being loaded. The simulation is inactive - # and cannot be started, stopped, or paused. +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 diff --git a/srv/LoadWorld.srv b/srv/LoadWorld.srv index 32c19aa..aa79694 100644 --- a/srv/LoadWorld.srv +++ b/srv/LoadWorld.srv @@ -3,7 +3,7 @@ # 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. +# Any previously spawned entities will be removed. Once a world is loaded, simulation will be left in a Stopped state. # Resource such as SDF, USD, MJCF, or other simulator-native format world file. string uri @@ -28,3 +28,6 @@ uint8 UNSUPPORTED_ELEMENTS = 106 # At least one of world definition elements # Standard result message Result result + +# Information about the loaded world. Only valid if result is RESULT_OK. +WorldResource world \ No newline at end of file From e9f04a3f2d46c5891ef88b6a7a604ffaea29338d Mon Sep 17 00:00:00 2001 From: Ayush Ghosh <149644562+ayushgnv@users.noreply.github.com> Date: Tue, 6 May 2025 12:55:20 +0200 Subject: [PATCH 12/21] Fix formatting --- srv/LoadWorld.srv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srv/LoadWorld.srv b/srv/LoadWorld.srv index aa79694..60d437a 100644 --- a/srv/LoadWorld.srv +++ b/srv/LoadWorld.srv @@ -30,4 +30,4 @@ uint8 UNSUPPORTED_ELEMENTS = 106 # At least one of world definition elements Result result # Information about the loaded world. Only valid if result is RESULT_OK. -WorldResource world \ No newline at end of file +WorldResource world From df77fa194fb44f5098dbf93665c76b0731d5ae6d Mon Sep 17 00:00:00 2001 From: Ayush Ghosh <149644562+ayushgnv@users.noreply.github.com> Date: Wed, 18 Jun 2025 23:42:01 -0700 Subject: [PATCH 13/21] Update msg/SimulationState.msg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Adam Dąbrowski --- msg/SimulationState.msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msg/SimulationState.msg b/msg/SimulationState.msg index c5e4175..cc13a48 100644 --- a/msg/SimulationState.msg +++ b/msg/SimulationState.msg @@ -13,6 +13,6 @@ uint8 STATE_QUITTING = 3 # Closing the simulator application. Swit # 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 and a new world has not finished loading yet. +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. uint8 state From f03664557e93ef3fed1c13b1d0c7bbf3e813d2d6 Mon Sep 17 00:00:00 2001 From: Ayush Ghosh <149644562+ayushgnv@users.noreply.github.com> Date: Thu, 26 Jun 2025 22:21:31 -0700 Subject: [PATCH 14/21] Update srv/GetAvailableWorlds.srv Update sources field to additional_sources Co-authored-by: Martin Pecka --- srv/GetAvailableWorlds.srv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srv/GetAvailableWorlds.srv b/srv/GetAvailableWorlds.srv index 5ca6e07..831e6e2 100644 --- a/srv/GetAvailableWorlds.srv +++ b/srv/GetAvailableWorlds.srv @@ -3,7 +3,7 @@ # Optional field for additional sources (local or remote) to search, # specified as standard URIs if possible. -string[] sources +string[] additional_sources # 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. From 04962fc53241c02f5d1a51293e1a61e21129a94b Mon Sep 17 00:00:00 2001 From: Ayush Ghosh Date: Thu, 26 Jun 2025 22:50:34 -0700 Subject: [PATCH 15/21] Added Resource message type --- CMakeLists.txt | 7 ++++--- msg/Resource.msg | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 msg/Resource.msg diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e983dd..18eb7dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,7 @@ set(msg_files "msg/EntityInfo.msg" "msg/EntityState.msg" "msg/NamedPose.msg" + "msg/Resource.msg" "msg/Result.msg" "msg/SimulationState.msg" "msg/SimulatorFeatures.msg" @@ -33,6 +34,8 @@ set(msg_files set(srv_files "srv/DeleteEntity.srv" + "srv/GetAvailableWorlds.srv" + "srv/GetCurrentWorld.srv" "srv/GetEntities.srv" "srv/GetEntitiesStates.srv" "srv/GetEntityBounds.srv" @@ -43,16 +46,14 @@ set(srv_files "srv/GetSimulationState.srv" "srv/GetSimulatorFeatures.srv" "srv/GetSpawnables.srv" + "srv/LoadWorld.srv" "srv/ResetSimulation.srv" "srv/SetEntityInfo.srv" "srv/SetEntityState.srv" "srv/SetSimulationState.srv" "srv/SpawnEntity.srv" "srv/StepSimulation.srv" - "srv/LoadWorld.srv" "srv/UnloadWorld.srv" - "srv/GetCurrentWorld.srv" - "srv/GetAvailableWorlds.srv" ) set(action_files diff --git a/msg/Resource.msg b/msg/Resource.msg new file mode 100644 index 0000000..01945be --- /dev/null +++ b/msg/Resource.msg @@ -0,0 +1,5 @@ +# This message is used to specify a resource, either by a URI or by its string content. + +string uri + +string resource_string # The content of the resource, only used if uri is empty From dcdbdb8ac970de66fbb849bd404086c9247df0da Mon Sep 17 00:00:00 2001 From: Ayush Ghosh Date: Thu, 26 Jun 2025 22:51:46 -0700 Subject: [PATCH 16/21] Populate resource msgs with new Resource msg type --- msg/Spawnable.msg | 4 +++- msg/WorldResource.msg | 13 +++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/msg/Spawnable.msg b/msg/Spawnable.msg index c89eae2..2b53106 100644 --- a/msg/Spawnable.msg +++ b/msg/Spawnable.msg @@ -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. diff --git a/msg/WorldResource.msg b/msg/WorldResource.msg index db92f48..8061e86 100644 --- a/msg/WorldResource.msg +++ b/msg/WorldResource.msg @@ -5,14 +5,11 @@ # World resources may be defined in standard or simulation-specific formats, # and, depending on the simulator, loaded from local or remote repositories. -# World name, which is not necessarily unique. -string name -# URI which will be accepted by LoadWorld service, unique per world. -string uri +string name # World name, which is not necessarily unique. -# Optional description of the world -string description +Resource world_resource # The resource for the world to be loaded. -# Optional tags describing the world (e.g., "indoor", "outdoor", "warehouse") -string[] tags +string description # Optional custom description of the world + +string[] tags # Optional tags describing the world (e.g., "indoor", "outdoor", "warehouse") From 45ab91625131afeac08c1f40ed42369a869c2917 Mon Sep 17 00:00:00 2001 From: Ayush Ghosh Date: Thu, 26 Jun 2025 22:52:26 -0700 Subject: [PATCH 17/21] Added Loading World state --- msg/SimulationState.msg | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/msg/SimulationState.msg b/msg/SimulationState.msg index cc13a48..24246f7 100644 --- a/msg/SimulationState.msg +++ b/msg/SimulationState.msg @@ -1,18 +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_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. +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 From 2b0a5c1ecd39cc3678cc0fc23ee4e2133a14f76e Mon Sep 17 00:00:00 2001 From: Ayush Ghosh Date: Thu, 26 Jun 2025 23:18:09 -0700 Subject: [PATCH 18/21] Fixed formatting and updated the world services --- srv/GetAvailableWorlds.srv | 25 +++++++++++++++---------- srv/GetCurrentWorld.srv | 8 +++----- srv/LoadWorld.srv | 32 ++++++++++++++------------------ srv/UnloadWorld.srv | 3 +-- 4 files changed, 33 insertions(+), 35 deletions(-) diff --git a/srv/GetAvailableWorlds.srv b/srv/GetAvailableWorlds.srv index 831e6e2..9b58452 100644 --- a/srv/GetAvailableWorlds.srv +++ b/srv/GetAvailableWorlds.srv @@ -1,18 +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. -# Optional field for additional sources (local or remote) to search, -# specified as standard URIs if possible. -string[] additional_sources +string[] additional_sources # Optional field for additional sources (local or remote) to search, + # specified as standard URIs if possible. -# 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. -TagsFilter filter +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. --- -# Standard result message -Result result +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. -# Available world resources. -WorldResource[] worlds +WorldResource[] worlds # Available world resources. diff --git a/srv/GetCurrentWorld.srv b/srv/GetCurrentWorld.srv index 4ab9aad..7ade9b3 100644 --- a/srv/GetCurrentWorld.srv +++ b/srv/GetCurrentWorld.srv @@ -3,10 +3,8 @@ --- -uint8 NO_WORLD_LOADED = 101 # No world is loaded at the moment. +uint8 NO_WORLD_LOADED = 101 # No world is loaded at the moment. -# Standard result message -Result result +Result result # Standard result message -# Information about the currently loaded world. Only valid if result is RESULT_OK. -WorldResource world +WorldResource world # Information about the currently loaded world. Only valid if result is RESULT_OK. diff --git a/srv/LoadWorld.srv b/srv/LoadWorld.srv index 60d437a..c4736d4 100644 --- a/srv/LoadWorld.srv +++ b/srv/LoadWorld.srv @@ -5,29 +5,25 @@ # 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. -# Resource such as SDF, USD, MJCF, or other simulator-native format world file. -string uri +string uri # Resource such as SDF, USD, MJCF, or other simulator-native format world file. -# Simulation world passed as a string. This field is used if the uri field is empty. -string resource_string +string resource_string # Simulation world passed as a string. This field is used if the uri field is empty. -# Fail on unsupported elements (such as SDFormat sub-tags). By default, such elements are ignored. -bool fail_on_unsupported_element +bool fail_on_unsupported_element # Fail on unsupported elements (such as SDFormat sub-tags). By default, such elements are ignored. -# Ignore missing or unsupported assets. By default, missing or unsupported assets result in failure. -bool ignore_missing_or_unsupported_assets + +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. +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. + -# Standard result message -Result result +Result result # Standard result message -# Information about the loaded world. Only valid if result is RESULT_OK. -WorldResource world +WorldResource world # Information about the loaded world. Only valid if result is RESULT_OK. diff --git a/srv/UnloadWorld.srv b/srv/UnloadWorld.srv index 49ced6a..aa04752 100644 --- a/srv/UnloadWorld.srv +++ b/srv/UnloadWorld.srv @@ -6,5 +6,4 @@ uint8 NO_WORLD_LOADED = 101 # No world is loaded at the moment. -# Standard result message -Result result +Result result # Standard result message From de3ad4262336f0690629e05a81a20533266ef91e Mon Sep 17 00:00:00 2001 From: Ayush Ghosh Date: Fri, 27 Jun 2025 12:54:20 -0700 Subject: [PATCH 19/21] Updated documentation for Resource message --- msg/Resource.msg | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/msg/Resource.msg b/msg/Resource.msg index 01945be..e16aeb2 100644 --- a/msg/Resource.msg +++ b/msg/Resource.msg @@ -1,5 +1,7 @@ # This message is used to specify a resource, either by a URI or by its string content. -string uri - -string resource_string # The content of the resource, only used if uri is empty +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). \ No newline at end of file From e3a1af04e8b8717b9329929a9ee3035cda52fcec Mon Sep 17 00:00:00 2001 From: Ayush Ghosh Date: Fri, 27 Jun 2025 12:55:25 -0700 Subject: [PATCH 20/21] Update Spawn Entity to use Resource Message --- srv/SpawnEntity.srv | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/srv/SpawnEntity.srv b/srv/SpawnEntity.srv index 0e76c10..cab2afa 100644 --- a/srv/SpawnEntity.srv +++ b/srv/SpawnEntity.srv @@ -11,15 +11,13 @@ string name # A name to give to the spawned entity. bool allow_renaming # Determines whether the spawning succeeds with a non-unique name. # If it is set to true, the user should always check entity_name response field # and use it for any further interactions. -string uri # Resource such as SDFormat, URDF, USD or MJCF file, a native prefab, etc. - # Valid URIs can be determined by calling GetSpawnables first, and you can check - # the simulator format support by reading SimulatorFeatures spawn_formats field. - # If uri field is empty, resource_string must not be empty. -string resource_string # An entity definition file passed as a string. - # Simulators may support spawning from a file generated on the fly (e.g. XACRO). - # It is supported by your simulator if GetSimulatorFeatures includes - # SPAWNING_RESOURCE_STRING feature. - # If uri field is not empty, resource_string field will be ignored. + +Resource entity_resource # Resource such as SDFormat, URDF, USD or MJCF file, a native prefab, etc. + # Valid URIs can be determined by calling GetSpawnables first. + # Check simulator format support via the spawn_formats field in GetSimulatorFeatures. + # Using resource_string is supported if GetSimulatorFeatures includes + # the SPAWNING_RESOURCE_STRING feature. + string entity_namespace # Spawn the entity with all its interfaces under this namespace. geometry_msgs/PoseStamped initial_pose # Initial entity pose. # The header contains a reference frame, which defaults to global "world" frame. From e87f3996e9601f8f7ad6444bd2accd607430bb6a Mon Sep 17 00:00:00 2001 From: Ayush Ghosh Date: Fri, 27 Jun 2025 13:01:22 -0700 Subject: [PATCH 21/21] Bumped package version due to breaking changes --- package.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.xml b/package.xml index e6d4e14..f9c7d22 100644 --- a/package.xml +++ b/package.xml @@ -2,7 +2,7 @@ simulation_interfaces - 1.0.1 + 2.0.0 A package containing simulation interfaces including messages, services and actions Adam Dabrowski Apache License 2.0