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

create subscriber with message memory strategy #98

Open
Derekglk opened this issue Jun 15, 2023 · 1 comment
Open

create subscriber with message memory strategy #98

Derekglk opened this issue Jun 15, 2023 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@Derekglk
Copy link

Hello,

My ROS2 node subscribes to two topics (left_image and right_image), and has a message filter (sync_exact policy) to get sychronized data.

Now I'm working on a custom memory allocator (following this tutorial), and in this example an rclcpp::message_memory_strategy has to be specified when creating the node subsription.

rclcpp::SubscriptionOptionsWithAllocator<Alloc> subscription_options;
auto msg_mem_strat = std::make_shared<rclcpp::message_memory_strategy::MessageMemoryStrategy<
       std_msgs::msg::UInt32, Alloc>>(alloc);
auto subscriber = node->create_subscription<std_msgs::msg::UInt32>(
       "allocator_tutorial", 10, callback, subscription_options, msg_mem_strat);

However I can't find a constructor in message_filters::Subscriber which takes message memory strategy as input.
This is what I have right now, and should be changed to using custom memory allocator.

message_filters::Subscriber<sensor_msgs::msg::Image> left_img;  
message_filters::Subscriber<sensor_msgs::msg::Image> right_img;   
std::shared_ptr<message_filters::Synchronizer<exact_policy>> syncExact;
left_img.subscribe(this, left_topic, custom_qos_profile);
right_img.subscribe(this, right_topic, custom_qos_profile);
syncExact = std::make_shared<message_filters::Synchronizer<exact_policy>>(exact_policy(10), left_img, right_img);  
syncExact->registerCallback(exact_sync_callback);

Am I following the right approach? How to specify the message memory strategy when using message filter?

Thank you very much!

Best Regards.

Derek

@Derekglk Derekglk changed the title create subsriber with message memory strategy create subscriber with message memory strategy Jun 15, 2023
@clalancette
Copy link
Contributor

This feature is likely missing from message_filters, so would need to be added. We probably won't work on this right now, but if you'd like to contribute a pull request we'd be happy to review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants