diff --git a/CMakeLists.txt b/CMakeLists.txt index 18eb7dc..70dcf88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ set(msg_files ) set(srv_files + "srv/BatchSpawnEntities.srv" "srv/DeleteEntity.srv" "srv/GetAvailableWorlds.srv" "srv/GetCurrentWorld.srv" diff --git a/msg/SimulatorFeatures.msg b/msg/SimulatorFeatures.msg index 2ea1ce3..b1d4957 100644 --- a/msg/SimulatorFeatures.msg +++ b/msg/SimulatorFeatures.msg @@ -38,6 +38,8 @@ uint8 WORLD_UNLOADING = 43 # Supports UnloadWorld interface uint8 WORLD_INFO_GETTING = 44 # Supports GetCurrentWorld interface uint8 AVAILABLE_WORLDS = 45 # Supports GetAvailableWorlds interface +uint8 SPAWNING_BATCH = 50 # Support batch spawning (SpawnEntities) + uint16[] features # A list of simulation features as specified by the list above. # A list of additional supported formats for spawning, which might be empty. Values may include diff --git a/srv/BatchSpawnEntities.srv b/srv/BatchSpawnEntities.srv new file mode 100644 index 0000000..678a0a3 --- /dev/null +++ b/srv/BatchSpawnEntities.srv @@ -0,0 +1,44 @@ +# Spawn entities (a robot, other object) by name or URI in a batch. +# Support for this interface is indicated through the SPAWNING_BATCH value in GetSimulationFeatures. + +string names[] # A list of names given to every entity + # If string is empty, a name field in the uri file or resource_string will be used, + # if supported and not empty (e.g. "name" field in SDFormat, URDF). + # If the name is still empty or not unique (as determined by the simulator), + # the service returns a generated name in the entity_name response field if the + # allow_renaming field is set to true. Otherwise, the service call fails and an + # error is returned. +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. Number of elements has to match number + # of elements in names. + +Resource entity_resources[] # List of resources 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. Number of elements has to match number + # of elements in names. + +string entity_namespaces[] # Spawn entities with theirs interfaces under those namespaces. Number of elements has to match number + # of elements in names. +geometry_msgs/PoseStamped initial_poses[] # Array of initial poses for every enttiy. + # The header contains a reference frame, which defaults to global "world" frame. + # This frame must be known to the simulator, e.g. of an object spawned earlier. + # The timestamp field in the header is ignored. Number of elements has to match number + # of elements in names. + +--- + +# Additional result.result_code values for this service. Check result.error_message for further details. + +uint8 BATCH_SPAWN_MISMATCH = 110 # There is a mismatch in number of elements in names, allow_renaming, entity_resources, + # entity_namespaces, initial_poses. +uint8 BATCH_SPAWN_FAILED = 120 # There was at least one failed spawn request. Check individual results in results. + +Result result # RESULT_OK if all spawning requests succeeded, otherwise BATCH_SPAWN_FAILED +Result results[] # Individual spawn request results. Supported return codes are in SpawnEntity.srv. + # Number of elements is the same as the number of names in request. +string entity_names[] # List of names of spawned entities, guaranteed to be unique in the simulation. + # If allow_renaming is true, it may differ from the request name field. + # Number of elements is the same as the number of names in request.