Skip to content

Commit 55dfcd5

Browse files
authored
Add documentation on the SetEntityState service (#653)
Signed-off-by: Addisu Z. Taddese <[email protected]>
1 parent e3fca83 commit 55dfcd5

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

harmonic/ros2_sim_interfaces.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ will learn how to interact with a running Gazebo simulation for the following ta
1212
- [Simulation Control](#simulation-control)
1313
- [Entity Management](#entity-management)
1414
- [State Query](#state-query)
15+
- [State Update](#state-update)
1516
- [Simulator Information](#simulator-information)
1617

1718
## Simulation Control
@@ -155,6 +156,37 @@ Get the list of entities (optionally filtered).
155156
ros2 service call /gzserver/get_entities simulation_interfaces/src/GetEntities "{filters: {filter: ''}}"
156157
```
157158

159+
## State Update
160+
161+
The following interfaces are used to set entity states.
162+
163+
| Interface Name | Topic Name | Type | Description |
164+
|----------------|------------|------|-------------|
165+
| `SetEntityState` | `/gzserver/set_entity_state` | Service | Set the pose and twist of a specific entity |
166+
167+
### SetEntityState Service
168+
169+
Set the pose and twist of a specific entity.
170+
171+
```bash
172+
ros2 service call /gzserver/set_entity_state simulation_interfaces/srv/SetEntityState "{ entity: 'my_model', state: {pose: { position: { x: -2.0, z: 0.5 }}, twist: {linear: {x: 0.5}}}}"
173+
```
174+
175+
:::{caution}
176+
When using `SetEntityState`, it is currently not possible to set just the `pose` or the `twist` of an entity.
177+
Both components of the entity will be assigned based on the value of the provided message. For example, of `pose` is left empty, the pose of the entity will be set to the origin.
178+
179+
This might be resolved in the future. See https://github.com/ros-simulation/simulation_interfaces/issues/18
180+
:::
181+
182+
:::{warning}
183+
In Gazebo Harmonic, the twist of an entity is reset back to zero
184+
after each time step. This is like applying a brake on the entity (see https://github.com/gazebosim/gz-sim/issues/1926).
185+
Thus, we do not recommend using `SetEntityState` to control the twist. Later versions of
186+
Gazebo do not have this problem. If you need to control the twist, consider
187+
using the [VelocityControl](https://gazebosim.org/api/sim/8/classgz_1_1sim_1_1systems_1_1VelocityControl.html) system.
188+
:::
189+
158190
## Simulator Information
159191

160192
Some simulators may only support a subset of interfaces. The following services can be used to inspect

ionic/ros2_sim_interfaces.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ will learn how to interact with a running Gazebo simulation for the following ta
1212
- [Simulation Control](#simulation-control)
1313
- [Entity Management](#entity-management)
1414
- [State Query](#state-query)
15+
- [State Update](#state-update)
1516
- [Simulator Information](#simulator-information)
1617

1718
## Simulation Control
@@ -155,6 +156,29 @@ Get the list of entities (optionally filtered).
155156
ros2 service call /gzserver/get_entities simulation_interfaces/src/GetEntities "{filters: {filter: ''}}"
156157
```
157158

159+
## State Update
160+
161+
The following interfaces are used to set entity states.
162+
163+
| Interface Name | Topic Name | Type | Description |
164+
|----------------|------------|------|-------------|
165+
| `SetEntityState` | `/gzserver/set_entity_state` | Service | Set the pose and twist of a specific entity |
166+
167+
### SetEntityState Service
168+
169+
Set the pose and twist of a specific entity.
170+
171+
```bash
172+
ros2 service call /gzserver/set_entity_state simulation_interfaces/srv/SetEntityState "{ entity: 'my_model', state: {pose: { position: { x: -2.0, z: 0.5 }}, twist: {linear: {x: 0.5}}}}"
173+
```
174+
175+
:::{caution}
176+
When using `SetEntityState`, it is currently not possible to set just the `pose` or the `twist` of an entity.
177+
Both components of the entity will be assigned based on the value of the provided message. For example, of `pose` is left empty, the pose of the entity will be set to the origin.
178+
179+
This might be resolved in the future. See https://github.com/ros-simulation/simulation_interfaces/issues/18
180+
:::
181+
158182
## Simulator Information
159183

160184
Some simulators may only support a subset of interfaces. The following services can be used to inspect

jetty/ros2_sim_interfaces.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ will learn how to interact with a running Gazebo simulation for the following ta
1212
- [Simulation Control](#simulation-control)
1313
- [Entity Management](#entity-management)
1414
- [State Query](#state-query)
15+
- [State Update](#state-update)
1516
- [Simulator Information](#simulator-information)
1617

1718
## Simulation Control
@@ -155,6 +156,29 @@ Get the list of entities (optionally filtered).
155156
ros2 service call /gzserver/get_entities simulation_interfaces/src/GetEntities "{filters: {filter: ''}}"
156157
```
157158

159+
## State Update
160+
161+
The following interfaces are used to set entity states.
162+
163+
| Interface Name | Topic Name | Type | Description |
164+
|----------------|------------|------|-------------|
165+
| `SetEntityState` | `/gzserver/set_entity_state` | Service | Set the pose and twist of a specific entity |
166+
167+
### SetEntityState Service
168+
169+
Set the pose and twist of a specific entity.
170+
171+
```bash
172+
ros2 service call /gzserver/set_entity_state simulation_interfaces/srv/SetEntityState "{ entity: 'my_model', state: {pose: { position: { x: -2.0, z: 0.5 }}, twist: {linear: {x: 0.5}}}}"
173+
```
174+
175+
:::{caution}
176+
When using `SetEntityState`, it is currently not possible to set just the `pose` or the `twist` of an entity.
177+
Both components of the entity will be assigned based on the value of the provided message. For example, of `pose` is left empty, the pose of the entity will be set to the origin.
178+
179+
This might be resolved in the future. See https://github.com/ros-simulation/simulation_interfaces/issues/18
180+
:::
181+
158182
## Simulator Information
159183

160184
Some simulators may only support a subset of interfaces. The following services can be used to inspect

0 commit comments

Comments
 (0)