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

Allow subscribing without template parameter #544

Closed
Martin-Idel-SI opened this issue Aug 28, 2018 · 4 comments
Closed

Allow subscribing without template parameter #544

Martin-Idel-SI opened this issue Aug 28, 2018 · 4 comments
Labels
enhancement New feature or request

Comments

@Martin-Idel-SI
Copy link

Feature request

Feature description

Currently, we can only subscribe to a topic via node->create_subscription<MessageT>(<topic_name>, <callback>) or similar calls. This requires the topic type to be known at compile time.

It would be great to have a way to create a subscription without this template, passing type support into the subscription creation manually.

Use Case: This would help us in rosbag2, where we need to subscribe to all available topics which we obviously don't know at compile time.

@dirk-thomas dirk-thomas added the enhancement New feature or request label Aug 28, 2018
@wjwwood
Copy link
Member

wjwwood commented Sep 6, 2018

Why isn't the template type rmw_serialized_message_t or a similar type?

@wjwwood
Copy link
Member

wjwwood commented Sep 6, 2018

Or asked a different way, what would the signature of the callback for the subscription look like, currently it is something like:

using ConstSharedPtrWithInfoCallback =
std::function<void (const std::shared_ptr<const MessageT>, const rmw_message_info_t &)>;

@Martin-Idel-SI
Copy link
Author

Martin-Idel-SI commented Sep 10, 2018

The signature of the callback would then have to be std::function<void(const std::shared_ptr<rmw_serialized_msg_t>)> or similar.

I don't particularly care for create_subscription to be non-templated, I'm just working in a case where the exact type is unknown at compile-time. If there was a template specialisation for create_subscription with rmw_serialized_message_t where typesupport or type identifier were added manually I'd be happy, too.

@Karsten1987
Copy link
Contributor

After quite some time, I am happy to close this ticket with #1452

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants