From 31302a7c9915c2b1030d510a5aab649f1fc9c4d8 Mon Sep 17 00:00:00 2001 From: Jacob Perron Date: Wed, 22 Jun 2022 01:56:39 -0700 Subject: [PATCH] Add message definitions for service events Signed-off-by: Jacob Perron --- rcl_interfaces/CMakeLists.txt | 5 ++++- rcl_interfaces/msg/ServiceEvent.msg | 20 ++++++++++++++++++++ rcl_interfaces/msg/ServiceEventType.msg | 14 ++++++++++++++ rcl_interfaces/package.xml | 1 + 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 rcl_interfaces/msg/ServiceEvent.msg create mode 100644 rcl_interfaces/msg/ServiceEventType.msg diff --git a/rcl_interfaces/CMakeLists.txt b/rcl_interfaces/CMakeLists.txt index 8ed4e198..c04ae4a3 100644 --- a/rcl_interfaces/CMakeLists.txt +++ b/rcl_interfaces/CMakeLists.txt @@ -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" @@ -25,6 +26,8 @@ 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" @@ -32,7 +35,7 @@ rosidl_generate_interfaces(${PROJECT_NAME} "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}) diff --git a/rcl_interfaces/msg/ServiceEvent.msg b/rcl_interfaces/msg/ServiceEvent.msg new file mode 100644 index 00000000..f67a38f7 --- /dev/null +++ b/rcl_interfaces/msg/ServiceEvent.msg @@ -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 diff --git a/rcl_interfaces/msg/ServiceEventType.msg b/rcl_interfaces/msg/ServiceEventType.msg new file mode 100644 index 00000000..7f0176b7 --- /dev/null +++ b/rcl_interfaces/msg/ServiceEventType.msg @@ -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 diff --git a/rcl_interfaces/package.xml b/rcl_interfaces/package.xml index 89edeaeb..91fb4461 100644 --- a/rcl_interfaces/package.xml +++ b/rcl_interfaces/package.xml @@ -19,6 +19,7 @@ rosidl_default_generators builtin_interfaces + unique_identifier_msgs rosidl_default_runtime