You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rfcs/RFC Simulation Interfaces.md
+23-21Lines changed: 23 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ As a rule of thumb, receiving encouraging feedback from long-standing project de
14
14
### Summary:
15
15
<!-- Single paragraph explanation of the feature -->
16
16
17
-
There is an effort at [ros-simulation/simulation_interfaces](https://github.com/ros-simulation/simulation_interfaces/pull/1) to standardize simulation interfaces existing robotics simulators in [ROS 2](https://docs.ros.org/en/jazzy/index.html).
17
+
This RFC is a follow-up to an effort at [ros-simulation/simulation_interfaces](https://github.com/ros-simulation/simulation_interfaces/pull/1) to standardize simulation interfaces existing robotics simulators in [ROS 2](https://docs.ros.org/en/jazzy/index.html). Current implementation of similar interfaces is limited to ROS 2 Spawner Component, that utilizes gazebo messages for ROS 2 communication. Proposed approach includes three new Components that will fulfill the design presented at [ros-simulation/simulation_interfaces](https://github.com/ros-simulation/simulation_interfaces/pull/1), and that are planned to be developed alongside updates to simulation interfaces. Backward compatibility will be ensured for ROS2SpawnerComponent and ROS2ContactSensor - they will be available through CMake configuration.
18
18
19
19
20
20
### What is the relevance of this feature?
@@ -44,20 +44,22 @@ There is a terminology that was created in [RFC-410](https://github.com/ros-infr
44
44
|Tag | A string that allows filtering entities and named poses
45
45
46
46
47
-
The implementation will be split into three (or more system components):
47
+
The implementation will be split into three (or more) system components:
48
48
- ROS 2 Entities manager \
49
49
It will be responsible for the lifetime of spawned objects, it will cache initial positions.
50
50
- ROS 2 Named poses manager \
51
51
It will be responsible for aggregating information in the Named Pose Game Component.
52
52
- ROS 2 Simulator manager \
53
53
It will be responsible for modifying the global state of the simulation (e.g., pausing, reloading).
54
54
55
-
We will decouple the implementation of those managers from the ROS 2 service.
56
-
Every manager will need to expose public methods that will be callable both from C++ and ROS 2.
55
+
We will decouple the implementation of those features from their ROS 2 interfaces.
56
+
Every manager will need to expose public methods that:
57
+
- will be callable from C++,
58
+
- will be handled through dedicated ROS 2 interface and exposed as service.
57
59
The purpose of that approach is to enable testability without the need for a ROS domain.
58
60
59
61
# ROS 2 API
60
-
In this section, a detailed plan of the implementation with potential limitations is presented.
62
+
This section presents the detailed plan for implementation, including potential limitation.
61
63
62
64
## GetSimulationFeatures service
63
65
@@ -88,7 +90,7 @@ We do not plan to support the moment:
88
90
89
91
Following formats will be supported for spawning (field `spawn_formats` of [SimulatorFeatures.msg](https://github.com/adamdbrw/simulation_interfaces/blob/simulation_interfaces/msg/SimulatorFeatures.msg)):
90
92
```
91
-
[`.spawnables`]
93
+
[`.spawnable`]
92
94
```
93
95
94
96
**Note** Other formats e.g. `URDF` and `SDF` are supported by ROS 2 Gem, but only in Editor.
@@ -136,11 +138,11 @@ Bounds spawn_bounds # Optional spawn area bounds which ful
136
138
137
139
This service advertises available spawnables that can be used in simulation.
138
140
We will utilize the asset catalog to find those spawnables.
139
-
There is a useful API in the Engine to get products assets from the asset catalog:
141
+
There is a useful API in the Engine to get product assets from the asset catalog:
140
142
```cpp
141
143
AZ::Data::AssetCatalogRequests::EnumerateAssets
142
144
```
143
-
The asset catalog contains product assets (such as `.spawnables`, `.azmodel`, `.azbuffer`).
145
+
The asset catalog contains product assets (such as `.spawnable`, `.azmodel`, `.azbuffer`).
144
146
We will introduce another product asset called `.simulationinfo`.
145
147
This asset will contain necessary data about Prefab that can be spawned or adjusted by Simulation Interfaces.
146
148
@@ -175,7 +177,7 @@ A simulation expert who wants to create a robot (or other simulation-ready asset
175
177
* and hand-fill bounds (e.g., sphere radius),
176
178
- export simulation with the export script and [bundle assets](https://docs.o3de.org/docs/user-guide/packaging/asset-bundler/)
177
179
178
-
A ROS 2 user who calls the `GetSpawnables` service against GameLauncher will trigger the following sequence:
180
+
A simulation interfaces user who calls the `GetSpawnables` service against GameLauncher will trigger the following sequence:
179
181
- a call to the asset catalog to find all product assets of the type `.simulationinfo`.
180
182
- The `ROS 2 Entity manager` will aggregate found assets and will prepare a response that will contain:
181
183
*`uri` as `spawnable://@cache@/robot/foorobot.spawnable`
@@ -246,25 +248,25 @@ The ROS 2 user who wants to spawn a new object in their simulation has to have a
246
248
Spawning assets from the file system e.g., `spawnable://home/michalpelka/robots/FooRobot.spawnables` will not be supported.
247
249
248
250
With that URI `ROS 2 Entity Manager` will find respective Asset Id.
249
-
Next, the [SpawnableEntitiesDefinition](https://github.com/o3de/o3de/blob/152bc0a1851d881fe735adf54ec93e1ad7875b11/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableEntitiesInterface.h#L334-L333) interface will be utilized to create a spawn ticket and spawn.
251
+
Next, the [SpawnableEntitiesDefinition](https://github.com/o3de/o3de/blob/152bc0a1851d881fe735adf54ec93e1ad7875b11/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableEntitiesInterface.h#L334-L333) interface will be utilized to create a spawn ticket and spawn entity.
250
252
251
253
During spawning the spawned O3DE entities will be modified:
252
254
- change the name of the root entity to that given by the `name` field,
253
255
-[Transform Component](https://docs.o3de.org/docs/user-guide/components/reference/transform/) of the root entity will modified to reflect the value of the `initial_pose` field,
254
256
-[ROS2 Frame](https://www.docs.o3de.org/docs/user-guide/components/reference/ros2/core/ros2-frame/) to set correct namespace.
255
257
- A component called `SimulationInfoComponent` will be created and attached to the root entity.
256
-
That component will be used to cache information in`simulationinfo` to be easily accessible in the future.
258
+
That component will be used to cache information from`simulationinfo` to be easily accessible in the future.
257
259
-[TagComponent](https://www.docs.o3de.org/docs/user-guide/components/reference/gameplay/tag/) from LmbrCentral gem at root entity will be created (if not present in prefab).
258
-
- TagComponent will be updated with a list of new tags.
260
+
- TagComponent will be updated with a list of tags from 'simulationinfo'.
259
261
260
262
261
263
`SimulationInfoComponent` will be handling a `SimulationInfoComponentRequestBus`.
262
-
`SimulationInfoComponentRequestBus` will have a unique, string key, which will be the resulting name of spawned entity.
263
-
This bus will allow to aggregate all handling entities, and provide and API to find all spawned entities, get their state.
264
+
`SimulationInfoComponentRequestBus` will have a unique string key that will come from the name of spawned entity.
265
+
This approach will result in a centralized aggregation of entities information, and will provide an API to i.a. find all spawned entities get their states.
264
266
265
267
## GetEntities service
266
268
267
-
The service allows to discover of spawned entities.
269
+
This service provides an access to a list of all spawned entities.
268
270
Service definition : [GetEntities](https://github.com/adamdbrw/simulation_interfaces/blob/simulation_interfaces/srv/GetEntities.srv)
269
271
270
272
```
@@ -290,7 +292,7 @@ string name # Entity unique name.
290
292
```
291
293
292
294
We will serve this by calling `SimulationInfoComponentRequestBus` with `AZ::EBusAggregateResults`.
293
-
With that, we will obtain a AZStd::vector of EntityId, that can be converted to a list of entity names.
295
+
With that, we will obtain a 'AZStd::Vector' of 'AZ::EntityId', that can be converted to a list of entity names.
294
296
295
297
## GetEntitiesStates service
296
298
@@ -329,9 +331,9 @@ There will be more calls to :
329
331
-[TransformComponentRequests](https://github.com/o3de/o3de/blob/42d375dd99b972400f9f26bfec7e3444088f3398/Code/Framework/AzCore/AzCore/Component/TransformBus.h) to find current pose,
330
332
-[ROS2FrameBus.h](https://github.com/o3de/o3de-extras/blob/development/Gems/ROS2/Code/Include/ROS2/Frame/ROS2FrameBus.h) to find frame id.
331
333
332
-
**Note !**acceleration is will not be filled, and will not be supported.
334
+
**Note !**Acceleration is will not be filled, and will not be supported.
333
335
334
-
####SetEntityState service
336
+
## SetEntityState service
335
337
336
338
This service allows modifying the state of the chosen entity.
337
339
@@ -666,7 +668,7 @@ If transition is in progress (e.g. reloading level or despawning), the old state
666
668
667
669
668
670
669
-
## Retired components in ROS 2 Gem
671
+
## Deprecated components in ROS 2 Gem
670
672
671
673
During this effort some components will be retired, and some moved outside of scope of supported and canonical repos.
672
674
@@ -676,7 +678,7 @@ The ROS2Spawner component will be retired and hidden away from users with the CM
676
678
This component can co-exist with managers for Simulation Interfaces, but ROS 2 package that the ROS2Spawner requires will be removed from upcoming ROS 2 distribution (Kilted Kaiju).
677
679
The said package (`gazebo_msgs`) will be replaced by `simulation_interfaces`.
678
680
The component will be retired (instead of completely removed from the codebase) to make the transition to Simulation interfaces an easier experience.
679
-
However, using ROS2Spawner component will require a few extra steps (after the EOL of the gazebo_msgs package):
681
+
However, using ROS2Spawner component will require a few extra steps (after the EOL of the `gazebo_msgs` package):
680
682
- cloning and building the latest [gazebo_ros_pkgs/gazebo_msgs](https://github.com/ros-simulation/gazebo_ros_pkgs/tree/3.9.0/gazebo_msgs)
681
683
- sourcing custom workspace
682
684
- setting CMake flag
@@ -719,7 +721,7 @@ It was explained in great detail in the section [ROS 2 API](#ros-2-api).
719
721
### Are there any alternatives to this feature?
720
722
<!-- - Provide any other designs that have been considered. Explain what the impact might be to not doing this.
721
723
- If there is any prior art or approaches with other frameworks in the same domain, explain how they may have solved this problem or implemented this feature. -->
722
-
The effort needs to be taken to adjust the existing code to the eprecation of Gazebo Classic and `gazebo_msgs`.
724
+
The effort needs to be taken to adjust the existing code to the deprecation of Gazebo Classic and `gazebo_msgs`.
0 commit comments