Skip to content

Commit

Permalink
Doc update (#151)
Browse files Browse the repository at this point in the history
* update documentation

* update dependency
---------

Co-authored-by: yuokamoto <yuokamoto@yuokamotonoMacBook-Pro.local>
Co-authored-by: torea Foissotte <tetorea@gmail.com>
  • Loading branch information
3 people authored Sep 15, 2024
1 parent b2087e4 commit 8524e5c
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 38 deletions.
4 changes: 3 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
breathe
myst-parser
myst-parser
sphinxcontrib-video
sphinx-rtd-theme
2 changes: 1 addition & 1 deletion docs/source/examples/publisher_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ Non Loop Publisher
Compared to C++, which uses CreatePublisher(),
in Blueprint, the Publisher is already generated as a Component before BeginPlay.
Therefore, we use
`UROS2NodeComponent::AddPublisher <../doxygen_generated/html/d7/d68/class_u_r_o_s2_node_component.html#a582299af64efaaa34b046c00b1c96828>_`
`UROS2NodeComponent::AddPublisher <../doxygen_generated/html/d7/d68/class_u_r_o_s2_node_component.html#a582299af64efaaa34b046c00b1c96828>`_
to initialize the Publisher instead.
The CreatePublisher function in C++ internally calls AddPublisher.

Expand Down
64 changes: 32 additions & 32 deletions docs/source/examples/service_client_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Service Client Example
=============================

Please follow the instructions in :ref:`setup_and_run_ue_project` to setup the UE project
Please follow the instructions in :ref:`setup_and_run_ue_project` to setup the UE project
and open `ROS2ServiceExample.umap <https://github.com/rapyuta-robotics/turtlebot3-UE/blob/devel/Content/Maps/ROS2TopicExamples.umap>`_.

-----------------------------
Expand Down Expand Up @@ -121,10 +121,10 @@ Code
}
^^^^^^^^^^^^^^^^^^
Examin the code
Examining the code
^^^^^^^^^^^^^^^^^^

On an AROS2ServiceClientNode Actor, similar to the AROS2PublisherrNode,
On an AROS2ServiceClientNode Actor, similar to the AROS2PublisherNode,
NodeComponent is created and initialized in the constructor but ROS2 Node is not created here.
Please check :ref:`publisher_examin_code` for the reason.

Expand All @@ -140,8 +140,8 @@ Please check :ref:`publisher_examin_code` for the reason.
}


When the simulation starts, BeginPlay is called.
In BeginPlay, firstly create and initialize the ROS2 Node by calling
When the simulation starts, BeginPlay is called.
In BeginPlay, firstly create and initialize the ROS2 Node by calling
`UROS2NodeComponent::Init <../doxygen_generated/html/d7/d68/class_u_r_o_s2_node_component.html#ab9b7b990c4ca38eb60acf8e0a53c3e52>`_
.

Expand All @@ -152,9 +152,9 @@ In BeginPlay, firstly create and initialize the ROS2 Node by calling
Super::BeginPlay();
Node->Init();

You can create a service client by using the
`ROS2_CREATE_SERVICE_CLIENT_WITH_QOS <../doxygen_generated/html/d1/d79/_r_o_s2_node_component_8h.html#afc35f3065562037d23b39eb0baa32f0d>`_
macro, which creates a service client and adds it to the node.
You can create a service client by using the
`ROS2_CREATE_SERVICE_CLIENT_WITH_QOS <../doxygen_generated/html/d1/d79/_r_o_s2_node_component_8h.html#afc35f3065562037d23b39eb0baa32f0d>`_
macro, which creates a service client and adds it to the node.
When the node receives a service response, AROS2ServiceClientNode::ReceiveResponse is called.


Expand All @@ -168,10 +168,10 @@ When the node receives a service response, AROS2ServiceClientNode::ReceiveRespon
&AROS2ServiceClientNode::ReceiveResponse, // Callback for response
UROS2QoS::DynamicBroadcaster,
AddTwoIntsSrvClient)
The implementation of ROS2_CREATE_SERVICE_CLIENT_WITH_QOS is as follows.
It uses Unreal Engine's dynamic delegate to call the bound function
when the node receives the message.

The implementation of ROS2_CREATE_SERVICE_CLIENT_WITH_QOS is as follows.
It uses Unreal Engine's dynamic delegate to call the bound function
when the node receives the message.
You can find more information about Unreal Engine's dynamic delegate .
`here <https://docs.unrealengine.com/5.1/en-US/dynamic-delegates-in-unreal-engine/>`_.

Expand All @@ -189,13 +189,13 @@ You can find more information about Unreal Engine's dynamic delegate .
}

In this example, service client is set to send request periodically by create
`UE Timer <https://docs.unrealengine.com/5.1/en-US/quick-start-guide-to-variables-timers-and-events-in-unreal-engine-cpp/>`_
`UE Timer <https://docs.unrealengine.com/5.1/en-US/quick-start-guide-to-variables-timers-and-events-in-unreal-engine-cpp/>`_
.

We create a `FTimerDelegate <https://docs.unrealengine.com/5.1/en-US/API/Runtime/Engine/FTimerDelegate/>`_
with a lambda function that will be called by the timer.
Inside the lambda function, create the request structure (FROSAddTwoIntsReq)
for the corresponding service (UROS2AddTwoIntsSrv).
We create a FTimerDelegate
with a lambda function that will be called by the timer.
Inside the lambda function, create the request structure (FROSAddTwoIntsReq)
for the corresponding service (UROS2AddTwoIntsSrv).
Set the value of the request structure, and then send the request by calling SendRequest().

