Skip to content

Make sick safetyscanners2 compatible with composition #59

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

JinyongJeong-Riibotics
Copy link

Purpose of this PR

The current driver does not support zero-copy intra-process communication (IPC) when used as a composed component.
This pull request introduces the required modifications to enable composition-friendly, zero-copy operation.

Key Changes

  1. Constructor Signature
    The primary constructor now accepts rclcpp::NodeOptions, ensuring the driver can be instantiated as a composable node.

  2. Component Registration
    The node is registered with rclcpp_components_register_node, allowing it to be loaded dynamically into a component container.

  3. Subscriber Count Check
    Before each publish, the driver verifies that at least one subscriber is connected, eliminating unnecessary work when no consumers are present.

  4. Zero-Copy Publishing
    Message data are created and published as std::unique_ptr objects.
    In environments where IPC is enabled, this enables true zero-copy transfer; when IPC is disabled, behavior remains identical to standard publishing.

  5. Reduced Copy Overhead
    Internal data structures are generated directly into unique_ptr instances, minimizing intermediate copies and improving performance.

Maintainer Guidance

These changes, particularly the revised constructor, introduce breaking API differences.
If the new interface or zero-copy assumptions conflict with the project’s roadmap, please let me know. I will close this PR rather than disrupt the main branch.

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