diff --git a/source/modulo_controllers/include/modulo_controllers/BaseControllerInterface.hpp b/source/modulo_controllers/include/modulo_controllers/BaseControllerInterface.hpp index 0b50651c..b26c19aa 100644 --- a/source/modulo_controllers/include/modulo_controllers/BaseControllerInterface.hpp +++ b/source/modulo_controllers/include/modulo_controllers/BaseControllerInterface.hpp @@ -978,7 +978,7 @@ template inline void BaseControllerInterface::publish_transforms( const std::vector& transforms, const std::shared_ptr& tf_broadcaster, bool is_static) { - if (this->get_node() == nullptr) { + if (!is_node_initialized()) { throw modulo_core::exceptions::CoreException("Failed send transform(s): Node is not initialized yet."); } std::string modifier = is_static ? "static " : ""; diff --git a/source/modulo_controllers/src/BaseControllerInterface.cpp b/source/modulo_controllers/src/BaseControllerInterface.cpp index f7bb4e31..562d3cfc 100644 --- a/source/modulo_controllers/src/BaseControllerInterface.cpp +++ b/source/modulo_controllers/src/BaseControllerInterface.cpp @@ -596,7 +596,7 @@ geometry_msgs::msg::TransformStamped BaseControllerInterface::lookup_ros_transfo } void BaseControllerInterface::add_tf_broadcaster() { - if (this->get_node() == nullptr) { + if (!is_node_initialized()) { throw modulo_core::exceptions::CoreException("Failed to add TF broadcaster: Node is not initialized yet."); } if (this->tf_broadcaster_ == nullptr) { @@ -609,7 +609,7 @@ void BaseControllerInterface::add_tf_broadcaster() { } void BaseControllerInterface::add_static_tf_broadcaster() { - if (this->get_node() == nullptr) { + if (!is_node_initialized()) { throw modulo_core::exceptions::CoreException("Failed to add static TF broadcaster: Node is not initialized yet."); } if (this->static_tf_broadcaster_ == nullptr) {