diff --git a/sensing/imu_corrector/CMakeLists.txt b/sensing/imu_corrector/CMakeLists.txt
index ded596a8a9898..b3be5be12b75d 100644
--- a/sensing/imu_corrector/CMakeLists.txt
+++ b/sensing/imu_corrector/CMakeLists.txt
@@ -4,27 +4,32 @@ project(imu_corrector)
find_package(autoware_cmake REQUIRED)
autoware_package()
-ament_auto_add_library(gyro_bias_estimation_module SHARED
- src/gyro_bias_estimation_module.cpp
-)
-
-ament_auto_add_executable(imu_corrector
+ament_auto_add_library(${PROJECT_NAME} SHARED
src/imu_corrector_core.cpp
- src/imu_corrector_node.cpp
)
-ament_auto_add_executable(gyro_bias_estimator
+ament_auto_add_library(gyro_bias_estimator SHARED
src/gyro_bias_estimator.cpp
- src/gyro_bias_estimator_node.cpp
+ src/gyro_bias_estimation_module.cpp
)
-target_link_libraries(gyro_bias_estimator gyro_bias_estimation_module)
+rclcpp_components_register_node(${PROJECT_NAME}
+ PLUGIN "imu_corrector::ImuCorrector"
+ EXECUTABLE ${PROJECT_NAME}_node
+ EXECUTOR SingleThreadedExecutor
+)
+
+rclcpp_components_register_node(gyro_bias_estimator
+ PLUGIN "imu_corrector::GyroBiasEstimator"
+ EXECUTABLE gyro_bias_estimator_node
+ EXECUTOR SingleThreadedExecutor
+)
function(add_testcase filepath)
get_filename_component(filename ${filepath} NAME)
string(REGEX REPLACE ".cpp" "" test_name ${filename})
ament_add_gmock(${test_name} ${filepath})
- target_link_libraries("${test_name}" gyro_bias_estimation_module)
+ target_link_libraries("${test_name}" gyro_bias_estimator)
ament_target_dependencies(${test_name} ${${PROJECT_NAME}_FOUND_BUILD_DEPENDS})
endfunction()
diff --git a/sensing/imu_corrector/launch/gyro_bias_estimator.launch.xml b/sensing/imu_corrector/launch/gyro_bias_estimator.launch.xml
index e16ccef446aba..100168b17171a 100644
--- a/sensing/imu_corrector/launch/gyro_bias_estimator.launch.xml
+++ b/sensing/imu_corrector/launch/gyro_bias_estimator.launch.xml
@@ -6,7 +6,7 @@
-
+
diff --git a/sensing/imu_corrector/launch/imu_corrector.launch.xml b/sensing/imu_corrector/launch/imu_corrector.launch.xml
index d87d6e77c110d..8430f2a50a85c 100755
--- a/sensing/imu_corrector/launch/imu_corrector.launch.xml
+++ b/sensing/imu_corrector/launch/imu_corrector.launch.xml
@@ -4,7 +4,7 @@
-
+
diff --git a/sensing/imu_corrector/src/gyro_bias_estimator.cpp b/sensing/imu_corrector/src/gyro_bias_estimator.cpp
index e99667ed1c4a6..d79626f66801b 100644
--- a/sensing/imu_corrector/src/gyro_bias_estimator.cpp
+++ b/sensing/imu_corrector/src/gyro_bias_estimator.cpp
@@ -23,8 +23,8 @@
namespace imu_corrector
{
-GyroBiasEstimator::GyroBiasEstimator()
-: Node("gyro_bias_validator"),
+GyroBiasEstimator::GyroBiasEstimator(const rclcpp::NodeOptions & options)
+: rclcpp::Node("gyro_bias_validator", options),
gyro_bias_threshold_(declare_parameter("gyro_bias_threshold")),
angular_velocity_offset_x_(declare_parameter("angular_velocity_offset_x")),
angular_velocity_offset_y_(declare_parameter("angular_velocity_offset_y")),
@@ -244,3 +244,6 @@ void GyroBiasEstimator::update_diagnostics(diagnostic_updater::DiagnosticStatusW
}
} // namespace imu_corrector
+
+#include
+RCLCPP_COMPONENTS_REGISTER_NODE(imu_corrector::GyroBiasEstimator)
diff --git a/sensing/imu_corrector/src/gyro_bias_estimator.hpp b/sensing/imu_corrector/src/gyro_bias_estimator.hpp
index 3592ff1f7d3b4..671c18de78f86 100644
--- a/sensing/imu_corrector/src/gyro_bias_estimator.hpp
+++ b/sensing/imu_corrector/src/gyro_bias_estimator.hpp
@@ -42,7 +42,7 @@ class GyroBiasEstimator : public rclcpp::Node
using Odometry = nav_msgs::msg::Odometry;
public:
- GyroBiasEstimator();
+ explicit GyroBiasEstimator(const rclcpp::NodeOptions & options);
private:
void update_diagnostics(diagnostic_updater::DiagnosticStatusWrapper & stat);
diff --git a/sensing/imu_corrector/src/gyro_bias_estimator_node.cpp b/sensing/imu_corrector/src/gyro_bias_estimator_node.cpp
deleted file mode 100644
index a491957bbb57f..0000000000000
--- a/sensing/imu_corrector/src/gyro_bias_estimator_node.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2023 TIER IV, Inc.
-//
-// 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 "gyro_bias_estimator.hpp"
-
-#include
-
-int main(int argc, char * argv[])
-{
- rclcpp::init(argc, argv);
- auto node = std::make_shared();
- rclcpp::spin(node);
- rclcpp::shutdown();
- return 0;
-}
diff --git a/sensing/imu_corrector/src/imu_corrector_core.cpp b/sensing/imu_corrector/src/imu_corrector_core.cpp
index a26c64925729c..c8e7698cb4e37 100644
--- a/sensing/imu_corrector/src/imu_corrector_core.cpp
+++ b/sensing/imu_corrector/src/imu_corrector_core.cpp
@@ -53,8 +53,9 @@ geometry_msgs::msg::Vector3 transformVector3(
namespace imu_corrector
{
-ImuCorrector::ImuCorrector()
-: Node("imu_corrector"), output_frame_(declare_parameter("base_link", "base_link"))
+ImuCorrector::ImuCorrector(const rclcpp::NodeOptions & options)
+: rclcpp::Node("imu_corrector", options),
+ output_frame_(declare_parameter("base_link", "base_link"))
{
transform_listener_ = std::make_shared(this);
@@ -123,3 +124,6 @@ void ImuCorrector::callbackImu(const sensor_msgs::msg::Imu::ConstSharedPtr imu_m
}
} // namespace imu_corrector
+
+#include
+RCLCPP_COMPONENTS_REGISTER_NODE(imu_corrector::ImuCorrector)
diff --git a/sensing/imu_corrector/src/imu_corrector_core.hpp b/sensing/imu_corrector/src/imu_corrector_core.hpp
index 7709c611ab714..4d5377274ae78 100644
--- a/sensing/imu_corrector/src/imu_corrector_core.hpp
+++ b/sensing/imu_corrector/src/imu_corrector_core.hpp
@@ -34,7 +34,7 @@ class ImuCorrector : public rclcpp::Node
using COV_IDX = tier4_autoware_utils::xyz_covariance_index::XYZ_COV_IDX;
public:
- ImuCorrector();
+ explicit ImuCorrector(const rclcpp::NodeOptions & options);
private:
void callbackImu(const sensor_msgs::msg::Imu::ConstSharedPtr imu_msg_ptr);
diff --git a/sensing/imu_corrector/src/imu_corrector_node.cpp b/sensing/imu_corrector/src/imu_corrector_node.cpp
deleted file mode 100644
index c1df5bee28439..0000000000000
--- a/sensing/imu_corrector/src/imu_corrector_node.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2023 TIER IV, Inc.
-//
-// 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 "imu_corrector_core.hpp"
-
-#include
-
-int main(int argc, char * argv[])
-{
- rclcpp::init(argc, argv);
- auto node = std::make_shared();
- rclcpp::spin(node);
- rclcpp::shutdown();
- return 0;
-}