diff --git a/localization/geo_pose_projector/CMakeLists.txt b/localization/geo_pose_projector/CMakeLists.txt
index 6e2cdf32fb6c5..f274e7d23dbab 100644
--- a/localization/geo_pose_projector/CMakeLists.txt
+++ b/localization/geo_pose_projector/CMakeLists.txt
@@ -4,11 +4,15 @@ project(geo_pose_projector)
find_package(autoware_cmake REQUIRED)
autoware_package()
-ament_auto_add_executable(geo_pose_projector
- src/geo_pose_projector_node.cpp
+ament_auto_add_library(${PROJECT_NAME} SHARED
src/geo_pose_projector.cpp
)
-ament_target_dependencies(geo_pose_projector)
+
+rclcpp_components_register_node(${PROJECT_NAME}
+ PLUGIN "GeoPoseProjector"
+ EXECUTABLE ${PROJECT_NAME}_node
+ EXECUTOR SingleThreadedExecutor
+)
ament_auto_package(
INSTALL_TO_SHARE
diff --git a/localization/geo_pose_projector/launch/geo_pose_projector.launch.xml b/localization/geo_pose_projector/launch/geo_pose_projector.launch.xml
index d840add1ed1c7..de6785a016858 100644
--- a/localization/geo_pose_projector/launch/geo_pose_projector.launch.xml
+++ b/localization/geo_pose_projector/launch/geo_pose_projector.launch.xml
@@ -4,7 +4,7 @@
-
+
diff --git a/localization/geo_pose_projector/package.xml b/localization/geo_pose_projector/package.xml
index c0e2db59deb64..36b2aec8384ac 100644
--- a/localization/geo_pose_projector/package.xml
+++ b/localization/geo_pose_projector/package.xml
@@ -24,6 +24,7 @@
geography_utils
geometry_msgs
rclcpp
+ rclcpp_components
tf2_geometry_msgs
tf2_ros
diff --git a/localization/geo_pose_projector/src/geo_pose_projector.cpp b/localization/geo_pose_projector/src/geo_pose_projector.cpp
index d147888bb743b..80bb407958de2 100644
--- a/localization/geo_pose_projector/src/geo_pose_projector.cpp
+++ b/localization/geo_pose_projector/src/geo_pose_projector.cpp
@@ -25,8 +25,8 @@
#include
-GeoPoseProjector::GeoPoseProjector()
-: Node("geo_pose_projector"), publish_tf_(declare_parameter("publish_tf"))
+GeoPoseProjector::GeoPoseProjector(const rclcpp::NodeOptions & options)
+: rclcpp::Node("geo_pose_projector", options), publish_tf_(declare_parameter("publish_tf"))
{
// Subscribe to map_projector_info topic
const auto adaptor = component_interface_utils::NodeAdaptor(this);
@@ -102,3 +102,6 @@ void GeoPoseProjector::on_geo_pose(const GeoPoseWithCovariance::ConstSharedPtr m
tf_broadcaster_->sendTransform(transform_stamped);
}
}
+
+#include
+RCLCPP_COMPONENTS_REGISTER_NODE(GeoPoseProjector)
diff --git a/localization/geo_pose_projector/src/geo_pose_projector.hpp b/localization/geo_pose_projector/src/geo_pose_projector.hpp
index b0611fec36984..738e805ef8101 100644
--- a/localization/geo_pose_projector/src/geo_pose_projector.hpp
+++ b/localization/geo_pose_projector/src/geo_pose_projector.hpp
@@ -36,7 +36,7 @@ class GeoPoseProjector : public rclcpp::Node
using MapProjectorInfo = map_interface::MapProjectorInfo;
public:
- GeoPoseProjector();
+ explicit GeoPoseProjector(const rclcpp::NodeOptions & options);
private:
void on_geo_pose(const GeoPoseWithCovariance::ConstSharedPtr msg);
diff --git a/localization/geo_pose_projector/src/geo_pose_projector_node.cpp b/localization/geo_pose_projector/src/geo_pose_projector_node.cpp
deleted file mode 100644
index 97367d6b9f774..0000000000000
--- a/localization/geo_pose_projector/src/geo_pose_projector_node.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2023 Autoware Foundation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "geo_pose_projector.hpp"
-
-#include
-
-#include
-
-int main(int argc, char ** argv)
-{
- rclcpp::init(argc, argv);
-
- rclcpp::spin(std::make_shared());
- rclcpp::shutdown();
-
- return 0;
-}