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

fix issue with callbacks not firing in demo apps #7

Merged
merged 1 commit into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions rclcpp/include/rclcpp/strategies/allocator_memory_strategy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,6 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy
if (!group || !group->can_be_taken_from().load()) {
continue;
}
for (auto & weak_publisher : group->get_publisher_ptrs()) {
auto publisher = weak_publisher.lock();
if (publisher) {
for (auto & publisher_event : publisher->get_event_handlers()) {
waitable_handles_.push_back(publisher_event);
}
}
}
for (auto & weak_subscription : group->get_subscription_ptrs()) {
auto subscription = weak_subscription.lock();
if (subscription) {
Expand All @@ -180,9 +172,6 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy
subscription_handles_.push_back(
subscription->get_intra_process_subscription_handle());
}
for (auto & subscription_event : subscription->get_event_handlers()) {
waitable_handles_.push_back(subscription_event);
}
}
}
for (auto & weak_service : group->get_service_ptrs()) {
Expand Down
16 changes: 12 additions & 4 deletions rclcpp/src/rclcpp/node_interfaces/node_topics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ NodeTopics::add_publisher(
if (!node_base_->callback_group_in_node(callback_group)) {
throw std::runtime_error("Cannot create publisher, callback group not in node.");
}
callback_group->add_publisher(publisher);
} else {
node_base_->get_default_callback_group()->add_publisher(publisher);
callback_group = node_base_->get_default_callback_group();
}

callback_group->add_publisher(publisher);
for (auto & publisher_event : publisher->get_event_handlers()) {
callback_group->add_waitable(publisher_event);
}

// Notify the executor that a new publisher was created using the parent Node.
Expand Down Expand Up @@ -122,9 +126,13 @@ NodeTopics::add_subscription(
// TODO(jacquelinekay): use custom exception
throw std::runtime_error("Cannot create subscription, callback group not in node.");
}
callback_group->add_subscription(subscription);
} else {
node_base_->get_default_callback_group()->add_subscription(subscription);
callback_group = node_base_->get_default_callback_group();
}

callback_group->add_subscription(subscription);
for (auto & subscription_event : subscription->get_event_handlers()) {
callback_group->add_waitable(subscription_event);
}

// Notify the executor that a new subscription was created using the parent Node.
Expand Down