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 : get clients, servers info #2569

Open
wants to merge 1 commit into
base: rolling
Choose a base branch
from

Conversation

leeminju531
Copy link
Contributor

Add get clients, servers info

Refer to ros2/ros2cli#916

@leeminju531
Copy link
Contributor Author

* \throws std::runtime_error if internal error happens.
*/
RCLCPP_PUBLIC
std::vector<rclcpp::TopicEndpointInfo>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost same comment for rclpy.

probably we can extend EndpointType with service server and client as endpoint types.
and introduce new base class EndpointInfo, and based on that we could have TopicEndpointInfo and ServiceEndpointInfo classes here?

Comment on lines -667 to +668
FunctionT rcl_get_info_by_topic)
bool is_service,
FunctionT rcl_get_info_by_topic_or_service)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we extend this function to support endpoint based on EndpointTypes with topics, services (and actions in the future?) there is already the template based on EndpointTypes so extend EndpointTypes with service types makes this function more generic like get_info_by_endpoint?

EXPECT_TRUE(node->get_clients_info_by_service(fq_service_name).empty());
EXPECT_TRUE(node->get_servers_info_by_service(fq_service_name).empty());

// Add a publisher
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
// Add a publisher
// Add a client

auto client = node->create_client<test_msgs::srv::Empty>(service_name, qos);
// Wait for the underlying RMW implementation to catch up with graph changes
auto client_is_generated =
[&]() {return node->get_clients_info_by_service(fq_service_name).size() > 0u;};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[&]() {return node->get_clients_info_by_service(fq_service_name).size() > 0u;};
[&]() {return node->get_clients_info_by_service(fq_service_name).size() == 1u;};

}
}

// Add a subscription
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
// Add a subscription
// Add a service server

auto server = node->create_service<test_msgs::srv::Empty>(service_name, callback, qos2);
// Wait for the underlying RMW implementation to catch up with graph changes
auto server_is_generated =
[&]() {return node->get_servers_info_by_service(fq_service_name).size() > 0u;};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

precisely this should be 1, right? is there any possibility that goes over 1?

Suggested change
[&]() {return node->get_servers_info_by_service(fq_service_name).size() > 0u;};
[&]() {return node->get_servers_info_by_service(fq_service_name).size() == 1u;};

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.

2 participants