diff --git a/rclcpp/include/rclcpp/node.hpp b/rclcpp/include/rclcpp/node.hpp index 78d15b8..9a5901d 100644 --- a/rclcpp/include/rclcpp/node.hpp +++ b/rclcpp/include/rclcpp/node.hpp @@ -175,7 +175,7 @@ public: typename rclcpp::timer::WallTimer::SharedPtr create_wall_timer( std::chrono::nanoseconds period, - CallbackType && callback, + CallbackType callback, rclcpp::callback_group::CallbackGroup::SharedPtr group = nullptr); /// Create a timer. diff --git a/rclcpp/include/rclcpp/node_impl.hpp b/rclcpp/include/rclcpp/node_impl.hpp index 07d8384..877572c 100644 --- a/rclcpp/include/rclcpp/node_impl.hpp +++ b/rclcpp/include/rclcpp/node_impl.hpp @@ -274,11 +274,11 @@ template typename rclcpp::timer::WallTimer::SharedPtr Node::create_wall_timer( std::chrono::nanoseconds period, - CallbackType && callback, + CallbackType callback, rclcpp::callback_group::CallbackGroup::SharedPtr group) { auto timer = rclcpp::timer::WallTimer::make_shared( - period, std::forward(callback)); + period, std::move(callback)); if (group) { if (!group_in_node(group)) { // TODO(jacquelinekay): use custom exception diff --git a/rclcpp/include/rclcpp/timer.hpp b/rclcpp/include/rclcpp/timer.hpp index ea29396..9632a86 100644 --- a/rclcpp/include/rclcpp/timer.hpp +++ b/rclcpp/include/rclcpp/timer.hpp @@ -101,7 +101,7 @@ public: * \param[in] callback User-specified callback function. */ GenericTimer(std::chrono::nanoseconds period, FunctorT && callback) - : TimerBase(period), callback_(callback), loop_rate_(period) + : TimerBase(period), callback_(std::forward(callback)), loop_rate_(period) { /* Set last_triggered_time_ so that the timer fires at least one period after being created. */ last_triggered_time_ = Clock::now();