Skip to content

Conversation

leeminju531
Copy link

Add get_clients_info_by_service and get_servers_info_by_service; Introduce ServiceEntityInfo to handle service type hash in graph cache

Description

This is the sub-process to support ros2/ros2cli#916 and originates from a comment in ros2/rmw#371 (comment).

Is this user-facing behavior change?

Yes, but the impact is limited. The add_entity function has been extended to include an optional service_type_hash parameter with a default value of nullptr:

  bool
  add_entity(
    const rmw_gid_t & gid,
    const std::string & topic_name,
    const std::string & type_name,
    const rosidl_type_hash_t & type_hash,
    const rmw_gid_t & participant_gid,
    const rmw_qos_profile_t & qos,
    bool is_reader,
    const rosidl_type_hash_t * service_type_hash = nullptr

At the rcl layer, this change is backward-compatible, so users do not need to modify their code. However, at the rclpy layer, refactoring is required due to the renaming of TopicEndpointTypeEnum to EndpointTypeEnum and associated file changes. The rclcpp layer is unaffected, as it already uses EndpointType.

Did you use Generative AI?

Used for refining comments. (GPT-4o)

Additional Information

The following features were added.

  • Added get_clients_info_by_service and get_servers_info_by_service to the graph cache, which use reader and writer information from service request and reply topics to populate service endpoint information.
  • A new structure, ServiceEntityInfo, was introduced to manage service-related information in the graph cache, including the service_type_hash. It is stored in a std::map<rmw_gid_t, ServiceEntityInfo, Compare_rmw_gid_t> with the entity GID, representing the reader and writer endpoints of the service, as the key.
  • Service Type Hash Handling: The add_entity, add_reader, and add_writer functions now accept a service_type_hash pointer. When an entity is part of a service, this parameter must be provided. The service_type_hash is discovered during the DDS discovery process using parse_sertype_hash_from_user_data and encoded for QoS settings via encode_sertype_hash_for_user_data_qos.

…oduce ServiceEntityInfo to handle service type hash in graph cache

Signed-off-by: Minju, Lee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant