From 36647c0a5dbaed39ee5a7147205d8a3a57ae0ef5 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Tue, 2 Dec 2025 11:46:16 -0600 Subject: [PATCH 1/2] Copy ros2_sim_interfaces to ionic and harmonic Signed-off-by: Addisu Z. Taddese --- harmonic/index.yaml | 3 + harmonic/ros2_integration.md | 17 +++ harmonic/ros2_sim_interfaces.md | 178 ++++++++++++++++++++++++++++++++ ionic/index.yaml | 3 + ionic/ros2_integration.md | 17 +++ ionic/ros2_sim_interfaces.md | 178 ++++++++++++++++++++++++++++++++ 6 files changed, 396 insertions(+) create mode 100644 harmonic/ros2_sim_interfaces.md create mode 100644 ionic/ros2_sim_interfaces.md diff --git a/harmonic/index.yaml b/harmonic/index.yaml index 58c07534c3..0ebfd3acb9 100644 --- a/harmonic/index.yaml +++ b/harmonic/index.yaml @@ -94,6 +94,9 @@ pages: - name: ros2_integration title: Use ROS 2 to interact with Gazebo file: ros2_integration.md + - name: ros2_sim_interfaces + title: Use ROS 2 Simulation Interfaces to Interact with Gazebo + file: ros2_sim_interfaces.md - name: ros2_spawn_model title: Use ROS 2 to spawn a Gazebo model file: ros2_spawn_model.md diff --git a/harmonic/ros2_integration.md b/harmonic/ros2_integration.md index 3ddade25cb..c96e34d3d4 100644 --- a/harmonic/ros2_integration.md +++ b/harmonic/ros2_integration.md @@ -227,3 +227,20 @@ And verify the vehicle matching its trajectory in Gazebo and RViz. ![gz_rviz](tutorials/ros2_integration/gz_rviz.gif) For more details on implementation of this demo see [ROS 2 Interoperability](ros2_interop). + +## Using ROS 2 Simulation Interfaces + +The [ROS 2 Simulation Interfaces](https://github.com/ros-simulation/simulation_interfaces) +are a set of standard ROS 2 service, message and action +definitions for controlling and interacting with simulation environments. They are +simulator agnostic, which means the same interfacs can be implemented in different +simulators while keeping the API consistent. + +Gazebo implements these interfaces, enabling you to, +- Spawn and delete entities +- Control simulation state and time stepping +- Query entity and world state +- Retrieve simulator information + +For a full tutorial, including usage examples for each interface see +[Use ROS 2 Simulation Interfaces with Gazebo](ros2_sim_interfaces). diff --git a/harmonic/ros2_sim_interfaces.md b/harmonic/ros2_sim_interfaces.md new file mode 100644 index 0000000000..b0de535340 --- /dev/null +++ b/harmonic/ros2_sim_interfaces.md @@ -0,0 +1,178 @@ +# Use ROS 2 Simulation Interfaces to Interact with Gazebo + +The [ROS 2 Simulation Interfaces](https://github.com/ros-simulation/simulation_interfaces) +define a standard set of ROS 2 service, message and action definitions for controlling and +interacting with simulation environments. These interfaces are simulator-agnostic and aim to +provide a unified way to control and observe simulation using ROS 2. + +Gazebo has implemented these interfaces, enabling tasks like spawning entities, stepping +simulation, querying world state, etc. through standard ROS 2 calls. In this tutorial we +will learn how to interact with a running Gazebo simulation for the following tasks, +- [Simulation Control](#simulation-control) +- [Entity Management](#entity-management) +- [State Query](#state-query) +- [Simulator Information](#simulator-information) + +## Simulation Control + +The following services and actions are available to control the flow of simulation time. + +| Interface Name | Topic Name | Type | Description | +|----------------|------------|------|-------------| +| `ResetSimulation` | `/gzserver/reset_simulation` | Service | Reset the simulation to its initial state | +| `StepSimulation` | `/gzserver/step_simulation` | Service | Step the simulation forward by a specified number of steps | +| `GetSimulationState` | `/gzserver/get_simulation_state` | Service | Get the current simulation state (playing/paused/stopped) | +| `SetSimulationState` | `/gzserver/set_simulation_state` | Service | Set the simulation state (play/pause/stop) | +| `SimulateSteps` | `/gzserver/simulate_steps` | Action | Step the simulation forward by a specified number of steps with feedback and cancellation support | + +**ResetSimulation Service** + +Reset the simulation to its initial state. + +```bash +ros2 service call /gzserver/reset_simulation simulation_interfaces/srv/ResetSimulation "{}" +``` + +**StepSimulation Service** + +Step the simulation forward by a specified number of steps. + +```bash +ros2 service call /gzserver/step_simulation simulation_interfaces/srv/StepSimulation "{steps: 10}" +``` + +**GetSimulationState Service** + +Get the current simulation state (playing/paused/stopped). + +```bash +ros2 service call /gzserver/get_simulation_state simulation_interfaces/srv/GetSimulationState "{}" +``` + +**SetSimulationState Service** + +Set the simulation state (play/pause/stop). + +- Set simulation state to stop. + + ```bash + ros2 service call /gzserver/set_simulation_state simulation_interfaces/srv/SetSimulationState "{state: {state: 0}}" + ``` + +- Set simulation state to playing. + + ```bash + ros2 service call /gzserver/set_simulation_state simulation_interfaces/srv/SetSimulationState "{state: {state: 1}}" + ``` + +- Set simulation state to paused. + + ```bash + ros2 service call /gzserver/set_simulation_state simulation_interfaces/srv/SetSimulationState "{state: {state: 2}}" + ``` + +- Set simulation state to quitting. + + ```bash + ros2 service call /gzserver/set_simulation_state simulation_interfaces/srv/SetSimulationState "{state: {state: 3}}" + ``` + +**SimulateSteps Action** + +Step the simulation forward by a specified number of steps with feedback and cancellation support. + +```bash +ros2 action send_goal /gzserver/simulate_steps simulation_interfaces/action/SimulateSteps "{steps: 10}" --feedback +``` + +## Entity Management + +The following interfaces are used to create or remove entities in the simulation at runtime. + +| Interface Name | Topic Name | Type | Description | +|----------------|------------|------|-------------| +| `SpawnEntity` | `/gzserver/spawn_entity` | Service | Spawn a new entity in the simulation at a specific location | +| `DeleteEntity` | `/gzserver/delete_entity` | Service | Delete an existing entity by name | + +**SpawnEntity Service** + +Spawn a new entity in the simulation at a specific location. + +```bash +ros2 service call /gzserver/spawn_entity simulation_interfaces/srv/SpawnEntity "{ + name: 'my_model', + uri: '/path/to/model.sdf', + allow_renaming: false, + initial_pose: { + pose: { + position: {x: 0.0, y: 0.0, z: 0.0}, + orientation: {w: 1.0, x: 0.0, y: 0.0, z: 0.0} + } + } +}" +``` + +**DeleteEntity Service** + +Delete an existing entity by name. + +```bash +ros2 service call /gzserver/delete_entity simulation_interfaces/srv/DeleteEntity "{entity: 'my_model'}" +``` + +## State Query + +The following interfaces are used to introspect simulation world and entity state. + +| Interface Name | Topic Name | Type | Description | +|----------------|------------|------|-------------| +| `GetEntityState` | `/gzserver/get_entity_state` | Service | Get the pose and twist of a specific entity | +| `GetEntitiesStates` | `/gzserver/get_entities_states` | Service | Get the state for multiple entities (optionally filtered) | +| `GetEntities` | `/gzserver/get_entities` | Service | Get a list of entities (optionally filtered) | + +**GetEntityState Service** + +Get the pose and twist of a specific entity. + +```bash +ros2 service call /gzserver/get_entity_state simulation_interfaces/srv/GetEntityState "{entity: 'my_model'}" +``` + +**GetEntitiesStates Service** + +Get the state of multiple entities (optionally filtered). + +```bash +ros2 service call /gzserver/get_entities_states simulation_interfaces/srv/GetEntitiesStates "{filters: {filter: ''}}" +``` + +**GetEntites Service** + +Get the list of entities (optionally filtered). + +```bash +ros2 service call /gzserver/get_entities simulation_interfaces/src/GetEntities "{filters: {filter: ''}}" +``` + +## Simulator Information + +Some simulators may only support a subset of interfaces. The following services can be used to inspect +supported features. + +| Interface Name | Topic Name | Type | Description | +|----------------|------------|------|-------------| +| `GetSimulatorFeatures` | `/gzserver/get_simulator_features` | Service | Query which interface features are supported | + +**GetSimulatorFeatures Service** + +Query which interface features are supported. + +```bash +ros2 service call /gzserver/get_simulator_features simulation_interfaces/srv/GetSimulationFeatures "{}" +``` + +## Known Limitations + +- Only an empty string or "world" can be used in the `frame_id` field of `PoseStamped` messages. We plan to add support for using frames known to `Tf` in the future. +- Entity namespaces are not supported by the `SpawnEntity` service. +- When spawning an entity, if `SpawnEntity.allow_renaming` is set to `true` and a rename occurs in Gazebo, the new name is not returned in the `Result` object return by the `SpawnEntity` service. diff --git a/ionic/index.yaml b/ionic/index.yaml index dd32f4e8c0..ef05c75cc7 100644 --- a/ionic/index.yaml +++ b/ionic/index.yaml @@ -94,6 +94,9 @@ pages: - name: ros2_integration title: Use ROS 2 to interact with Gazebo file: ros2_integration.md + - name: ros2_sim_interfaces + title: Use ROS 2 Simulation Interfaces to Interact with Gazebo + file: ros2_sim_interfaces.md - name: ros2_spawn_model title: Use ROS 2 to spawn a Gazebo model file: ros2_spawn_model.md diff --git a/ionic/ros2_integration.md b/ionic/ros2_integration.md index f45c076815..a29517607c 100644 --- a/ionic/ros2_integration.md +++ b/ionic/ros2_integration.md @@ -227,3 +227,20 @@ And verify the vehicle matching its trajectory in Gazebo and RViz. ![gz_rviz](tutorials/ros2_integration/gz_rviz.gif) For more details on implementation of this demo see [ROS 2 Interoperability](ros2_interop). + +## Using ROS 2 Simulation Interfaces + +The [ROS 2 Simulation Interfaces](https://github.com/ros-simulation/simulation_interfaces) +are a set of standard ROS 2 service, message and action +definitions for controlling and interacting with simulation environments. They are +simulator agnostic, which means the same interfacs can be implemented in different +simulators while keeping the API consistent. + +Gazebo implements these interfaces, enabling you to, +- Spawn and delete entities +- Control simulation state and time stepping +- Query entity and world state +- Retrieve simulator information + +For a full tutorial, including usage examples for each interface see +[Use ROS 2 Simulation Interfaces with Gazebo](ros2_sim_interfaces). diff --git a/ionic/ros2_sim_interfaces.md b/ionic/ros2_sim_interfaces.md new file mode 100644 index 0000000000..b0de535340 --- /dev/null +++ b/ionic/ros2_sim_interfaces.md @@ -0,0 +1,178 @@ +# Use ROS 2 Simulation Interfaces to Interact with Gazebo + +The [ROS 2 Simulation Interfaces](https://github.com/ros-simulation/simulation_interfaces) +define a standard set of ROS 2 service, message and action definitions for controlling and +interacting with simulation environments. These interfaces are simulator-agnostic and aim to +provide a unified way to control and observe simulation using ROS 2. + +Gazebo has implemented these interfaces, enabling tasks like spawning entities, stepping +simulation, querying world state, etc. through standard ROS 2 calls. In this tutorial we +will learn how to interact with a running Gazebo simulation for the following tasks, +- [Simulation Control](#simulation-control) +- [Entity Management](#entity-management) +- [State Query](#state-query) +- [Simulator Information](#simulator-information) + +## Simulation Control + +The following services and actions are available to control the flow of simulation time. + +| Interface Name | Topic Name | Type | Description | +|----------------|------------|------|-------------| +| `ResetSimulation` | `/gzserver/reset_simulation` | Service | Reset the simulation to its initial state | +| `StepSimulation` | `/gzserver/step_simulation` | Service | Step the simulation forward by a specified number of steps | +| `GetSimulationState` | `/gzserver/get_simulation_state` | Service | Get the current simulation state (playing/paused/stopped) | +| `SetSimulationState` | `/gzserver/set_simulation_state` | Service | Set the simulation state (play/pause/stop) | +| `SimulateSteps` | `/gzserver/simulate_steps` | Action | Step the simulation forward by a specified number of steps with feedback and cancellation support | + +**ResetSimulation Service** + +Reset the simulation to its initial state. + +```bash +ros2 service call /gzserver/reset_simulation simulation_interfaces/srv/ResetSimulation "{}" +``` + +**StepSimulation Service** + +Step the simulation forward by a specified number of steps. + +```bash +ros2 service call /gzserver/step_simulation simulation_interfaces/srv/StepSimulation "{steps: 10}" +``` + +**GetSimulationState Service** + +Get the current simulation state (playing/paused/stopped). + +```bash +ros2 service call /gzserver/get_simulation_state simulation_interfaces/srv/GetSimulationState "{}" +``` + +**SetSimulationState Service** + +Set the simulation state (play/pause/stop). + +- Set simulation state to stop. + + ```bash + ros2 service call /gzserver/set_simulation_state simulation_interfaces/srv/SetSimulationState "{state: {state: 0}}" + ``` + +- Set simulation state to playing. + + ```bash + ros2 service call /gzserver/set_simulation_state simulation_interfaces/srv/SetSimulationState "{state: {state: 1}}" + ``` + +- Set simulation state to paused. + + ```bash + ros2 service call /gzserver/set_simulation_state simulation_interfaces/srv/SetSimulationState "{state: {state: 2}}" + ``` + +- Set simulation state to quitting. + + ```bash + ros2 service call /gzserver/set_simulation_state simulation_interfaces/srv/SetSimulationState "{state: {state: 3}}" + ``` + +**SimulateSteps Action** + +Step the simulation forward by a specified number of steps with feedback and cancellation support. + +```bash +ros2 action send_goal /gzserver/simulate_steps simulation_interfaces/action/SimulateSteps "{steps: 10}" --feedback +``` + +## Entity Management + +The following interfaces are used to create or remove entities in the simulation at runtime. + +| Interface Name | Topic Name | Type | Description | +|----------------|------------|------|-------------| +| `SpawnEntity` | `/gzserver/spawn_entity` | Service | Spawn a new entity in the simulation at a specific location | +| `DeleteEntity` | `/gzserver/delete_entity` | Service | Delete an existing entity by name | + +**SpawnEntity Service** + +Spawn a new entity in the simulation at a specific location. + +```bash +ros2 service call /gzserver/spawn_entity simulation_interfaces/srv/SpawnEntity "{ + name: 'my_model', + uri: '/path/to/model.sdf', + allow_renaming: false, + initial_pose: { + pose: { + position: {x: 0.0, y: 0.0, z: 0.0}, + orientation: {w: 1.0, x: 0.0, y: 0.0, z: 0.0} + } + } +}" +``` + +**DeleteEntity Service** + +Delete an existing entity by name. + +```bash +ros2 service call /gzserver/delete_entity simulation_interfaces/srv/DeleteEntity "{entity: 'my_model'}" +``` + +## State Query + +The following interfaces are used to introspect simulation world and entity state. + +| Interface Name | Topic Name | Type | Description | +|----------------|------------|------|-------------| +| `GetEntityState` | `/gzserver/get_entity_state` | Service | Get the pose and twist of a specific entity | +| `GetEntitiesStates` | `/gzserver/get_entities_states` | Service | Get the state for multiple entities (optionally filtered) | +| `GetEntities` | `/gzserver/get_entities` | Service | Get a list of entities (optionally filtered) | + +**GetEntityState Service** + +Get the pose and twist of a specific entity. + +```bash +ros2 service call /gzserver/get_entity_state simulation_interfaces/srv/GetEntityState "{entity: 'my_model'}" +``` + +**GetEntitiesStates Service** + +Get the state of multiple entities (optionally filtered). + +```bash +ros2 service call /gzserver/get_entities_states simulation_interfaces/srv/GetEntitiesStates "{filters: {filter: ''}}" +``` + +**GetEntites Service** + +Get the list of entities (optionally filtered). + +```bash +ros2 service call /gzserver/get_entities simulation_interfaces/src/GetEntities "{filters: {filter: ''}}" +``` + +## Simulator Information + +Some simulators may only support a subset of interfaces. The following services can be used to inspect +supported features. + +| Interface Name | Topic Name | Type | Description | +|----------------|------------|------|-------------| +| `GetSimulatorFeatures` | `/gzserver/get_simulator_features` | Service | Query which interface features are supported | + +**GetSimulatorFeatures Service** + +Query which interface features are supported. + +```bash +ros2 service call /gzserver/get_simulator_features simulation_interfaces/srv/GetSimulationFeatures "{}" +``` + +## Known Limitations + +- Only an empty string or "world" can be used in the `frame_id` field of `PoseStamped` messages. We plan to add support for using frames known to `Tf` in the future. +- Entity namespaces are not supported by the `SpawnEntity` service. +- When spawning an entity, if `SpawnEntity.allow_renaming` is set to `true` and a rename occurs in Gazebo, the new name is not returned in the `Result` object return by the `SpawnEntity` service. From 9eed4a409c9ed1ec41993b3c86e54e4511df6fd2 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Tue, 2 Dec 2025 13:59:47 -0600 Subject: [PATCH 2/2] Use headings instead of emphasis This allows each service to be listed on the secondary navigation bar on the right side. Signed-off-by: Addisu Z. Taddese --- harmonic/ros2_sim_interfaces.md | 25 +++++++++++++------------ ionic/ros2_sim_interfaces.md | 25 +++++++++++++------------ jetty/ros2_sim_interfaces.md | 25 +++++++++++++------------ 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/harmonic/ros2_sim_interfaces.md b/harmonic/ros2_sim_interfaces.md index b0de535340..8296356fcd 100644 --- a/harmonic/ros2_sim_interfaces.md +++ b/harmonic/ros2_sim_interfaces.md @@ -8,6 +8,7 @@ provide a unified way to control and observe simulation using ROS 2. Gazebo has implemented these interfaces, enabling tasks like spawning entities, stepping simulation, querying world state, etc. through standard ROS 2 calls. In this tutorial we will learn how to interact with a running Gazebo simulation for the following tasks, + - [Simulation Control](#simulation-control) - [Entity Management](#entity-management) - [State Query](#state-query) @@ -23,9 +24,9 @@ The following services and actions are available to control the flow of simulati | `StepSimulation` | `/gzserver/step_simulation` | Service | Step the simulation forward by a specified number of steps | | `GetSimulationState` | `/gzserver/get_simulation_state` | Service | Get the current simulation state (playing/paused/stopped) | | `SetSimulationState` | `/gzserver/set_simulation_state` | Service | Set the simulation state (play/pause/stop) | -| `SimulateSteps` | `/gzserver/simulate_steps` | Action | Step the simulation forward by a specified number of steps with feedback and cancellation support | +| `SimulateSteps` | `/gzserver/simulate_steps` | Action | Step the simulation forward by a specified number of steps with feedback and cancellation support | -**ResetSimulation Service** +### ResetSimulation Service Reset the simulation to its initial state. @@ -33,7 +34,7 @@ Reset the simulation to its initial state. ros2 service call /gzserver/reset_simulation simulation_interfaces/srv/ResetSimulation "{}" ``` -**StepSimulation Service** +### StepSimulation Service Step the simulation forward by a specified number of steps. @@ -41,7 +42,7 @@ Step the simulation forward by a specified number of steps. ros2 service call /gzserver/step_simulation simulation_interfaces/srv/StepSimulation "{steps: 10}" ``` -**GetSimulationState Service** +### GetSimulationState Service Get the current simulation state (playing/paused/stopped). @@ -49,7 +50,7 @@ Get the current simulation state (playing/paused/stopped). ros2 service call /gzserver/get_simulation_state simulation_interfaces/srv/GetSimulationState "{}" ``` -**SetSimulationState Service** +### SetSimulationState Service Set the simulation state (play/pause/stop). @@ -77,7 +78,7 @@ Set the simulation state (play/pause/stop). ros2 service call /gzserver/set_simulation_state simulation_interfaces/srv/SetSimulationState "{state: {state: 3}}" ``` -**SimulateSteps Action** +### SimulateSteps Action Step the simulation forward by a specified number of steps with feedback and cancellation support. @@ -94,7 +95,7 @@ The following interfaces are used to create or remove entities in the simulation | `SpawnEntity` | `/gzserver/spawn_entity` | Service | Spawn a new entity in the simulation at a specific location | | `DeleteEntity` | `/gzserver/delete_entity` | Service | Delete an existing entity by name | -**SpawnEntity Service** +### SpawnEntity Service Spawn a new entity in the simulation at a specific location. @@ -112,7 +113,7 @@ ros2 service call /gzserver/spawn_entity simulation_interfaces/srv/SpawnEntity " }" ``` -**DeleteEntity Service** +### DeleteEntity Service Delete an existing entity by name. @@ -130,7 +131,7 @@ The following interfaces are used to introspect simulation world and entity stat | `GetEntitiesStates` | `/gzserver/get_entities_states` | Service | Get the state for multiple entities (optionally filtered) | | `GetEntities` | `/gzserver/get_entities` | Service | Get a list of entities (optionally filtered) | -**GetEntityState Service** +### GetEntityState Service Get the pose and twist of a specific entity. @@ -138,7 +139,7 @@ Get the pose and twist of a specific entity. ros2 service call /gzserver/get_entity_state simulation_interfaces/srv/GetEntityState "{entity: 'my_model'}" ``` -**GetEntitiesStates Service** +### GetEntitiesStates Service Get the state of multiple entities (optionally filtered). @@ -146,7 +147,7 @@ Get the state of multiple entities (optionally filtered). ros2 service call /gzserver/get_entities_states simulation_interfaces/srv/GetEntitiesStates "{filters: {filter: ''}}" ``` -**GetEntites Service** +### GetEntites Service Get the list of entities (optionally filtered). @@ -163,7 +164,7 @@ supported features. |----------------|------------|------|-------------| | `GetSimulatorFeatures` | `/gzserver/get_simulator_features` | Service | Query which interface features are supported | -**GetSimulatorFeatures Service** +### GetSimulatorFeatures Service Query which interface features are supported. diff --git a/ionic/ros2_sim_interfaces.md b/ionic/ros2_sim_interfaces.md index b0de535340..8296356fcd 100644 --- a/ionic/ros2_sim_interfaces.md +++ b/ionic/ros2_sim_interfaces.md @@ -8,6 +8,7 @@ provide a unified way to control and observe simulation using ROS 2. Gazebo has implemented these interfaces, enabling tasks like spawning entities, stepping simulation, querying world state, etc. through standard ROS 2 calls. In this tutorial we will learn how to interact with a running Gazebo simulation for the following tasks, + - [Simulation Control](#simulation-control) - [Entity Management](#entity-management) - [State Query](#state-query) @@ -23,9 +24,9 @@ The following services and actions are available to control the flow of simulati | `StepSimulation` | `/gzserver/step_simulation` | Service | Step the simulation forward by a specified number of steps | | `GetSimulationState` | `/gzserver/get_simulation_state` | Service | Get the current simulation state (playing/paused/stopped) | | `SetSimulationState` | `/gzserver/set_simulation_state` | Service | Set the simulation state (play/pause/stop) | -| `SimulateSteps` | `/gzserver/simulate_steps` | Action | Step the simulation forward by a specified number of steps with feedback and cancellation support | +| `SimulateSteps` | `/gzserver/simulate_steps` | Action | Step the simulation forward by a specified number of steps with feedback and cancellation support | -**ResetSimulation Service** +### ResetSimulation Service Reset the simulation to its initial state. @@ -33,7 +34,7 @@ Reset the simulation to its initial state. ros2 service call /gzserver/reset_simulation simulation_interfaces/srv/ResetSimulation "{}" ``` -**StepSimulation Service** +### StepSimulation Service Step the simulation forward by a specified number of steps. @@ -41,7 +42,7 @@ Step the simulation forward by a specified number of steps. ros2 service call /gzserver/step_simulation simulation_interfaces/srv/StepSimulation "{steps: 10}" ``` -**GetSimulationState Service** +### GetSimulationState Service Get the current simulation state (playing/paused/stopped). @@ -49,7 +50,7 @@ Get the current simulation state (playing/paused/stopped). ros2 service call /gzserver/get_simulation_state simulation_interfaces/srv/GetSimulationState "{}" ``` -**SetSimulationState Service** +### SetSimulationState Service Set the simulation state (play/pause/stop). @@ -77,7 +78,7 @@ Set the simulation state (play/pause/stop). ros2 service call /gzserver/set_simulation_state simulation_interfaces/srv/SetSimulationState "{state: {state: 3}}" ``` -**SimulateSteps Action** +### SimulateSteps Action Step the simulation forward by a specified number of steps with feedback and cancellation support. @@ -94,7 +95,7 @@ The following interfaces are used to create or remove entities in the simulation | `SpawnEntity` | `/gzserver/spawn_entity` | Service | Spawn a new entity in the simulation at a specific location | | `DeleteEntity` | `/gzserver/delete_entity` | Service | Delete an existing entity by name | -**SpawnEntity Service** +### SpawnEntity Service Spawn a new entity in the simulation at a specific location. @@ -112,7 +113,7 @@ ros2 service call /gzserver/spawn_entity simulation_interfaces/srv/SpawnEntity " }" ``` -**DeleteEntity Service** +### DeleteEntity Service Delete an existing entity by name. @@ -130,7 +131,7 @@ The following interfaces are used to introspect simulation world and entity stat | `GetEntitiesStates` | `/gzserver/get_entities_states` | Service | Get the state for multiple entities (optionally filtered) | | `GetEntities` | `/gzserver/get_entities` | Service | Get a list of entities (optionally filtered) | -**GetEntityState Service** +### GetEntityState Service Get the pose and twist of a specific entity. @@ -138,7 +139,7 @@ Get the pose and twist of a specific entity. ros2 service call /gzserver/get_entity_state simulation_interfaces/srv/GetEntityState "{entity: 'my_model'}" ``` -**GetEntitiesStates Service** +### GetEntitiesStates Service Get the state of multiple entities (optionally filtered). @@ -146,7 +147,7 @@ Get the state of multiple entities (optionally filtered). ros2 service call /gzserver/get_entities_states simulation_interfaces/srv/GetEntitiesStates "{filters: {filter: ''}}" ``` -**GetEntites Service** +### GetEntites Service Get the list of entities (optionally filtered). @@ -163,7 +164,7 @@ supported features. |----------------|------------|------|-------------| | `GetSimulatorFeatures` | `/gzserver/get_simulator_features` | Service | Query which interface features are supported | -**GetSimulatorFeatures Service** +### GetSimulatorFeatures Service Query which interface features are supported. diff --git a/jetty/ros2_sim_interfaces.md b/jetty/ros2_sim_interfaces.md index b0de535340..8296356fcd 100644 --- a/jetty/ros2_sim_interfaces.md +++ b/jetty/ros2_sim_interfaces.md @@ -8,6 +8,7 @@ provide a unified way to control and observe simulation using ROS 2. Gazebo has implemented these interfaces, enabling tasks like spawning entities, stepping simulation, querying world state, etc. through standard ROS 2 calls. In this tutorial we will learn how to interact with a running Gazebo simulation for the following tasks, + - [Simulation Control](#simulation-control) - [Entity Management](#entity-management) - [State Query](#state-query) @@ -23,9 +24,9 @@ The following services and actions are available to control the flow of simulati | `StepSimulation` | `/gzserver/step_simulation` | Service | Step the simulation forward by a specified number of steps | | `GetSimulationState` | `/gzserver/get_simulation_state` | Service | Get the current simulation state (playing/paused/stopped) | | `SetSimulationState` | `/gzserver/set_simulation_state` | Service | Set the simulation state (play/pause/stop) | -| `SimulateSteps` | `/gzserver/simulate_steps` | Action | Step the simulation forward by a specified number of steps with feedback and cancellation support | +| `SimulateSteps` | `/gzserver/simulate_steps` | Action | Step the simulation forward by a specified number of steps with feedback and cancellation support | -**ResetSimulation Service** +### ResetSimulation Service Reset the simulation to its initial state. @@ -33,7 +34,7 @@ Reset the simulation to its initial state. ros2 service call /gzserver/reset_simulation simulation_interfaces/srv/ResetSimulation "{}" ``` -**StepSimulation Service** +### StepSimulation Service Step the simulation forward by a specified number of steps. @@ -41,7 +42,7 @@ Step the simulation forward by a specified number of steps. ros2 service call /gzserver/step_simulation simulation_interfaces/srv/StepSimulation "{steps: 10}" ``` -**GetSimulationState Service** +### GetSimulationState Service Get the current simulation state (playing/paused/stopped). @@ -49,7 +50,7 @@ Get the current simulation state (playing/paused/stopped). ros2 service call /gzserver/get_simulation_state simulation_interfaces/srv/GetSimulationState "{}" ``` -**SetSimulationState Service** +### SetSimulationState Service Set the simulation state (play/pause/stop). @@ -77,7 +78,7 @@ Set the simulation state (play/pause/stop). ros2 service call /gzserver/set_simulation_state simulation_interfaces/srv/SetSimulationState "{state: {state: 3}}" ``` -**SimulateSteps Action** +### SimulateSteps Action Step the simulation forward by a specified number of steps with feedback and cancellation support. @@ -94,7 +95,7 @@ The following interfaces are used to create or remove entities in the simulation | `SpawnEntity` | `/gzserver/spawn_entity` | Service | Spawn a new entity in the simulation at a specific location | | `DeleteEntity` | `/gzserver/delete_entity` | Service | Delete an existing entity by name | -**SpawnEntity Service** +### SpawnEntity Service Spawn a new entity in the simulation at a specific location. @@ -112,7 +113,7 @@ ros2 service call /gzserver/spawn_entity simulation_interfaces/srv/SpawnEntity " }" ``` -**DeleteEntity Service** +### DeleteEntity Service Delete an existing entity by name. @@ -130,7 +131,7 @@ The following interfaces are used to introspect simulation world and entity stat | `GetEntitiesStates` | `/gzserver/get_entities_states` | Service | Get the state for multiple entities (optionally filtered) | | `GetEntities` | `/gzserver/get_entities` | Service | Get a list of entities (optionally filtered) | -**GetEntityState Service** +### GetEntityState Service Get the pose and twist of a specific entity. @@ -138,7 +139,7 @@ Get the pose and twist of a specific entity. ros2 service call /gzserver/get_entity_state simulation_interfaces/srv/GetEntityState "{entity: 'my_model'}" ``` -**GetEntitiesStates Service** +### GetEntitiesStates Service Get the state of multiple entities (optionally filtered). @@ -146,7 +147,7 @@ Get the state of multiple entities (optionally filtered). ros2 service call /gzserver/get_entities_states simulation_interfaces/srv/GetEntitiesStates "{filters: {filter: ''}}" ``` -**GetEntites Service** +### GetEntites Service Get the list of entities (optionally filtered). @@ -163,7 +164,7 @@ supported features. |----------------|------------|------|-------------| | `GetSimulatorFeatures` | `/gzserver/get_simulator_features` | Service | Query which interface features are supported | -**GetSimulatorFeatures Service** +### GetSimulatorFeatures Service Query which interface features are supported.