From 84996debdda361f2e872626dc3b1afe76b7387e6 Mon Sep 17 00:00:00 2001 From: Tobit Flatscher <53856473+2b-t@users.noreply.github.com> Date: Thu, 1 Jun 2023 11:35:05 +0100 Subject: [PATCH] fix: Fix loading image_rotate::ImageRotateNode as component --- image_rotate/include/image_rotate/image_rotate_node.hpp | 2 +- image_rotate/src/image_rotate.cpp | 3 ++- image_rotate/src/image_rotate_node.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/image_rotate/include/image_rotate/image_rotate_node.hpp b/image_rotate/include/image_rotate/image_rotate_node.hpp index 02d4503a9..7f6c5010c 100644 --- a/image_rotate/include/image_rotate/image_rotate_node.hpp +++ b/image_rotate/include/image_rotate/image_rotate_node.hpp @@ -71,7 +71,7 @@ struct ImageRotateConfig class ImageRotateNode : public rclcpp::Node { public: - IMAGE_ROTATE_PUBLIC ImageRotateNode(); + IMAGE_ROTATE_PUBLIC ImageRotateNode(const rclcpp::NodeOptions& options); private: const std::string frameWithDefault(const std::string & frame, const std::string & image_frame); diff --git a/image_rotate/src/image_rotate.cpp b/image_rotate/src/image_rotate.cpp index f11a2e834..909d34ef8 100644 --- a/image_rotate/src/image_rotate.cpp +++ b/image_rotate/src/image_rotate.cpp @@ -46,7 +46,8 @@ int main(int argc, char ** argv) } rclcpp::init(argc, argv); - auto node = std::make_shared(); + rclcpp::NodeOptions options; + auto node = std::make_shared(options); rclcpp::spin(node); rclcpp::shutdown(); diff --git a/image_rotate/src/image_rotate_node.cpp b/image_rotate/src/image_rotate_node.cpp index 284737467..a836e6b8c 100644 --- a/image_rotate/src/image_rotate_node.cpp +++ b/image_rotate/src/image_rotate_node.cpp @@ -69,8 +69,8 @@ namespace image_rotate { -ImageRotateNode::ImageRotateNode() -: rclcpp::Node("ImageRotateNode") +ImageRotateNode::ImageRotateNode(const rclcpp::NodeOptions& options) +: rclcpp::Node("ImageRotateNode", options) { config_.target_frame_id = this->declare_parameter("target_frame_id", std::string("")); config_.target_x = this->declare_parameter("target_x", 0.0); @@ -361,7 +361,7 @@ void ImageRotateNode::onInit() } } // namespace image_rotate -#include "class_loader/register_macro.hpp" +#include "rclcpp_components/register_node_macro.hpp" // Register the component with class_loader. -CLASS_LOADER_REGISTER_CLASS(image_rotate::ImageRotateNode, rclcpp::Node) +RCLCPP_COMPONENTS_REGISTER_NODE(image_rotate::ImageRotateNode)