Skip to content

Commit

Permalink
Add message definitions for service events
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Perron <[email protected]>
  • Loading branch information
jacobperron committed Jun 22, 2022
1 parent 2a6bf3b commit 31302a7
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rcl_interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ endif()
find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(unique_identifier_msgs REQUIRED)

rosidl_generate_interfaces(${PROJECT_NAME}
"msg/FloatingPointRange.msg"
Expand All @@ -25,14 +26,16 @@ rosidl_generate_interfaces(${PROJECT_NAME}
"msg/Parameter.msg"
"msg/ParameterType.msg"
"msg/ParameterValue.msg"
"msg/ServiceEvent.msg"
"msg/ServiceEventType.msg"
"msg/SetParametersResult.msg"
"srv/DescribeParameters.srv"
"srv/GetParameters.srv"
"srv/GetParameterTypes.srv"
"srv/ListParameters.srv"
"srv/SetParametersAtomically.srv"
"srv/SetParameters.srv"
DEPENDENCIES builtin_interfaces
DEPENDENCIES builtin_interfaces unique_identifier_msgs
)

install(FILES mapping_rules.yaml DESTINATION share/${PROJECT_NAME})
Expand Down
20 changes: 20 additions & 0 deletions rcl_interfaces/msg/ServiceEvent.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# The type of event this message represents
# See ServiceEventType for possible values
uint8 event_type

# Timestamp for when the event occurred (sent or received time)
builtin_interfaces/Time stamp

# Unique identifier for the client that sent the service request
# Note, this is only unique for the current session
unique_identifier_msgs/UUID client_id

# Sequence number for the request
# Combined with the client ID, this creates a unique ID for the service transaction
int64 sequence_number

string service_name
string request_type_name
string response_type_name
byte[] serialized_request
byte[] serialized_response

This comment has been minimized.

Copy link
@ihasdapie

ihasdapie Jun 23, 2022

Member

I think it makes more sense to have it as

string event_type_name
byte[] serialized_event

to save the implementation (and users) from doing two NULL checks to deserialize the content. That is, unless we offer a deserialize_service_introspection_message method of some sorts.

Unless I'm missing something, separating the request and response types in this message when we're already treating it as a blob that must be serialized/deserialized just seems like extra steps for little benefit; the additional information we get from splitting them up is already captured in event_type

This comment has been minimized.

Copy link
@jacobperron

jacobperron Jun 23, 2022

Author Member

Makes sense to me 👍

14 changes: 14 additions & 0 deletions rcl_interfaces/msg/ServiceEventType.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# An enumeration of service event types
# These are used to set the type value in ServiceEvent messages

# A service request was sent by a client
uint8 REQUEST_SENT=0

# A service request was recieved by a service
uint8 REQUEST_RECEIVED=1

# A service response was sent by a service
uint8 RESPONSE_SENT=2

# A service response was received by a client
uint8 RESPONSE_RECEIVED=3
1 change: 1 addition & 0 deletions rcl_interfaces/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<buildtool_depend>rosidl_default_generators</buildtool_depend>

<depend>builtin_interfaces</depend>
<depend>unique_identifier_msgs</depend>

<exec_depend>rosidl_default_runtime</exec_depend>

Expand Down

0 comments on commit 31302a7

Please sign in to comment.