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

Adjust python usage of the type_description service API #1192

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions rclpy/src/rclpy/type_description_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,12 @@ namespace rclpy

TypeDescriptionService::TypeDescriptionService(Node & node)
{
rcl_ret_t ret = rcl_node_type_description_service_init(node.rcl_ptr());
auto srv_ptr = std::make_shared<rcl_service_t>();
rcl_ret_t ret = rcl_node_type_description_service_init(srv_ptr.get(), node.rcl_ptr());
if (RCL_RET_OK != ret) {
throw RCLError("Failed to initialize type description service");
}
rcl_service_t * srv_ptr = nullptr;
ret = rcl_node_get_type_description_service(node.rcl_ptr(), &srv_ptr);
if (RCL_RET_OK != ret) {
throw RCLError("Failed to retrieve type description service implementation");
}
std::shared_ptr<rcl_service_t> srv_shared(
srv_ptr,
[node](rcl_service_t * srv) {
(void)srv;
rcl_ret_t ret = rcl_node_type_description_service_fini(node.rcl_ptr());
if (RCL_RET_OK != ret) {
throw RCLError("Failed to finalize type description service");
}
});
service_ = std::make_shared<Service>(node, srv_shared);
service_ = std::make_shared<Service>(node, srv_ptr);
}

Service TypeDescriptionService::get_impl()
Expand Down