Implements a first pass at ros2 node get_type_description. It does its best to autofill the type hash so the user doesn't have to, but given the limitations of the current API this is only possible for msg on pub/sub topics, not for srv/action. For those, the hash must be provided manually by the user, though it is not discoverable via any existing API.
Sample output:
$ ros2 node get-type-description /talker rcl_interfaces/msg/Log
Waiting for service to become available...
Requesting type hash RIHS01_e28ce254ca8abc06abf92773b74602cdbf116ed34fbaf294fb9f81da9f318eac
Sending request...
Response successful:
rcl_interfaces/msg/Log
Fields:
stamp: FIELD_TYPE_NESTED_TYPE (builtin_interfaces/msg/Time)
level: FIELD_TYPE_UINT8
name: FIELD_TYPE_STRING
msg: FIELD_TYPE_STRING
file: FIELD_TYPE_STRING
function: FIELD_TYPE_STRING
line: FIELD_TYPE_UINT32
Referenced Type Descriptions:
builtin_interfaces/msg/Time
Fields:
sec: FIELD_TYPE_INT32
nanosec: FIELD_TYPE_UINT32
I think we should move forward with putting this in, as it covers the majority use case. Further discussion follows:
It's awkward that we need to get names_and_types, then use that to go to get_x_info_by_topic in order to get TopicEndpointInfo to find the hash. https://github.com/ros2/rmw/issues/356 would make this part easier and support srv/action
The fact that we need to do this graph-munging to "discover" the hash for a typename seems unnecessary. Given that a specific node has a 1:1 relationship of type name and type hash, it seems like GetTypeDescription should allow for either (but not both) to be empty in the request, so that the requesting client doesn't necessarily even need to know both pieces of information. From a user point of view, it seems very natural to say "you node, give me your description for mypackage/msg/Foo". It also seems like it could come up, though less commonly, to request "you node, what is the type that has hash RIHS01_e28ce254ca8abc06abf92773b74602cdbf116ed34fbaf294fb9f81da9f318eac". The current underlying implementation in rcl assumes the hash is the more important piece of information, using it as the key to its cache, but this usage reveals that it's probably more likely we wish to fetch this information by typename, using the hash as a potential validation. HOWEVER - all that aside, with https://github.com/ros2/rmw/issues/356 the "discovery" would be much simpler and so alleviate some of my concern with this point.
Replaces https://github.com/ros2/ros2cli/pull/817
Implements a first pass at
ros2 node get_type_description
. It does its best to autofill the type hash so the user doesn't have to, but given the limitations of the current API this is only possible formsg
on pub/sub topics, not for srv/action. For those, the hash must be provided manually by the user, though it is not discoverable via any existing API.Sample output:
I think we should move forward with putting this in, as it covers the majority use case. Further discussion follows:
names_and_types
, then use that to go toget_x_info_by_topic
in order to getTopicEndpointInfo
to find the hash. https://github.com/ros2/rmw/issues/356 would make this part easier and support srv/actionGetTypeDescription
should allow for either (but not both) to be empty in the request, so that the requesting client doesn't necessarily even need to know both pieces of information. From a user point of view, it seems very natural to say "you node, give me your description for mypackage/msg/Foo". It also seems like it could come up, though less commonly, to request "you node, what is the type that has hash RIHS01_e28ce254ca8abc06abf92773b74602cdbf116ed34fbaf294fb9f81da9f318eac". The current underlying implementation inrcl
assumes the hash is the more important piece of information, using it as the key to its cache, but this usage reveals that it's probably more likely we wish to fetch this information by typename, using the hash as a potential validation. HOWEVER - all that aside, with https://github.com/ros2/rmw/issues/356 the "discovery" would be much simpler and so alleviate some of my concern with this point.