From a5abd4f9c0933c0271162a1869d193983397744f Mon Sep 17 00:00:00 2001 From: Dominic Reber Date: Wed, 2 Oct 2024 15:03:55 +0000 Subject: [PATCH] feat: construct handler with logger --- .../modulo_components/ComponentInterface.hpp | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/source/modulo_components/include/modulo_components/ComponentInterface.hpp b/source/modulo_components/include/modulo_components/ComponentInterface.hpp index 7561b06f..59751fd6 100644 --- a/source/modulo_components/include/modulo_components/ComponentInterface.hpp +++ b/source/modulo_components/include/modulo_components/ComponentInterface.hpp @@ -647,7 +647,8 @@ inline void ComponentInterface::add_input( std::shared_ptr subscription_interface; switch (message_pair->get_type()) { case MessageType::BOOL: { - auto subscription_handler = std::make_shared>(message_pair); + auto subscription_handler = + std::make_shared>(message_pair, this->node_logging_->get_logger()); auto subscription = rclcpp::create_subscription( this->node_parameters_, this->node_topics_, topic_name, this->qos_, subscription_handler->get_callback(user_callback)); @@ -655,7 +656,8 @@ inline void ComponentInterface::add_input( break; } case MessageType::FLOAT64: { - auto subscription_handler = std::make_shared>(message_pair); + auto subscription_handler = std::make_shared>( + message_pair, this->node_logging_->get_logger()); auto subscription = rclcpp::create_subscription( this->node_parameters_, this->node_topics_, topic_name, this->qos_, subscription_handler->get_callback(user_callback)); @@ -663,8 +665,8 @@ inline void ComponentInterface::add_input( break; } case MessageType::FLOAT64_MULTI_ARRAY: { - auto subscription_handler = - std::make_shared>(message_pair); + auto subscription_handler = std::make_shared>( + message_pair, this->node_logging_->get_logger()); auto subscription = rclcpp::create_subscription( this->node_parameters_, this->node_topics_, topic_name, this->qos_, subscription_handler->get_callback(user_callback)); @@ -672,7 +674,8 @@ inline void ComponentInterface::add_input( break; } case MessageType::INT32: { - auto subscription_handler = std::make_shared>(message_pair); + auto subscription_handler = std::make_shared>( + message_pair, this->node_logging_->get_logger()); auto subscription = rclcpp::create_subscription( this->node_parameters_, this->node_topics_, topic_name, this->qos_, subscription_handler->get_callback(user_callback)); @@ -680,7 +683,8 @@ inline void ComponentInterface::add_input( break; } case MessageType::STRING: { - auto subscription_handler = std::make_shared>(message_pair); + auto subscription_handler = std::make_shared>( + message_pair, this->node_logging_->get_logger()); auto subscription = rclcpp::create_subscription( this->node_parameters_, this->node_topics_, topic_name, this->qos_, subscription_handler->get_callback(user_callback)); @@ -688,7 +692,8 @@ inline void ComponentInterface::add_input( break; } case MessageType::ENCODED_STATE: { - auto subscription_handler = std::make_shared>(message_pair); + auto subscription_handler = std::make_shared>( + message_pair, this->node_logging_->get_logger()); auto subscription = rclcpp::create_subscription( this->node_parameters_, this->node_topics_, topic_name, this->qos_, subscription_handler->get_callback(user_callback)); @@ -697,7 +702,8 @@ inline void ComponentInterface::add_input( } case MessageType::CUSTOM_MESSAGE: { if constexpr (modulo_core::concepts::CustomT) { - auto subscription_handler = std::make_shared>(message_pair); + auto subscription_handler = + std::make_shared>(message_pair, this->node_logging_->get_logger()); auto subscription = rclcpp::create_subscription( this->node_parameters_, this->node_topics_, topic_name, this->qos_, subscription_handler->get_callback(user_callback));