ros2 / rmw

The ROS Middleware (rmw) Interface.
Apache License 2.0
95 stars 69 forks source link

Extend `names_and_types` to contain type hashes #356

Open emersonknapp opened 1 year ago

emersonknapp commented 1 year ago

Feature request

Feature description

REP-2016 type hashes now exist and are passed during discovery for the 3 DDS implementations, but are only exposed through rmw_topic_endpoint_info_t, which is given by get_publishers_info_by_topic/get_subscriptions_info_by_topic, but otherwise is not exposed.

When querying information about a node rather than a topic, one generally uses rmw_get_publisher_names_and_types_by_node(etc) which returns the topic name and typename, but does have access to the type hash, which it would be appropriate to return in these functions, making it easier to then query information about those topics.

Implementation considerations

This probably looks like:

typedef struct RMW_PUBLIC_TYPE rmw_names_and_types_s
{
  /// Array of names
  rcutils_string_array_t names;

  /// Dynamic array of arrays of type names, with the same length as `names`
  rcutils_string_array_t * types;

  /// NEW FIELD
  /// Dynamic array of type hashes, with the same length as `names`
  rosidl_type_hash_t * type_hashes;
} rmw_names_and_types_t;

And then will require filling out this information in all names_and_types APIs.

This would be ABI-breaking, so probably can only be planned for Jazzy.

wjwwood commented 1 year ago

Makes sense to me, basically anywhere we have the type of a topic we should have the hash.

fujitatomoya commented 1 year ago

sounds good to me.