.. code-block:: C++
Expand Down Expand Up @@ -228,7 +228,7 @@ Then start a timer to call the sendRequest method every 1 second.

When the node receives a service response, AROS2ServiceClientNode::ReceiveResponse is called.

To retrieve the response, you need to create a response structure (FROSAddTwoIntsRes)
To retrieve the response, you need to create a response structure (FROSAddTwoIntsRes)
for the corresponding service (UROS2AddTwoIntsSrv) and retrieve the request by calling GetResponse().

ReceiveResponse method simply prints the received response in this example.
Expand All @@ -251,16 +251,16 @@ ReceiveResponse method simply prints the received response in this example.
BP Service Client
-----------------------------

Blueprint implementation of a service client is very similar to a C++ implementation.
Blueprint implementation of a service client is very similar to a C++ implementation.
Blueprints allow you to set logic/processes, parameters, and other details from the editor.

You can add components such as UROS2Publisher from `Components` panel in the editor (left side in the fig below)
and set each component parameters in `Details` panel in the editor (right side in the fig below).

The main difference from the C++ implementation is that it uses
The main difference from the C++ implementation is that it uses
`UROS2ServiceClientComponent <../doxygen_generated/html/d1/db9/class_u_r_o_s2_service_client_component.html>`_
instead of UROS2ServiceClient.
As UROS2ServiceClientComponent is a child class of
instead of UROS2ServiceClient.
As UROS2ServiceClientComponent is a child class of
`UActorComponent <https://docs.unrealengine.com/5.1/en-US/API/Runtime/Engine/Components/UActorComponent/>`_
and has UROS2ServiceClient as a member variable, you can easily add it to the Actor and set parameters from the editor.

Expand All @@ -270,17 +270,17 @@ The Service client component is attached to an Actor, which is displayed in the

.. image:: ../images/service_client_node.png

Initialize the ROS2 Node using the BeginPlay event.
You can set the ROSNode parameters, such as Name and Namespace,
Initialize the ROS2 Node using the BeginPlay event.
You can set the ROSNode parameters, such as Name and Namespace,
from the `Details` panel on the right.

Compared to C++, which uses ROS2_CREATE_SERVICE_CLIENT_WITH_QOS,
in Blueprint, the service client is already generated as a Component before BeginPlay.
Therefore, we use
Compared to C++, which uses ROS2_CREATE_SERVICE_CLIENT_WITH_QOS,
in Blueprint, the service client is already generated as a Component before BeginPlay.
Therefore, we use
`UROS2NodeComponent::AddServiceClient <../doxygen_generated/html/d7/d68/class_u_r_o_s2_node_component.html#a5e52bd6256f3c5db5c0392cee93d7156>`_
to initialize the UROS2ServiceClient and
`UROS2ServiceClient::SetDelegates <../doxygen_generated/html/d7/df5/class_u_r_o_s2_service_client.html#ae965105e696c1662ce1655249b9d864b>`_
to bind callback method instead.
to initialize the UROS2ServiceClient and
`UROS2ServiceClient::SetDelegates <../doxygen_generated/html/d7/df5/class_u_r_o_s2_service_client.html#ae965105e696c1662ce1655249b9d864b>`_
to bind callback method instead.
The ROS2_CREATE_SERVICE_CLIENT_WITH_QOS macro in C++ internally calls CreateServiceClient which calls AddServiceClient and SetDelegates.

We also create a UE Timer to send request every 1 second.
Expand All @@ -292,5 +292,5 @@ Then increment the value of A and B and print those.

.. image:: ../images/service_client_res.png

Callback function is bound to a custom event, indicated by the red node on the left.
This callback function is called when the node receives a response.
Callback function is bound to a custom event, indicated by the red node on the left.
This callback function is called when the node receives a response.
21 changes: 17 additions & 4 deletions docs/source/overview.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Overview of a group of **rclUE** software
=====================================
==========================================

Features
--------
Expand All @@ -15,10 +15,11 @@ Above figure shows overview of related repositories. Please reference this struc

`turtlebot3-UE <https://github.com/rapyuta-robotics/turtlebot3-UE>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Example repository of ROS2 UE simulation.
Basic example repository of ROS2 UE simulation.

rclUE(this repository)
^^^^^^^^^^^^^^^^^^^^^^^^^^

`rclUE(this repository) <https://github.com/rapyuta-robotics/rclUE>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ROS2 integration features such as creating ROS2 Node, publisher/subscriber and etc.

`RapyutaSimulationPlugins <https://rapyutasimulationplugins.readthedocs.io/en/devel/index.html>`_
Expand All @@ -38,3 +39,15 @@ Please follow README to add new msgs to rclUE.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Includes ROS2 msg/srv/action files. Please use `UE_tools <https://github.com/rapyuta-robotics/UE_tools>`_
to generate necessary C++ files for UE plugins.


Other example repositories
--------------------------

`rclUE-Examples <https://github.com/yuokamoto/rclUE-Examples>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Complicated example repository of ROS2 UE simulation including warehouse, human character, etc.

`rclUE_client_example <https://github.com/yuokamoto/rclUE_client_example>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ROS2 Client example repository to control rclUE-Example project.

0 comments on commit 8524e5c

Please sign in to comment.