Skip to content

Commit

Permalink
Update design based on review comments
Browse files Browse the repository at this point in the history
1. Add '/srv/' to judge if type is for service event topic
2. Update and add new parameters for record command
3. Add '-v'/'--verbose' to info command

Signed-off-by: Barry Xu <[email protected]>
  • Loading branch information
Barry-Xu-2018 committed Jun 12, 2023
1 parent 8f52a53 commit 13effd3
Showing 1 changed file with 56 additions and 11 deletions.
67 changes: 56 additions & 11 deletions docs/design/rosbag2_record_replay_service.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ This design describe how to implement this feature based on current architecture

## How to save record service message

Service introspection ([ros2/ros2#1285](https://github.com/ros2/ros2/issues/1285)) had been implemented. All service messages (requests and responses) are published to service introspection topic which is hidden topic named as `_service_event` under service name (e.g. /add_two_ints/_service_event). So all messages in this topic can be recorded like general topic.
Service introspection ([ros2/ros2#1285](https://github.com/ros2/ros2/issues/1285)) had been implemented. All service messages (requests and responses) are published to service event topic which is hidden topic named as `_service_event` under service name (e.g. /add_two_ints/_service_event). So all messages in this topic can be recorded like general topic.

## How to distinguish service introspection topic in all recorded topics
## How to distinguish service event topic in all recorded topics

Service introspection is saved like general topic. But they should use different process after reading from recording file. So they should be distinguished by topic name.
Service event topic is saved like general topic. But they should use different process after reading from recording file. So they should be distinguished by topic name.

- General topic

Expand All @@ -22,23 +22,48 @@ Service introspection is saved like general topic. But they should use different

[NameSpace/]_TopicName

- Service introspection topic
- Service event topic

[NameSpace/]ServiceName/_service_event

So if the string ends with `/_service_event` in topic name, it should be service introspection topic. Of course, it is possible that hidden topic has the same name. So message type is used for further check. The message type for service introspection must ends with "_Event" (e.g. example_interfaces/srv/AddTwoInts_Event). Therefore, service introspection topic can be identified.
So if the string ends with `/_service_event` in topic name, it should be service event topic. Of course, it is possible that hidden topic has the same name. So message type is used for further check. The message type for service event topic must include `/srv/` and ends with `_Event` (e.g. example_interfaces/srv/AddTwoInts_Event). Therefore, service event topic can be identified.

### Expand the 'record' command

Add 1 parameter.
Add 3 parameters.

- `-S [SerivceName1 ServiceName2 ...]` or `--services [SerivceName1 ServiceName2 ...]`
- `-S SerivceName1 [ServiceName2 ...]` or `--services SerivceName1 [ServiceName2 ...]`

If the user doesn't specify service names, all service introspection topics are recorded.
If the user doesn't specify service names, all service event topics are recorded.

- `--all-topics`

Record all topics. Hidden topic are excluded (include service event topics).

- `--all-services`

Record all service event topics.

The description of the relevant parameter behavior.

| Parameter | Description |
| :-- | :--|
|--include-hidden-topics| Record all hidden topics. Include service event topic. |
|--services ServiceName1 [ServiceName2 ...] | Record services (service event topics) with specified service names. |
| --all | Record all topics and service event topics. Other hidden topics are excluded. |
| --all-topics | Record all topics. Hidden topic are excluded (include service event topic). |
| --all-services | Only record all service event topics. |

### Change output of 'Info' command

Topic for service introspection should be listed distinctively, as below example.
A new parameter is added.

- `-v` or `--verbose`

This parameter only affect service event topic. if `-v` or `--verbose` is set, info command shows the number of request and response for each services based on service event. Otherwise, only show the number of service event. Note that parsing the number of request and response need spent time. The duration of the parsing is related to the number of recorded service events.


Without `-v` or `--verbose` parameter, info command shows as below example.

```
Files: 123_0.mcap
Expand All @@ -53,12 +78,32 @@ Topic information: Topic: /chatter | Type: std_msgs/msg/String | Count: 16 | Ser
Topic: /parameter_events | Type: rcl_interfaces/msg/ParameterEvent | Count: 0 | Serialization Format: cdr
Topic: /rosout | Type: rcl_interfaces/msg/Log | Count: 44 | Serialization Format: cdr
>>>> The below is new added items for service introspection <<<<<<<
Service Events: XX
>>>> The below is new added items for service event topic <<<<<<<
Service : XX <== The number of service
Service information: Service: /xxx/xxx | Type: xxx/xxx/xxx | Event Count: XX | Serialization Format: XX
Service: /xxx/xxx | Type: xxx/xxx/xxx | Event Count: XX | Serialization Format: XX
```

With `-v` or `--verbose` parameter, info command shows as below example.
```
Files: 123_0.mcap
Bag size: 28.2 KiB
Storage id: mcap
Duration: 15.59s
Start: May 19 2023 13:22:25.340 (1684473745.340)
End: May 19 2023 13:22:40.400 (1684473760.400)
Messages: 60
Topic information: Topic: /chatter | Type: std_msgs/msg/String | Count: 16 | Serialization Format: cdr
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: 44 | Serialization Format: cdr
>>>> The below is new added items for service <<<<<<<
Service : XX <== The number of service
Service information: Service: /xxx/xxx | Type: xxx/xxx/xxx | Request Count: XX | Response Count: XX | Serialization Format: XX
Service: /xxx/xxx | Type: xxx/xxx/xxx | Request Count: XX | Response Count: XX | Serialization Format: XX
```

### Expand the 'play' command

Add 2 parameters.
Expand Down

0 comments on commit 13effd3

Please sign in to comment.