Skip to content

Implement generic service#2617

Merged
fujitatomoya merged 5 commits intoros2:rollingfrom
Barry-Xu-2018:review/topic-add-generic-service
Sep 12, 2024
Merged

Implement generic service#2617
fujitatomoya merged 5 commits intoros2:rollingfrom
Barry-Xu-2018:review/topic-add-generic-service

Conversation

@Barry-Xu-2018
Copy link
Copy Markdown
Collaborator

Implement generic service.

Signed-off-by: Barry Xu <barry.xu@sony.com>
@Barry-Xu-2018 Barry-Xu-2018 changed the title Implement generic service [Draft] Implement generic service Sep 2, 2024
@Barry-Xu-2018 Barry-Xu-2018 changed the title [Draft] Implement generic service Draft: Implement generic service Sep 2, 2024
Signed-off-by: Barry Xu <barry.xu@sony.com>
@Barry-Xu-2018
Copy link
Copy Markdown
Collaborator Author

Thanks your comments @ahcorde.
1302ec2 addressed them

@Barry-Xu-2018 Barry-Xu-2018 marked this pull request as ready for review September 3, 2024 08:43
@Barry-Xu-2018 Barry-Xu-2018 changed the title Draft: Implement generic service Implement generic service Sep 3, 2024
@fujitatomoya fujitatomoya self-assigned this Sep 6, 2024
@ahcorde
Copy link
Copy Markdown
Contributor

ahcorde commented Sep 9, 2024

Pulls: #2617
Gist: https://gist.githubusercontent.com/ahcorde/351d83bd6e85d7c7342a43711242b288/raw/ffb05640e54acb8bba002cfed6682a39b8fadf1a/ros2.repos
BUILD args: --packages-up-to rclcpp --packages-above-and-dependencies rclcpp
TEST args: --packages-select rclcpp --packages-above rclcpp
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/14541

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

Copy link
Copy Markdown
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

Windows is not compiling

13:38:54 C:\ci\ws\src\Barry-Xu-2018\rclcpp\rclcpp\include\rclcpp/create_generic_service.hpp(48,1): error C2491: 'rclcpp::create_generic_service': definition of dllimport function not allowed [C:\ci\ws\build\rclcpp\test\rclcpp\test_wait_set.vcxproj]

13:38:54 C:\ci\ws\src\Barry-Xu-2018\rclcpp\rclcpp\include\rclcpp/create_generic_service.hpp(87,1): error C2491: 'rclcpp::create_generic_service': definition of dllimport function not allowed [C:\ci\ws\build\rclcpp\test\rclcpp\test_wait_set.vcxproj]

Signed-off-by: Barry Xu <barry.xu@sony.com>
Signed-off-by: Barry Xu <barry.xu@sony.com>
@Barry-Xu-2018
Copy link
Copy Markdown
Collaborator Author

Re-run CI on Windows

  • Windows Build Status

Signed-off-by: Barry Xu <barry.xu@sony.com>
@Barry-Xu-2018
Copy link
Copy Markdown
Collaborator Author

Re-run CI on Windows after fixing compiling error

Re-run CI on Windows

  • Windows Build Status

@ahcorde
Copy link
Copy Markdown
Contributor

ahcorde commented Sep 11, 2024

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@ahcorde
Copy link
Copy Markdown
Contributor

ahcorde commented Sep 11, 2024

@fujitatomoya, you self assigned this PR for review, do you have something to add ?

@fujitatomoya
Copy link
Copy Markdown
Collaborator

yes, i am going to take a look at this in today.

Copy link
Copy Markdown
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

@Barry-Xu-2018 ltgm but i have a few comments. could you check thek?

});
*service_handle_.get() = rcl_get_zero_initialized_service();

rcl_ret_t ret = rcl_service_init(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not directly related to this PR but future refactoring. I think rcl_service_init and rcl_client_init can be called in ServiceBase and ClientBase to avoid redundant code, that actually aligns with Publisher and Subscription class implementation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes.
I will consider optimizing this part of the code. If there are no issues, I will create a PR for the client code.

Comment on lines +47 to +53
} catch (std::runtime_error & err) {
RCLCPP_ERROR(
rclcpp::get_node_logger(node_handle_.get()).get_child("rclcpp"),
"Invalid service type: %s",
err.what());
throw rclcpp::exceptions::InvalidServiceTypeError(err.what());
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Dose this need to be added to the constructor of GenericClient?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes. I think so.
I will create a PR for GenericClient.

using SharedRequest = std::shared_ptr<void>;
using SharedResponse = std::shared_ptr<void>;

GenericServiceCallback()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Instead of having this class, could we extend the AnyServiceCallback and have it as a member variable under GenericService class? this does not block the PR but can be future refactoring?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I haven't figured out how to extend AnyServiceCallback for use in GenericService yet.
GenericServiceCallback should consider how to merge with AnyServiceCallback to reduce redundant code.

@ahcorde
Copy link
Copy Markdown
Contributor

ahcorde commented Sep 12, 2024

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

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.

4 participants