From 15c8cb4b0836123b8351ec96f932fa94846ec6be Mon Sep 17 00:00:00 2001 From: akilpath Date: Thu, 9 May 2024 22:06:53 +0000 Subject: [PATCH] Timer callback --- src/robot/control/include/control_node.hpp | 3 +++ src/robot/control/src/control_node.cpp | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/robot/control/include/control_node.hpp b/src/robot/control/include/control_node.hpp index ce4fe05..84539ec 100644 --- a/src/robot/control/include/control_node.hpp +++ b/src/robot/control/include/control_node.hpp @@ -19,6 +19,9 @@ class ControlNode : public rclcpp::Node { private: robot::ControlCore control_; + rclcpp::TimerBase::SharedPtr timer_; + void timer_callback(); + }; #endif diff --git a/src/robot/control/src/control_node.cpp b/src/robot/control/src/control_node.cpp index d921140..5ea9158 100644 --- a/src/robot/control/src/control_node.cpp +++ b/src/robot/control/src/control_node.cpp @@ -4,7 +4,11 @@ ControlNode::ControlNode(): Node("control"), control_(robot::ControlCore()) { - + timer_ = this->create_wall_timer(std::chrono::milliseconds(1500), std::bind(&ControlNode::timer_callback, this)); +} + +void ControlNode::timer_callback(){ + RCLCPP_INFO(this->get_logger(), "Timer callbakc"); } int main(int argc, char ** argv)