From f28ff78355179376b63ca8037d02655d9eca0712 Mon Sep 17 00:00:00 2001 From: bpapaspyros Date: Thu, 5 Dec 2024 13:17:02 +0100 Subject: [PATCH] fix: thrown CoreException if node is not initialized when adding tf --- source/modulo_controllers/src/BaseControllerInterface.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/modulo_controllers/src/BaseControllerInterface.cpp b/source/modulo_controllers/src/BaseControllerInterface.cpp index 795e5466..f9b966b4 100644 --- a/source/modulo_controllers/src/BaseControllerInterface.cpp +++ b/source/modulo_controllers/src/BaseControllerInterface.cpp @@ -6,6 +6,7 @@ #include +#include #include template @@ -542,6 +543,10 @@ void BaseControllerInterface::add_service( } void BaseControllerInterface::add_tf_listener() { + if (this->get_node() == nullptr) { + throw modulo_core::exceptions::CoreException("Failed to add TF buffer and listener: Node is not initialized yet."); + } + if (this->tf_buffer_ == nullptr || this->tf_listener_ == nullptr) { RCLCPP_DEBUG(this->get_node()->get_logger(), "Adding TF buffer and listener."); console_bridge::setLogLevel(console_bridge::CONSOLE_BRIDGE_LOG_NONE);