Skip to content

Commit

Permalink
Update triggered publisher tutorial (#2150)
Browse files Browse the repository at this point in the history
---------

Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 authored Sep 15, 2023
1 parent 294fddc commit c8d16bf
Showing 1 changed file with 8 additions and 22 deletions.
30 changes: 8 additions & 22 deletions tutorials/triggered_publisher.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,11 @@ and publish the start message
gz topic -t "/start" -m gz.msgs.Empty -p " "
```

The vehicle will start moving forward and two boxes will eventually fall to
the ground.

Once both boxes have fallen, we can publish a message to invoke a service call
to reset the robot position as well as set the speed to 0. As shown below, the
to reset the vehicle position as well as set the speed to 0. As shown below, the
`<output>` sets the linear x speed to 0, and the `<service>` tag contains
metadata to invoke a service call to `/world/triggered_publisher/set_pose`. The
`reqMsg` is expressed in the human-readable form of Google Protobuf meesages.
Expand All @@ -291,26 +294,9 @@ Multiple `<service>` tags can be used as well as with the `<output>` tag.
</plugin>
```

Once both boxes have fallen, we can publish a message to invoke a service call
to reset the robot position as well as set the speed to 0. As shown below, the
`<output>` sets the linear x speed to 0, and the `<service>` tag contains
metadata to invoke a service call to `/world/triggered_publisher/set_pose`. The
`reqMsg` is expressed in the human-readable form of Google Protobuf meesages.
Multiple `<service>` tags can be used as well as with the `<output>` tag.
Publish an empty message to the `/reset_robot` topic to reset the vehicle
back to its original position.

```xml
<plugin filename="gz-sim-triggered-publisher-system"
name="gz::sim::systems::TriggeredPublisher">
<input type="gz.msgs.Empty" topic="/reset_robot"/>
<output type="gz.msgs.Twist" topic="/cmd_vel">
linear: {x: 0}
</output>
<service
name="/world/triggered_publisher/set_pose"
reqType="gz.msgs.Pose"
repType="gz.msgs.Boolean"
timeout="3000"
reqMsg="name: 'blue_vehicle', id: 8, position: {x: -3, z: 1}">
</service>
</plugin>
```bash
gz topic -t "/reset_robot" -m gz.msgs.Empty -p " "
```

0 comments on commit c8d16bf

Please sign in to comment.