Skip to content

Commit

Permalink
Add option to enable unique network flow
Browse files Browse the repository at this point in the history
- Option enabled for publishers and subscriptions
- TODO: Discuss error handling if not supported

Signed-off-by: Ananya Muddukrishna <ananya.x.muddukrishna@ericsson.com>
  • Loading branch information
Ananya Muddukrishna committed Dec 8, 2020
1 parent 2e21673 commit fc6c364
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rclcpp/include/rclcpp/publisher_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ struct PublisherOptionsBase
/// Whether or not to use default callbacks when user doesn't supply any in event_callbacks
bool use_default_callbacks = true;

/// True to generate unique network flow
bool unique_network_flow = false;

/// Callback group in which the waitable items from the publisher should be placed.
std::shared_ptr<rclcpp::CallbackGroup> callback_group;

Expand Down Expand Up @@ -80,6 +83,7 @@ struct PublisherOptionsWithAllocator : public PublisherOptionsBase
auto message_alloc = std::make_shared<MessageAllocatorT>(*this->get_allocator().get());
result.allocator = rclcpp::allocator::get_rcl_allocator<MessageT>(*message_alloc);
result.qos = qos.get_rmw_qos_profile();
result.rmw_publisher_options.unique_network_flow = this->unique_network_flow;

// Apply payload to rcl_publisher_options if necessary.
if (rmw_implementation_payload && rmw_implementation_payload->has_been_customized()) {
Expand Down
4 changes: 4 additions & 0 deletions rclcpp/include/rclcpp/subscription_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ struct SubscriptionOptionsBase
/// True to ignore local publications.
bool ignore_local_publications = false;

/// True to generate unique network flow
bool unique_network_flow = false;

/// The callback group for this subscription. NULL to use the default callback group.
rclcpp::CallbackGroup::SharedPtr callback_group = nullptr;

Expand Down Expand Up @@ -108,6 +111,7 @@ struct SubscriptionOptionsWithAllocator : public SubscriptionOptionsBase
result.allocator = allocator::get_rcl_allocator<MessageT>(*message_alloc);
result.qos = qos.get_rmw_qos_profile();
result.rmw_subscription_options.ignore_local_publications = this->ignore_local_publications;
result.rmw_subscription_options.unique_network_flow = this->unique_network_flow;

// Apply payload to rcl_subscription_options if necessary.
if (rmw_implementation_payload && rmw_implementation_payload->has_been_customized()) {
Expand Down

0 comments on commit fc6c364

Please sign in to comment.