Skip to content

Commit d2dab49

Browse files
committed
fix minor failures
Signed-off-by: Alberto Soragna <[email protected]>
1 parent dd0cd98 commit d2dab49

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

rclcpp/include/rclcpp/subscription.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ class Subscription : public SubscriptionBase
171171

172172
// First create a SubscriptionIntraProcess which will be given to the intra-process manager.
173173
auto context = node_base->get_context();
174+
using SubscriptionIntraProcessT = rclcpp::experimental::SubscriptionIntraProcess<
175+
CallbackMessageT,
176+
AllocatorT,
177+
typename MessageUniquePtr::deleter_type>;
174178
subscription_intra_process_ = std::make_shared<SubscriptionIntraProcessT>(
175179
callback,
176180
options.get_allocator(),

rclcpp/include/rclcpp/subscription_base.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,13 @@ class SubscriptionBase : public std::enable_shared_from_this<SubscriptionBase>
374374
return;
375375
}
376376

377-
// The on_ready_callback signature has an extra `int` argument used to disambiguate between
377+
if (!callback) {
378+
throw std::invalid_argument(
379+
"The callback passed to set_on_new_intra_process_message_callback "
380+
"is not callable.");
381+
}
382+
383+
// The on_ready_callback signature has an extra `int` argument used to disambiguate between
378384
// possible different entities within a generic waitable.
379385
// We hide that detail to users of this method.
380386
std::function<void(size_t, int)> new_callback = std::bind(callback, std::placeholders::_1);
@@ -435,7 +441,7 @@ class SubscriptionBase : public std::enable_shared_from_this<SubscriptionBase>
435441
bool use_intra_process_;
436442
IntraProcessManagerWeakPtr weak_ipm_;
437443
uint64_t intra_process_subscription_id_;
438-
std::shared_ptr<SubscriptionIntraProcessBase> subscription_intra_process_;
444+
std::shared_ptr<rclcpp::experimental::SubscriptionIntraProcessBase> subscription_intra_process_;
439445

440446
private:
441447
RCLCPP_DISABLE_COPY(SubscriptionBase)

rclcpp/test/rclcpp/test_subscription.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ TEST_F(TestSubscription, on_new_message_callback) {
448448
using test_msgs::msg::Empty;
449449

450450
auto do_nothing = [](std::shared_ptr<const test_msgs::msg::Empty>) {FAIL();};
451-
auto sub = node->create_subscription<test_msgs::msg::Empty>("~/test_take", 1, do_nothing);
451+
auto sub = node->create_subscription<test_msgs::msg::Empty>("~/test_take", 10, do_nothing);
452452

453453
std::atomic<size_t> c1 {0};
454454
auto increase_c1_cb = [&c1](size_t count_msgs) {c1 += count_msgs;};
@@ -518,7 +518,7 @@ TEST_F(TestSubscription, on_new_intra_process_message_callback) {
518518
using test_msgs::msg::Empty;
519519

520520
auto do_nothing = [](std::shared_ptr<const test_msgs::msg::Empty>) {FAIL();};
521-
auto sub = node->create_subscription<test_msgs::msg::Empty>("~/test_take", 1, do_nothing);
521+
auto sub = node->create_subscription<test_msgs::msg::Empty>("~/test_take", 10, do_nothing);
522522

523523
std::atomic<size_t> c1 {0};
524524
auto increase_c1_cb = [&c1](size_t count_msgs) {c1 += count_msgs;};

0 commit comments

Comments
 (0)