diff --git a/type_description_interfaces/CMakeLists.txt b/type_description_interfaces/CMakeLists.txt index e860c778..c3ac72bf 100644 --- a/type_description_interfaces/CMakeLists.txt +++ b/type_description_interfaces/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.5) project(type_description_interfaces) -# Default to C++14 +# Default to C++17 if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD 17) endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) @@ -19,7 +19,10 @@ rosidl_generate_interfaces(${PROJECT_NAME} "msg/Field.msg" "msg/FieldType.msg" "msg/IndividualTypeDescription.msg" + "msg/KeyValue.msg" "msg/TypeDescription.msg" + "msg/TypeSource.msg" + "srv/GetTypeDescription.srv" ADD_LINTER_TESTS ) diff --git a/type_description_interfaces/msg/KeyValue.msg b/type_description_interfaces/msg/KeyValue.msg new file mode 100644 index 00000000..b06a1617 --- /dev/null +++ b/type_description_interfaces/msg/KeyValue.msg @@ -0,0 +1,4 @@ +# Represents an arbitrary key-value pair for application-specific information. + +string key +string value diff --git a/type_description_interfaces/msg/TypeSource.msg b/type_description_interfaces/msg/TypeSource.msg new file mode 100644 index 00000000..7c945270 --- /dev/null +++ b/type_description_interfaces/msg/TypeSource.msg @@ -0,0 +1,16 @@ +# Represents the original source of a ROS 2 interface definition. + +# ROS interface type name, in PACKAGE/NAMESPACE/TYPENAME format. +string type_name + +# The type of the original source file, typically matching the file extension. +# Well-known encodings: "idl", "msg", "srv", "action", "dynamic", "implicit". +# "dynamic" specifies a type created programmatically by a user, thus having no source. +# "implicit" specifies a type created automatically as a subtype of a +# complex type (service or action) - such as the request message for a service. +# Implicit types will have no contents, the full source will be available on the parent srv/action. +string encoding + +# Dumped contents of the interface definition source file. +# If `encoding` is "dynamic" or "implicit", this field will be empty. +string raw_file_contents diff --git a/type_description_interfaces/package.xml b/type_description_interfaces/package.xml index dd3fe970..f3fd1e14 100644 --- a/type_description_interfaces/package.xml +++ b/type_description_interfaces/package.xml @@ -13,6 +13,8 @@ rosidl_core_generators + service_msgs + rosidl_core_runtime ament_lint_auto diff --git a/type_description_interfaces/srv/GetTypeDescription.srv b/type_description_interfaces/srv/GetTypeDescription.srv new file mode 100644 index 00000000..9d34d0d0 --- /dev/null +++ b/type_description_interfaces/srv/GetTypeDescription.srv @@ -0,0 +1,29 @@ +# ROS interface type name, in PACKAGE/NAMESPACE/TYPENAME format. +string type_name + +# REP-2011 RIHS hash string. +string type_hash + +# Whether to return the original idl/msg/etc. source file(s) in the response. +bool include_type_sources true +--- +# True if the type description information is available and populated in the response. +# If false, all other fields except `failure_reason` are considered undefined. +bool successful +# If `successful` is false, contains a reason for failure. +# If `successful` is true, this is left empty. +string failure_reason + +# The parsed type description which can be used programmatically. +TypeDescription type_description + +# A list containing the interface definition source text of the requested type, +# plus all types it recursively depends on. +# Each source text is a copy of the original contents of the +# .msg, .srv, .action, .idl, or other file if it exists, including comments and whitespace. +# Sources can be matched with IndividualTypeDescriptions by their `type_name`. +# The `encoding` field of each entry informs how to interpret its contents. +TypeSource[] type_sources + +# Key-value pairs of extra information. +KeyValue[] extra_information