From ea9bd923a48460843eb21881d8c8aefd832b4462 Mon Sep 17 00:00:00 2001 From: Barry Xu Date: Fri, 28 Feb 2025 15:56:03 +0800 Subject: [PATCH 1/6] [Design] Add design on recording and replay action Signed-off-by: Barry Xu --- docs/design/rosbag2_record_replay_action.md | 136 ++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 docs/design/rosbag2_record_replay_action.md diff --git a/docs/design/rosbag2_record_replay_action.md b/docs/design/rosbag2_record_replay_action.md new file mode 100644 index 0000000000..0cfb9d0d9f --- /dev/null +++ b/docs/design/rosbag2_record_replay_action.md @@ -0,0 +1,136 @@ +# Rosbag2 record and replay action + +## Context + +This design describe how to implement this feature based on current architecture and how to extend current command parameter. + +## How to record action message + +The implementation of the action uses three services and two topics. For the services, when service introspection is enabled, rosbag2 can record service data through the service event topic (refer to [rosbag2_record_replay_service.md](./rosbag2_record_replay_service.md)). So all data related to the action can be recorded. + + +## Which topics should be focused on for an action + +- goal service + + [NameSpace/]ActionName/_action/send_goal (Service Event Topic: [NameSpace/]ActionName/_action/send_goal/_service_event) + +- result service + + [NameSpace/]ActionName/_action/get_result (Service Event Topic: [NameSpace/]ActionName/_action/get_result/_service_event) + +- cancel service + + [NameSpace/]ActionName/_action/cancel_goal (Service Event Topic: [NameSpace/]ActionName/_action/cancel_goal/_service_event) + +- status topic + + [NameSpace/]ActionName/_action/status + +- feedback topic + + [NameSpace/]ActionName/_action/feedback + +For an action, five related topics will be recorded. + +### Expand the 'record' command + +Newly added arguments: + +| Argument Name | Description | +| :-- | :-- | +| --actions ActionName [ActionName ...] | Space-delimited list of actions to record. | +| --all-actions | Record all actions via service event topics and hidden action topics. | +| --exclude-actions ActionName [ActionName ...] | Space-delimited list of actions not being recorded. Works on top of --all, --all-actions, --actions or --regex. | + +Updated arguments: + +| Argument Name | Description | +| :-- | :-- | +| -a, --all | Record all topics, services and **actions** (Exclude hidden topic). | +| -e REGEX, --regex REGEX | Record only topics, services and **actions** containing provided regular expression. Note: --all, --all-topics, --all-services or **--all-actions** will override --regex. | +| --exclude-regex EXCLUDE_REGEX | Exclude topics, services and actions containing provided regular expression. Works on top of --all, --all-topics, --all-services, **--all-actions**, --topics, --services, **--actions** or --regex. | + +### Change output of 'Info' command + +Add action part. + +Without `-v` or `--verbose` parameter, info command shows as below example. +``` + Files: .mcap + Bag size: 39.9 KiB + Storage id: mcap + ROS Distro: rolling + Duration: 4.835s + Start: Mar 18 2024 16:42:14.323 (1710805334.323) + End: Mar 18 2024 16:42:19.159 (1710805339.159) + Messages: 39 + Topic information: Topic: /events/write_split | Type: rosbag2_interfaces/msg/WriteSplitEvent | Count: 0 | Serialization Format: cdr + Topic: /parameter_events | Type: rcl_interfaces/msg/ParameterEvent | Count: 0 | Serialization Format: cdr + Topic: /rosout | Type: rcl_interfaces/msg/Log | Count: 39 | Serialization Format: cdr + Service: 1 + Service information: Service: /add_two_ints | Type: example_interfaces/srv/AddTwoInts | Event Count: 42 | Serialization Format: cdr + Action: 2 + Action information: + Action: /fibonacci | Type: action_tutorials_interfaces/action/Fibonacci | Topics: 2 | Services: 3 | Serialization Format: cdr + Topic: feedback | Count: 1 + Topic: status | Count: 10 + Service: send_goal | Event Count: 20 + Service: cancel_goal | Event Count: 2 + Service: get_result | Event Count: 9 + Action: /other | Type: other_action_interfaces/action/Other | Topics: 2 | Services: 3 | Serialization Format: cdr + Topic: feedback | Count: 2 + Topic: status | Count: 20 + Service: send_goal | Event Count: 40 + Service: cancel_goal | Event Count: 4 + Service: get_result | Event Count: 9 +``` + +With `-v` or `--verbose` parameter, info command shows as below example. +``` + Files: .mcap + Bag size: 39.9 KiB + Storage id: mcap + ROS Distro: rolling + Duration: 4.835s + Start: Mar 18 2024 16:42:14.323 (1710805334.323) + End: Mar 18 2024 16:42:19.159 (1710805339.159) + Messages: 39 + Topic information: Topic: /events/write_split | Type: rosbag2_interfaces/msg/WriteSplitEvent | Count: 0 | Serialization Format: cdr + Topic: /parameter_events | Type: rcl_interfaces/msg/ParameterEvent | Count: 0 | Serialization Format: cdr + Topic: /rosout | Type: rcl_interfaces/msg/Log | Count: 39 | Serialization Format: cdr + Service: 1 + Service information: Service: /add_two_ints | Type: example_interfaces/srv/AddTwoInts | Request Count: 20 | Response Count: 22 | Serialization Format: cdr + Action: 2 + Action information: + Action: /fibonacci | Type: action_tutorials_interfaces/action/Fibonacci | Topics: 2 | Services: 3 | Serialization Format: cdr + Topic: feedback | Count: 1 + Topic: status | Count: 10 + Service: send_goal | Request Count: 10 | Response Count: 10 + Service: cancel_goal | Request Count: 1 | Response Count: 1 + Service: get_result | Request Count: 5 | Response Count: 4 + Action: /other | Type: other_action_interfaces/action/Other | Topics: 2 | Services: 3 | Serialization Format: cdr + Topic: feedback | Count: 2 + Topic: status | Count: 20 + Service: send_goal | Request Count: 20 | Response Count: 20 + Service: cancel_goal | Request Count: 2 | Response Count: 2 + Service: get_result | Request Count: 5 | Response Count: 4 +``` + +### Expand the 'play' command + +Newly added arguments: + +| Argument Name | Description | +| :-- | :-- | +| --actions action [action ...] | Space-delimited list of actions to play. | +| --exclude-actions action [action ...] | Space-delimited list of actions not to play. | +| --send-action-goal | Send recorded action goal instead of recorded service events and action internal topics. | + +Updated arguments: + +| Argument Name | Description | +| :-- | :-- | +| -e REGEX, --regex REGEX | Play only topics, services and **actions** matches with regular expression. | +| -x EXCLUDE_REGEX, --exclude-regex EXCLUDE_REGEX | regular expressions to exclude topics, services and **actions** from replay. | +| --service-requests-source {service_introspection,client_introspection} | Determine the source of the service requests to be replayed. This option only makes sense if the "--publish-service-requests" or **"--send-action-goal"** option is set. By default, the service requests replaying from recorded service introspection message. | From d8246df1a845826aa13b5c36f610dd67d598d816 Mon Sep 17 00:00:00 2001 From: Barry Xu Date: Fri, 7 Mar 2025 09:47:45 +0800 Subject: [PATCH 2/6] Fix a typo Signed-off-by: Barry Xu --- docs/design/rosbag2_record_replay_action.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/design/rosbag2_record_replay_action.md b/docs/design/rosbag2_record_replay_action.md index 0cfb9d0d9f..c78df59a0e 100644 --- a/docs/design/rosbag2_record_replay_action.md +++ b/docs/design/rosbag2_record_replay_action.md @@ -2,7 +2,7 @@ ## Context -This design describe how to implement this feature based on current architecture and how to extend current command parameter. +This design describes how to implement this feature based on current architecture and how to extend current command parameter. ## How to record action message From f989395be1a45fb9f5b5d38fafecffc856ff8023 Mon Sep 17 00:00:00 2001 From: Barry Xu Date: Wed, 12 Mar 2025 17:54:11 +0800 Subject: [PATCH 3/6] Address some of review comments Signed-off-by: Barry Xu --- docs/design/rosbag2_record_replay_action.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/design/rosbag2_record_replay_action.md b/docs/design/rosbag2_record_replay_action.md index c78df59a0e..fd23c1a539 100644 --- a/docs/design/rosbag2_record_replay_action.md +++ b/docs/design/rosbag2_record_replay_action.md @@ -9,7 +9,7 @@ This design describes how to implement this feature based on current architectur The implementation of the action uses three services and two topics. For the services, when service introspection is enabled, rosbag2 can record service data through the service event topic (refer to [rosbag2_record_replay_service.md](./rosbag2_record_replay_service.md)). So all data related to the action can be recorded. -## Which topics should be focused on for an action +## Topics to be recorded for an action - goal service @@ -68,9 +68,9 @@ Without `-v` or `--verbose` parameter, info command shows as below example. Topic information: Topic: /events/write_split | Type: rosbag2_interfaces/msg/WriteSplitEvent | Count: 0 | Serialization Format: cdr Topic: /parameter_events | Type: rcl_interfaces/msg/ParameterEvent | Count: 0 | Serialization Format: cdr Topic: /rosout | Type: rcl_interfaces/msg/Log | Count: 39 | Serialization Format: cdr - Service: 1 + Services: 1 Service information: Service: /add_two_ints | Type: example_interfaces/srv/AddTwoInts | Event Count: 42 | Serialization Format: cdr - Action: 2 + Actions: 2 Action information: Action: /fibonacci | Type: action_tutorials_interfaces/action/Fibonacci | Topics: 2 | Services: 3 | Serialization Format: cdr Topic: feedback | Count: 1 @@ -99,9 +99,9 @@ With `-v` or `--verbose` parameter, info command shows as below example. Topic information: Topic: /events/write_split | Type: rosbag2_interfaces/msg/WriteSplitEvent | Count: 0 | Serialization Format: cdr Topic: /parameter_events | Type: rcl_interfaces/msg/ParameterEvent | Count: 0 | Serialization Format: cdr Topic: /rosout | Type: rcl_interfaces/msg/Log | Count: 39 | Serialization Format: cdr - Service: 1 + Services: 1 Service information: Service: /add_two_ints | Type: example_interfaces/srv/AddTwoInts | Request Count: 20 | Response Count: 22 | Serialization Format: cdr - Action: 2 + Actions: 2 Action information: Action: /fibonacci | Type: action_tutorials_interfaces/action/Fibonacci | Topics: 2 | Services: 3 | Serialization Format: cdr Topic: feedback | Count: 1 From 52f39c702c5601606885ac35e104184a9c39eb81 Mon Sep 17 00:00:00 2001 From: Barry Xu Date: Thu, 13 Mar 2025 13:19:28 +0800 Subject: [PATCH 4/6] Update to avoid display issue Signed-off-by: Barry Xu --- docs/design/rosbag2_record_replay_action.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/design/rosbag2_record_replay_action.md b/docs/design/rosbag2_record_replay_action.md index fd23c1a539..fa1cad56e6 100644 --- a/docs/design/rosbag2_record_replay_action.md +++ b/docs/design/rosbag2_record_replay_action.md @@ -13,15 +13,18 @@ The implementation of the action uses three services and two topics. For the ser - goal service - [NameSpace/]ActionName/_action/send_goal (Service Event Topic: [NameSpace/]ActionName/_action/send_goal/_service_event) + [NameSpace/]ActionName/_action/send_goal + Service Event Topic: [NameSpace/]ActionName/_action/send_goal/_service_event - result service - [NameSpace/]ActionName/_action/get_result (Service Event Topic: [NameSpace/]ActionName/_action/get_result/_service_event) + [NameSpace/]ActionName/_action/get_result + Service Event Topic: [NameSpace/]ActionName/_action/get_result/_service_event - cancel service - [NameSpace/]ActionName/_action/cancel_goal (Service Event Topic: [NameSpace/]ActionName/_action/cancel_goal/_service_event) + [NameSpace/]ActionName/_action/cancel_goal + Service Event Topic: [NameSpace/]ActionName/_action/cancel_goal/_service_event - status topic From 437e78415839efddca647df0222d63ce83cec4b4 Mon Sep 17 00:00:00 2001 From: Barry Xu Date: Mon, 17 Mar 2025 10:08:54 +0800 Subject: [PATCH 5/6] Use "--send-actions-as-client" instead of "--send-action-goal" Signed-off-by: Barry Xu --- docs/design/rosbag2_record_replay_action.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/design/rosbag2_record_replay_action.md b/docs/design/rosbag2_record_replay_action.md index fa1cad56e6..6917088fda 100644 --- a/docs/design/rosbag2_record_replay_action.md +++ b/docs/design/rosbag2_record_replay_action.md @@ -128,7 +128,7 @@ Newly added arguments: | :-- | :-- | | --actions action [action ...] | Space-delimited list of actions to play. | | --exclude-actions action [action ...] | Space-delimited list of actions not to play. | -| --send-action-goal | Send recorded action goal instead of recorded service events and action internal topics. | +| --send-actions-as-client | Send the send_goal request, cancel_goal request, and get_result request respectively based on the recorded send_goal, cancel_goal, and get_result event messages. | Updated arguments: @@ -136,4 +136,4 @@ Updated arguments: | :-- | :-- | | -e REGEX, --regex REGEX | Play only topics, services and **actions** matches with regular expression. | | -x EXCLUDE_REGEX, --exclude-regex EXCLUDE_REGEX | regular expressions to exclude topics, services and **actions** from replay. | -| --service-requests-source {service_introspection,client_introspection} | Determine the source of the service requests to be replayed. This option only makes sense if the "--publish-service-requests" or **"--send-action-goal"** option is set. By default, the service requests replaying from recorded service introspection message. | +| --service-requests-source {service_introspection,client_introspection} | Determine the source of the service requests to be replayed. This option only makes sense if the "--publish-service-requests" or **"--send-actions-as-client"** option is set. By default, the service requests replaying from recorded service introspection message. | From 3f1ead3da6b8a4d4c4dcfd82f4753a5e369e32ae Mon Sep 17 00:00:00 2001 From: Barry Xu Date: Tue, 18 Mar 2025 11:16:25 +0800 Subject: [PATCH 6/6] Add note to the description of argument "--send-actions-as-client" Signed-off-by: Barry Xu --- docs/design/rosbag2_record_replay_action.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/design/rosbag2_record_replay_action.md b/docs/design/rosbag2_record_replay_action.md index 6917088fda..e6255a79bf 100644 --- a/docs/design/rosbag2_record_replay_action.md +++ b/docs/design/rosbag2_record_replay_action.md @@ -128,7 +128,7 @@ Newly added arguments: | :-- | :-- | | --actions action [action ...] | Space-delimited list of actions to play. | | --exclude-actions action [action ...] | Space-delimited list of actions not to play. | -| --send-actions-as-client | Send the send_goal request, cancel_goal request, and get_result request respectively based on the recorded send_goal, cancel_goal, and get_result event messages. | +| --send-actions-as-client | Send the send_goal request, cancel_goal request, and get_result request respectively based on the recorded send_goal, cancel_goal, and get_result event messages. Note that the messages from action's "status topic" [NameSpace/]ActionName/_action/status and "feedback topic" [NameSpace/]ActionName/_action/feedback will not be sent because they are expected to be sent from the action server side. | Updated arguments: