Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetTypeDescription.srv (rep2011) #153

7 changes: 5 additions & 2 deletions type_description_interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
)

Expand Down
4 changes: 4 additions & 0 deletions type_description_interfaces/msg/KeyValue.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Represents an arbitrary key-value pair for application-specific information.

string key
string value
16 changes: 16 additions & 0 deletions type_description_interfaces/msg/TypeSource.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Represents the original source of a ROS 2 interface definition.

uint8 ENCODING_NOT_SET = 0
uint8 ENCODING_MSG = 1
uint8 ENCODING_SRV = 2
uint8 ENCODING_ACTION = 3
uint8 ENCODING_IDL = 4

# ROS interface type name, in PACKAGE/NAMESPACE/TYPENAME format
string type_name

# The type of the original source file, from the above constants
uint8 encoding
emersonknapp marked this conversation as resolved.
Show resolved Hide resolved

# Dumped contents of the interface definition source file
string raw_file_contents
emersonknapp marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions type_description_interfaces/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

<buildtool_depend>rosidl_core_generators</buildtool_depend>

<depend>service_msgs</depend>

<exec_depend>rosidl_core_runtime</exec_depend>

<test_depend>ament_lint_auto</test_depend>
Expand Down
36 changes: 36 additions & 0 deletions type_description_interfaces/srv/GetTypeDescription.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# ROS interface type name, in PACKAGE/NAMESPACE/TYPENAME format
string type_name

# REP-2011 RIHS hash string, which looks like RIHSxx_hashvalue
string type_hash

# Whether to return the original idl or msg file(s) in the response, if available
bool include_type_sources true
---
# sources requested, and provided successfully
uint8 SOURCES_REQUESTED_PROVIDED = 0
# sources disabled, so type_sources was left empty
uint8 SOURCES_NOT_REQUESTED_NOT_PROVIDED = 1
# sources requested, but no source available (perhaps for dynamically created types)
uint8 SOURCES_REQUESTED_NOT_AVAILABLE = 2

# True if the type description information is available and populated in the response
emersonknapp marked this conversation as resolved.
Show resolved Hide resolved
# If false, all other fields except `reason` are considered undefined
bool successful
# If `successful` is false, contains a reason for failure.
# On success, may contain a reason for missing sources.
string reason

# Contains a value from above constants, explaining whether the
# `type_sources` fields contain valid data.
uint8 type_sources_result
emersonknapp marked this conversation as resolved.
Show resolved Hide resolved

# List of idl or msg/srv/action source files, including all comments and whitespace.
# Sources can be matched with IndividualTypeDescriptions by their type_name
TypeSource[] type_sources

# The parsed type description which can be used programmatically
TypeDescription type_description

# Key-value pairs of extra information.
KeyValue[] extra_information