Skip to content

Commit

Permalink
Convert plantuml diagrams to mermaid
Browse files Browse the repository at this point in the history
Signed-off-by: Santiago Tapia-Fernández <[email protected]>
  • Loading branch information
santiago-tapia committed Feb 2, 2025
1 parent c5232ad commit 702533d
Showing 1 changed file with 35 additions and 7 deletions.
42 changes: 35 additions & 7 deletions source/Tutorials/Intermediate/Async-Service/Async-Service-Main.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.. Tutorials/Intermediate/Async-Service

Writing a service with an asynchronous client node
==================================================
Expand Down Expand Up @@ -32,9 +31,18 @@ In this tutorial, the client will execute a callback when the response is receiv

Consider the following diagram:

.. image:: images/sync-client-diagram.png
:target: images/sync-client-diagram.png
:alt: A sequence diagram that show how a sync-client waits for the response
.. mermaid::

sequenceDiagram
participant Client
participant Server

Client ->> Server : Send Sync Request
activate Server
Note left of Client: Waiting for Response
Server -->> Client : Return Response
deactivate Server


It shows a **synchronous** client.
The client makes a request and waits for the response, meaning its thread is blocked (i.e. not running) until the response is returned.
Expand All @@ -43,9 +51,29 @@ In contrast, the following diagram illustrates an asynchronous ROS 2 client:

.. In the definition diagram there is an invisible interaction, in white color, otherwise the activation bar could not be deactivated.
.. image:: images/async-client-diagram.png
:target: images/async-client-diagram.png
:alt: A sequence diagram that show how a async-client is not waiting but doing something else
.. mermaid::

sequenceDiagram

participant Other
participant Client
participant Server

Client ->> Server : Send Async Request
Note left of Client: Client is spinning
activate Server
Note right of Server: Server is running the callback
Other ->> Client : Incoming Event A
activate Client
Note left of Client: Client is running Event A callback
deactivate Client
Note left of Client: Client is spinning
Server -->> Client : Return Response
deactivate Server
activate Client
Note left of Client: Client is running receive callback
deactivate Client
Note left of Client: Client is spinning


In general, an asynchronous client continues running after making the request.
Expand Down

0 comments on commit 702533d

Please sign in to comment.