Skip to content

Commit ab9dfb7

Browse files
michalpelkaPawelLiberadzkijhanca-robotecai
authored
Apply suggestions from code review
Co-authored-by: Paweł Liberadzki <[email protected]> Co-authored-by: Jan Hanca <[email protected]> Signed-off-by: Michał Pełka <[email protected]>
1 parent 0371f98 commit ab9dfb7

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

rfcs/RFC Simulation Interfaces.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ As a rule of thumb, receiving encouraging feedback from long-standing project de
1414
### Summary:
1515
<!-- Single paragraph explanation of the feature -->
1616

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.
1818

1919

2020
### 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
4444
|Tag | A string that allows filtering entities and named poses
4545

4646

47-
The implementation will be split into three (or more system components):
47+
The implementation will be split into three (or more) system components:
4848
- ROS 2 Entities manager \
4949
It will be responsible for the lifetime of spawned objects, it will cache initial positions.
5050
- ROS 2 Named poses manager \
5151
It will be responsible for aggregating information in the Named Pose Game Component.
5252
- ROS 2 Simulator manager \
5353
It will be responsible for modifying the global state of the simulation (e.g., pausing, reloading).
5454

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.
5759
The purpose of that approach is to enable testability without the need for a ROS domain.
5860

5961
# 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.
6163

6264
## GetSimulationFeatures service
6365

@@ -88,7 +90,7 @@ We do not plan to support the moment:
8890

8991
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)):
9092
```
91-
[`.spawnables`]
93+
[`.spawnable`]
9294
```
9395

9496
**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
136138

137139
This service advertises available spawnables that can be used in simulation.
138140
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:
140142
```cpp
141143
AZ::Data::AssetCatalogRequests::EnumerateAssets
142144
```
143-
The asset catalog contains product assets (such as `.spawnables`, `.azmodel`, `.azbuffer`).
145+
The asset catalog contains product assets (such as `.spawnable`, `.azmodel`, `.azbuffer`).
144146
We will introduce another product asset called `.simulationinfo`.
145147
This asset will contain necessary data about Prefab that can be spawned or adjusted by Simulation Interfaces.
146148

@@ -175,7 +177,7 @@ A simulation expert who wants to create a robot (or other simulation-ready asset
175177
* and hand-fill bounds (e.g., sphere radius),
176178
- export simulation with the export script and [bundle assets](https://docs.o3de.org/docs/user-guide/packaging/asset-bundler/)
177179

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:
179181
- a call to the asset catalog to find all product assets of the type `.simulationinfo`.
180182
- The `ROS 2 Entity manager` will aggregate found assets and will prepare a response that will contain:
181183
* `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
246248
Spawning assets from the file system e.g., `spawnable://home/michalpelka/robots/FooRobot.spawnables` will not be supported.
247249

248250
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.
250252

251253
During spawning the spawned O3DE entities will be modified:
252254
- change the name of the root entity to that given by the `name` field,
253255
- [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,
254256
- [ROS2 Frame](https://www.docs.o3de.org/docs/user-guide/components/reference/ros2/core/ros2-frame/) to set correct namespace.
255257
- 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.
257259
- [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'.
259261

260262

261263
`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.
264266

265267
## GetEntities service
266268

267-
The service allows to discover of spawned entities.
269+
This service provides an access to a list of all spawned entities.
268270
Service definition : [GetEntities](https://github.com/adamdbrw/simulation_interfaces/blob/simulation_interfaces/srv/GetEntities.srv )
269271

270272
```
@@ -290,7 +292,7 @@ string name # Entity unique name.
290292
```
291293

292294
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.
294296

295297
## GetEntitiesStates service
296298

@@ -329,9 +331,9 @@ There will be more calls to :
329331
- [TransformComponentRequests](https://github.com/o3de/o3de/blob/42d375dd99b972400f9f26bfec7e3444088f3398/Code/Framework/AzCore/AzCore/Component/TransformBus.h) to find current pose,
330332
- [ROS2FrameBus.h](https://github.com/o3de/o3de-extras/blob/development/Gems/ROS2/Code/Include/ROS2/Frame/ROS2FrameBus.h) to find frame id.
331333

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.
333335

334-
#### SetEntityState service
336+
## SetEntityState service
335337

336338
This service allows modifying the state of the chosen entity.
337339

@@ -666,7 +668,7 @@ If transition is in progress (e.g. reloading level or despawning), the old state
666668
667669
668670
669-
## Retired components in ROS 2 Gem
671+
## Deprecated components in ROS 2 Gem
670672
671673
During this effort some components will be retired, and some moved outside of scope of supported and canonical repos.
672674
@@ -676,7 +678,7 @@ The ROS2Spawner component will be retired and hidden away from users with the CM
676678
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).
677679
The said package (`gazebo_msgs`) will be replaced by `simulation_interfaces`.
678680
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):
680682
- cloning and building the latest [gazebo_ros_pkgs/gazebo_msgs](https://github.com/ros-simulation/gazebo_ros_pkgs/tree/3.9.0/gazebo_msgs)
681683
- sourcing custom workspace
682684
- setting CMake flag
@@ -719,7 +721,7 @@ It was explained in great detail in the section [ROS 2 API](#ros-2-api).
719721
### Are there any alternatives to this feature?
720722
<!-- - Provide any other designs that have been considered. Explain what the impact might be to not doing this.
721723
- 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`.
723725
724726
725727
### How will users learn this feature?

0 commit comments

Comments
 (0)