From 2e22a55e2c7bb59df8062341495607da044d093a Mon Sep 17 00:00:00 2001 From: jmachowinski Date: Fri, 12 Apr 2024 14:29:14 +0200 Subject: [PATCH] fix: Fixed compilation after API change of TimerBase::execute (#375) Signed-off-by: Janosch Machowinski Co-authored-by: Janosch Machowinski --- .../time_triggered_wait_set_subscriber.cpp | 4 +++- rclcpp/wait_set/src/wait_set_topics_and_timer.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/rclcpp/topics/minimal_subscriber/time_triggered_wait_set_subscriber.cpp b/rclcpp/topics/minimal_subscriber/time_triggered_wait_set_subscriber.cpp index 7b5d85dc..47e4dc78 100644 --- a/rclcpp/topics/minimal_subscriber/time_triggered_wait_set_subscriber.cpp +++ b/rclcpp/topics/minimal_subscriber/time_triggered_wait_set_subscriber.cpp @@ -71,7 +71,9 @@ class TimeTriggeredWaitSetSubscriber : public rclcpp::Node case rclcpp::WaitResultKind::Ready: { if (wait_result.get_wait_set().get_rcl_wait_set().timers[0U]) { - timer_->execute_callback(); + if (auto data = timer_->call()) { + timer_->execute_callback(data); + } } break; } diff --git a/rclcpp/wait_set/src/wait_set_topics_and_timer.cpp b/rclcpp/wait_set/src/wait_set_topics_and_timer.cpp index 3b61bf1b..fca6c37c 100644 --- a/rclcpp/wait_set/src/wait_set_topics_and_timer.cpp +++ b/rclcpp/wait_set/src/wait_set_topics_and_timer.cpp @@ -71,8 +71,10 @@ int32_t main(const int32_t argc, char ** const argv) const auto wait_result = wait_set.wait(2s); if (wait_result.kind() == rclcpp::WaitResultKind::Ready) { if (wait_result.get_wait_set().get_rcl_wait_set().timers[0U]) { - // The timer callback is executed manually here - one_off_timer->execute_callback(); + if (auto data = one_off_timer->call()) { + // The timer callback is executed manually here + one_off_timer->execute_callback(data); + } } else { std_msgs::msg::String msg; rclcpp::MessageInfo msg_info;