From 222cbc87ecdfe5573ba93b77bb290ac8bc06e767 Mon Sep 17 00:00:00 2001 From: Vaios Papaspyros Date: Thu, 5 Dec 2024 13:28:12 +0100 Subject: [PATCH] feat(controllers): add TF listener and lookup TF helpers in BaseControllerInterface (#169) --- .../include/modulo_controllers/BaseControllerInterface.hpp | 1 + source/modulo_controllers/src/BaseControllerInterface.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/source/modulo_controllers/include/modulo_controllers/BaseControllerInterface.hpp b/source/modulo_controllers/include/modulo_controllers/BaseControllerInterface.hpp index b26c19aa..5c974a81 100644 --- a/source/modulo_controllers/include/modulo_controllers/BaseControllerInterface.hpp +++ b/source/modulo_controllers/include/modulo_controllers/BaseControllerInterface.hpp @@ -534,6 +534,7 @@ class BaseControllerInterface : public controller_interface::ControllerInterface * if the lookupTransform call failed * @return If it exists, the requested transform */ + [[nodiscard]] geometry_msgs::msg::TransformStamped lookup_ros_transform( const std::string& frame, const std::string& reference_frame, const tf2::TimePoint& time_point, const tf2::Duration& duration); diff --git a/source/modulo_controllers/src/BaseControllerInterface.cpp b/source/modulo_controllers/src/BaseControllerInterface.cpp index 562d3cfc..0540f995 100644 --- a/source/modulo_controllers/src/BaseControllerInterface.cpp +++ b/source/modulo_controllers/src/BaseControllerInterface.cpp @@ -544,9 +544,16 @@ void BaseControllerInterface::add_service( } void BaseControllerInterface::add_tf_listener() { +<<<<<<< HEAD if (!is_node_initialized()) { throw modulo_core::exceptions::CoreException("Failed to add TF buffer and listener: Node is not initialized yet."); } +======= + if (this->get_node() == nullptr) { + throw modulo_core::exceptions::CoreException("Failed to add TF buffer and listener: Node is not initialized yet."); + } + +>>>>>>> ed20342 (feat(controllers): add TF listener and lookup TF helpers in BaseControllerInterface (#169)) 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);