Skip to content

Commit 13d2dd7

Browse files
Nils-ChristianIsekemergify[bot]
authored andcommitted
Add $ to Beginner-CLI-Tools and Beginner-Client Libraires (#5359)
Signed-off-by: Nils-Christian Iseke <[email protected]> Signed-off-by: Nils-Christian Iseke <[email protected]> Signed-off-by: Christophe Bedard <[email protected]> Co-authored-by: Christophe Bedard <[email protected]> (cherry picked from commit 278c507) # Conflicts: # source/Tutorials/Beginner-CLI-Tools/Recording-And-Playing-Back-Data/Recording-And-Playing-Back-Data.rst
1 parent 4bccb55 commit 13d2dd7

File tree

9 files changed

+247
-55
lines changed

9 files changed

+247
-55
lines changed

source/Tutorials/Beginner-CLI-Tools/Recording-And-Playing-Back-Data/Recording-And-Playing-Back-Data.rst

Lines changed: 218 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,22 @@ Let's also make a new directory to store our saved recordings, just as good prac
6767

6868
.. code-block:: console
6969
70-
mkdir bag_files
71-
cd bag_files
70+
$ mkdir bag_files
71+
$ cd bag_files
7272
7373
.. group-tab:: macOS
7474

7575
.. code-block:: console
7676
77-
mkdir bag_files
78-
cd bag_files
77+
$ mkdir bag_files
78+
$ cd bag_files
7979
8080
.. group-tab:: Windows
8181

8282
.. code-block:: console
8383
84-
md bag_files
85-
cd bag_files
84+
$ md bag_files
85+
$ cd bag_files
8686
8787
8888
2 Choose a topic
@@ -427,6 +427,218 @@ You can see the service request from the bag file and the service response from
427427
request: []
428428
response: [{sum: 5}]
429429
430+
<<<<<<< HEAD
431+
=======
432+
Managing Action Data
433+
--------------------
434+
435+
1 Setup
436+
^^^^^^^
437+
438+
You'll be recording action data between ``fibonacci_action_client`` and ``fibonacci_action_server``, then display and replay that same data later on.
439+
To record action data between action client and server, ``Action Introspection`` must be enabled on the nodes.
440+
441+
Let's start ``fibonacci_action_client`` and ``fibonacci_action_server`` nodes and enable ``Action Introspection``.
442+
You can see more details for :doc:`Action Introspection Demo <../../Demos/Action-Introspection>`.
443+
444+
Open a new terminal and run ``fibonacci_action_server``, enabling ``Action Introspection``:
445+
446+
.. code-block:: console
447+
448+
$ ros2 run action_tutorials_py fibonacci_action_server --ros-args -p action_server_configure_introspection:=contents
449+
450+
Open another terminal and run ``fibonacci_action_client``, enabling ``Action Introspection``:
451+
452+
.. code-block:: console
453+
454+
$ ros2 run action_tutorials_cpp fibonacci_action_client --ros-args -p action_client_configure_introspection:=contents
455+
456+
2 Check action availability
457+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
458+
459+
``ros2 bag`` can only record data from available actions.
460+
To see the list of your system's actions, open a new terminal and run the command:
461+
462+
.. code-block:: console
463+
464+
$ ros2 action list
465+
/fibonacci
466+
467+
To check if ``Action Introspection`` is enabled on the action, run the command:
468+
469+
.. code-block:: console
470+
471+
$ ros2 action echo --flow-style /fibonacci
472+
interface: GOAL_SERVICE
473+
info:
474+
event_type: REQUEST_SENT
475+
stamp:
476+
sec: 1744917904
477+
nanosec: 760683446
478+
client_gid: [1, 15, 165, 231, 234, 109, 65, 202, 0, 0, 0, 0, 0, 0, 19, 4]
479+
sequence_number: 1
480+
request: [{goal_id: {uuid: [81, 55, 121, 145, 81, 66, 209, 93, 214, 113, 255, 100, 120, 6, 102, 83]}, goal: {order: 10}}]
481+
response: []
482+
---
483+
...
484+
485+
3 Record actions
486+
^^^^^^^^^^^^^^^^
487+
488+
To record action data, the following options are supported.
489+
Action data can be recorded with topics and services at the same time.
490+
491+
To record specific actions:
492+
493+
.. code-block:: console
494+
495+
$ ros2 bag record --action <action_names>
496+
497+
To record all actions:
498+
499+
.. code-block:: console
500+
501+
$ ros2 bag record --all-actions
502+
503+
Run the command:
504+
505+
.. code-block:: console
506+
507+
$ ros2 bag record --action /fibonacci
508+
[INFO] [1744953225.214114862] [rosbag2_recorder]: Press SPACE for pausing/resuming
509+
[INFO] [1744953225.218369761] [rosbag2_recorder]: Listening for topics...
510+
[INFO] [1744953225.218386223] [rosbag2_recorder]: Event publisher thread: Starting
511+
[INFO] [1744953225.218580294] [rosbag2_recorder]: Recording...
512+
[INFO] [1744953225.725417634] [rosbag2_recorder]: Subscribed to topic '/fibonacci/_action/cancel_goal/_service_event'
513+
[INFO] [1744953225.727901848] [rosbag2_recorder]: Subscribed to topic '/fibonacci/_action/feedback'
514+
[INFO] [1744953225.729655213] [rosbag2_recorder]: Subscribed to topic '/fibonacci/_action/get_result/_service_event'
515+
[INFO] [1744953225.731315612] [rosbag2_recorder]: Subscribed to topic '/fibonacci/_action/send_goal/_service_event'
516+
[INFO] [1744953225.735061252] [rosbag2_recorder]: Subscribed to topic '/fibonacci/_action/status'
517+
...
518+
519+
Now ``ros2 bag`` is recording the action data for the ``/fibonacci`` action: goal, result, and feedback.
520+
To stop the recording, enter ``Ctrl+C`` in the terminal.
521+
522+
The data will be accumulated in a new bag directory with a name in the pattern of ``rosbag2_year_month_day-hour_minute_second``.
523+
This directory will contain a ``metadata.yaml`` along with the bag file in the recorded format.
524+
525+
4 Inspect action data
526+
^^^^^^^^^^^^^^^^^^^^^
527+
528+
You can see details about your recording by running:
529+
530+
.. code-block:: console
531+
532+
$ ros2 bag info <bag_file_name>
533+
Files: rosbag2_2025_04_17-22_20_40_0.mcap
534+
Bag size: 20.7 KiB
535+
Storage id: mcap
536+
ROS Distro: rolling
537+
Duration: 9.019568080s
538+
Start: Apr 17 2025 22:20:47.263125070 (1744953647.263125070)
539+
End: Apr 17 2025 22:20:56.282693150 (1744953656.282693150)
540+
Messages: 0
541+
Topic information:
542+
Services: 0
543+
Service information:
544+
Actions: 1
545+
Action information:
546+
Action: /fibonacci | Type: example_interfaces/action/Fibonacci | Topics: 2 | Service: 3 | Serialization Format: cdr
547+
Topic: feedback | Count: 9
548+
Topic: status | Count: 3
549+
Service: send_goal | Event Count: 4
550+
Service: cancel_goal | Event Count: 0
551+
Service: get_result | Event Count: 4
552+
553+
5 Play action data
554+
^^^^^^^^^^^^^^^^^^
555+
556+
Before replaying the bag file, enter :kbd:`Ctrl-C` in the terminal where ``fibonacci_action_client`` is running.
557+
When ``fibonacci_action_client`` stops running, ``fibonacci_action_server`` also stops printing the result because there are no incoming requests.
558+
559+
Replaying the action data from the bag file will start sending the requests to ``fibonacci_action_server``.
560+
561+
Enter the command:
562+
563+
.. code-block:: console
564+
565+
$ ros2 bag play --send-actions-as-client <bag_file_name>
566+
[INFO] [1744953720.691068674] [rosbag2_player]: Set rate to 1
567+
[INFO] [1744953720.702365209] [rosbag2_player]: Adding keyboard callbacks.
568+
[INFO] [1744953720.702409447] [rosbag2_player]: Press SPACE for Pause/Resume
569+
[INFO] [1744953720.702423063] [rosbag2_player]: Press CURSOR_RIGHT for Play Next Message
570+
[INFO] [1744953720.702431404] [rosbag2_player]: Press CURSOR_UP for Increase Rate 10%
571+
[INFO] [1744953720.702437677] [rosbag2_player]: Press CURSOR_DOWN for Decrease Rate 10%
572+
Progress bar enabled at 3 Hz.
573+
Progress bar [?]: [R]unning, [P]aused, [B]urst, [D]elayed, [S]topped
574+
[INFO] [1744953720.702577680] [rosbag2_player]: Playback until timestamp: -1
575+
576+
577+
====== Playback Progress ======
578+
[1744953656.281683207] Duration 9.02/9.02 [R]
579+
580+
Your ``fibonacci_action_server`` terminal will once again start printing the following service messages:
581+
582+
.. code-block:: console
583+
584+
[INFO] [1744953720.815577088] [fibonacci_action_server]: Executing goal...
585+
[INFO] [1744953720.815927050] [fibonacci_action_server]: Feedback: array('i', [0, 1, 1])
586+
[INFO] [1744953721.816509658] [fibonacci_action_server]: Feedback: array('i', [0, 1, 1, 2])
587+
[INFO] [1744953722.817220270] [fibonacci_action_server]: Feedback: array('i', [0, 1, 1, 2, 3])
588+
[INFO] [1744953723.817876426] [fibonacci_action_server]: Feedback: array('i', [0, 1, 1, 2, 3, 5])
589+
[INFO] [1744953724.818498515] [fibonacci_action_server]: Feedback: array('i', [0, 1, 1, 2, 3, 5, 8])
590+
[INFO] [1744953725.819182228] [fibonacci_action_server]: Feedback: array('i', [0, 1, 1, 2, 3, 5, 8, 13])
591+
[INFO] [1744953726.820032562] [fibonacci_action_server]: Feedback: array('i', [0, 1, 1, 2, 3, 5, 8, 13, 21])
592+
[INFO] [1744953727.820738690] [fibonacci_action_server]: Feedback: array('i', [0, 1, 1, 2, 3, 5, 8, 13, 21, 34])
593+
[INFO] [1744953728.821449308] [fibonacci_action_server]: Feedback: array('i', [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55])
594+
595+
This is because ``ros2 bag play`` sends the action goal request data from the bag file to the ``/fibonacci`` action.
596+
597+
We can also introspect action communication as ``ros2 bag play`` is playing it back to verify the ``fibonacci_action_server``.
598+
599+
Run this command before ``ros2 bag play`` to see the ``fibonacci_action_server``.
600+
You can see the action goal request from the bag file and the service response from ``fibonacci_action_server``:
601+
602+
.. code-block:: console
603+
604+
$ ros2 action echo --flow-style /fibonacci
605+
interface: STATUS_TOPIC
606+
status_list: [{goal_info: {goal_id: {uuid: [34, 116, 225, 217, 48, 121, 146, 36, 240, 98, 99, 134, 55, 227, 184, 72]}, stamp: {sec: 1744953720, nanosec: 804984321}}, status: 4}]
607+
---
608+
interface: GOAL_SERVICE
609+
info:
610+
event_type: REQUEST_RECEIVED
611+
stamp:
612+
sec: 1744953927
613+
nanosec: 957359210
614+
client_gid: [1, 15, 165, 231, 190, 254, 1, 50, 0, 0, 0, 0, 0, 0, 19, 4]
615+
sequence_number: 1
616+
request: [{goal_id: {uuid: [191, 200, 153, 122, 221, 251, 152, 172, 60, 69, 94, 20, 212, 160, 40, 12]}, goal: {order: 10}}]
617+
response: []
618+
---
619+
interface: GOAL_SERVICE
620+
info:
621+
event_type: RESPONSE_SENT
622+
stamp:
623+
sec: 1744953927
624+
nanosec: 957726145
625+
client_gid: [1, 15, 165, 231, 190, 254, 1, 50, 0, 0, 0, 0, 0, 0, 19, 4]
626+
sequence_number: 1
627+
request: []
628+
response: [{accepted: true, stamp: {sec: 1744953927, nanosec: 957615866}}]
629+
---
630+
interface: STATUS_TOPIC
631+
status_list: [{goal_info: {goal_id: {uuid: [191, 200, 153, 122, 221, 251, 152, 172, 60, 69, 94, 20, 212, 160, 40, 12]}, stamp: {sec: 1744953927, nanosec: 957663383}}, status: 2}]
632+
---
633+
interface: FEEDBACK_TOPIC
634+
goal_id:
635+
uuid: [191, 200, 153, 122, 221, 251, 152, 172, 60, 69, 94, 20, 212, 160, 40, 12]
636+
feedback:
637+
sequence: [0, 1, 1]
638+
---
639+
...
640+
641+
>>>>>>> 278c507 (Add $ to Beginner-CLI-Tools and Beginner-Client Libraires (#5359))
430642
Summary
431643
-------
432644

source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Actions/Understanding-ROS2-Actions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ Enter the following command with the action type in your terminal:
249249
250250
Which will return:
251251

252-
.. code-block:: console
252+
.. code-block:: text
253253
254254
# The desired heading in radians
255255
float32 theta

source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Nodes/Understanding-ROS2-Nodes.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,12 @@ You can find node names by using ``ros2 node list``
7777
``ros2 node list`` will show you the names of all running nodes.
7878
This is especially useful when you want to interact with a node, or when you have a system running many nodes and need to keep track of them.
7979

80-
Open a new terminal while turtlesim is still running in the other one, and enter the following command:
81-
82-
.. code-block:: console
83-
84-
$ ros2 node list
85-
80+
Open a new terminal while turtlesim is still running in the other one, and enter the following command.
8681
The terminal will return the node name:
8782

8883
.. code-block:: console
8984
85+
$ ros2 node list
9086
/turtlesim
9187
9288
Open another new terminal and start the teleop node with the command:
@@ -102,6 +98,7 @@ You will now see the names of two active nodes:
10298

10399
.. code-block:: console
104100
101+
$ ros2 node list
105102
/turtlesim
106103
/teleop_turtle
107104

source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,11 @@ Specifically, what structure of data the message expects.
200200
201201
$ ros2 interface show geometry_msgs/msg/Twist
202202
203-
.. code-block:: console
203+
Which will return:
204204

205-
# This expresses velocity in free space broken into its linear and angular parts.
205+
.. code-block:: text
206206
207+
# This expresses velocity in free space broken into its linear and angular parts.
207208
Vector3 linear
208209
float64 x
209210
float64 y

source/Tutorials/Beginner-CLI-Tools/Using-Rqt-Console/Using-Rqt-Console.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,11 @@ Press ``Ctrl+C`` in the terminal where you ran the ``ros2 topic pub`` command to
8787

8888
ROS 2's logger levels are ordered by severity:
8989

90-
.. code-block:: console
91-
92-
Fatal
93-
Error
94-
Warn
95-
Info
96-
Debug
90+
1. Fatal
91+
2. Error
92+
3. Warn
93+
4. Info
94+
5. Debug
9795

9896
There is no exact standard for what each level indicates, but it's safe to assume that:
9997

source/Tutorials/Beginner-Client-Libraries/Colcon-Tutorial.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ These files will add all of the required elements to your path and library paths
257257
258258
.. group-tab:: Windows
259259

260+
In a Windows command line interface:
261+
260262
.. code-block:: console
261263
262264
$ call install\setup.bat

source/Tutorials/Beginner-Client-Libraries/Custom-ROS2-Interfaces.rst

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -188,49 +188,31 @@ In a new terminal, run the following command from within your workspace (``ros2_
188188
189189
$ call install/setup.bat
190190
191-
Now you can confirm that your interface creation worked by using the ``ros2 interface show`` command:
191+
Now you can confirm that your interface creation worked by using the ``ros2 interface show`` command.
192+
The output you see in your terminal should look similar to the following:
192193

193194
.. code-block:: console
194195
195196
$ ros2 interface show tutorial_interfaces/msg/Num
196-
197-
should return:
198-
199-
.. code-block:: bash
200-
201-
int64 num
202-
203-
And
197+
int64 num
204198
205199
.. code-block:: console
206200
207201
$ ros2 interface show tutorial_interfaces/msg/Sphere
208-
209-
should return:
210-
211-
.. code-block:: console
212-
213-
geometry_msgs/Point center
214-
float64 x
215-
float64 y
216-
float64 z
217-
float64 radius
218-
219-
And
202+
geometry_msgs/Point center
203+
float64 x
204+
float64 y
205+
float64 z
206+
float64 radius
220207
221208
.. code-block:: console
222209
223210
$ ros2 interface show tutorial_interfaces/srv/AddThreeInts
224-
225-
should return:
226-
227-
.. code-block:: bash
228-
229-
int64 a
230-
int64 b
231-
int64 c
232-
---
233-
int64 sum
211+
int64 a
212+
int64 b
213+
int64 c
214+
---
215+
int64 sum
234216
235217
7 Test the new interfaces
236218
^^^^^^^^^^^^^^^^^^^^^^^^^

source/Tutorials/Beginner-Client-Libraries/Pluginlib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ Navigate back to the root of your workspace, ``ros2_ws``, and build your new pac
276276

277277
.. code-block:: console
278278
279-
colcon build --packages-select polygon_base polygon_plugins
279+
$ colcon build --packages-select polygon_base polygon_plugins
280280
281281
From ``ros2_ws``, be sure to source the setup files:
282282

0 commit comments

Comments
 (0)