diff --git a/sensing/vehicle_velocity_converter/CMakeLists.txt b/sensing/vehicle_velocity_converter/CMakeLists.txt index 4f4a14bd9f045..bb50fbff90c4b 100644 --- a/sensing/vehicle_velocity_converter/CMakeLists.txt +++ b/sensing/vehicle_velocity_converter/CMakeLists.txt @@ -4,11 +4,15 @@ project(vehicle_velocity_converter) find_package(autoware_cmake REQUIRED) autoware_package() -ament_auto_add_executable(vehicle_velocity_converter - src/vehicle_velocity_converter_node.cpp +ament_auto_add_library(${PROJECT_NAME} SHARED src/vehicle_velocity_converter.cpp ) -ament_target_dependencies(vehicle_velocity_converter) + +rclcpp_components_register_node(${PROJECT_NAME} + PLUGIN "VehicleVelocityConverter" + EXECUTABLE ${PROJECT_NAME}_node + EXECUTOR SingleThreadedExecutor +) ament_auto_package( INSTALL_TO_SHARE diff --git a/sensing/vehicle_velocity_converter/include/vehicle_velocity_converter/vehicle_velocity_converter.hpp b/sensing/vehicle_velocity_converter/include/vehicle_velocity_converter/vehicle_velocity_converter.hpp index 4a1a66b842892..8ef46609ee542 100644 --- a/sensing/vehicle_velocity_converter/include/vehicle_velocity_converter/vehicle_velocity_converter.hpp +++ b/sensing/vehicle_velocity_converter/include/vehicle_velocity_converter/vehicle_velocity_converter.hpp @@ -28,7 +28,7 @@ class VehicleVelocityConverter : public rclcpp::Node { public: - VehicleVelocityConverter(); + explicit VehicleVelocityConverter(const rclcpp::NodeOptions & options); ~VehicleVelocityConverter() = default; private: diff --git a/sensing/vehicle_velocity_converter/launch/vehicle_velocity_converter.launch.xml b/sensing/vehicle_velocity_converter/launch/vehicle_velocity_converter.launch.xml index 6302c09b526f9..84e1838dc89eb 100644 --- a/sensing/vehicle_velocity_converter/launch/vehicle_velocity_converter.launch.xml +++ b/sensing/vehicle_velocity_converter/launch/vehicle_velocity_converter.launch.xml @@ -3,7 +3,7 @@ - + diff --git a/sensing/vehicle_velocity_converter/package.xml b/sensing/vehicle_velocity_converter/package.xml index 39780deaccc28..b32b51bc52e10 100644 --- a/sensing/vehicle_velocity_converter/package.xml +++ b/sensing/vehicle_velocity_converter/package.xml @@ -13,6 +13,7 @@ autoware_vehicle_msgs geometry_msgs rclcpp + rclcpp_components ament_lint_auto autoware_lint_common diff --git a/sensing/vehicle_velocity_converter/src/vehicle_velocity_converter.cpp b/sensing/vehicle_velocity_converter/src/vehicle_velocity_converter.cpp index 360ec4cae58d5..2aece69f5283b 100644 --- a/sensing/vehicle_velocity_converter/src/vehicle_velocity_converter.cpp +++ b/sensing/vehicle_velocity_converter/src/vehicle_velocity_converter.cpp @@ -14,7 +14,8 @@ #include "vehicle_velocity_converter/vehicle_velocity_converter.hpp" -VehicleVelocityConverter::VehicleVelocityConverter() : Node("vehicle_velocity_converter") +VehicleVelocityConverter::VehicleVelocityConverter(const rclcpp::NodeOptions & options) +: rclcpp::Node("vehicle_velocity_converter", options) { // set covariance value for twist with covariance msg stddev_vx_ = declare_parameter("velocity_stddev_xx"); @@ -52,3 +53,6 @@ void VehicleVelocityConverter::callbackVelocityReport( twist_with_covariance_pub_->publish(twist_with_covariance_msg); } + +#include +RCLCPP_COMPONENTS_REGISTER_NODE(VehicleVelocityConverter) diff --git a/sensing/vehicle_velocity_converter/src/vehicle_velocity_converter_node.cpp b/sensing/vehicle_velocity_converter/src/vehicle_velocity_converter_node.cpp deleted file mode 100644 index cee25f6e6c62a..0000000000000 --- a/sensing/vehicle_velocity_converter/src/vehicle_velocity_converter_node.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2021 TierIV -// -// 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 - -int main(int argc, char ** argv) -{ - rclcpp::init(argc, argv); - auto node = std::make_shared(); - rclcpp::spin(node); - rclcpp::shutdown(); - - return 0; -}