From f1b4c59195f4d0d7391b9187e5bffa7883bab2fd Mon Sep 17 00:00:00 2001 From: a-maumau Date: Fri, 24 May 2024 16:36:15 +0900 Subject: [PATCH 1/3] remove unusing main func file Signed-off-by: a-maumau --- .../src/vehicle_velocity_converter_node.cpp | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 sensing/vehicle_velocity_converter/src/vehicle_velocity_converter_node.cpp 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; -} From a41bdf0df1296d259bd431ca7ba76c17163ea533 Mon Sep 17 00:00:00 2001 From: a-maumau Date: Fri, 24 May 2024 16:37:38 +0900 Subject: [PATCH 2/3] mod to componentize and use glog Signed-off-by: a-maumau --- sensing/vehicle_velocity_converter/CMakeLists.txt | 10 +++++++--- .../vehicle_velocity_converter.hpp | 2 +- sensing/vehicle_velocity_converter/package.xml | 1 + .../src/vehicle_velocity_converter.cpp | 6 +++++- 4 files changed, 14 insertions(+), 5 deletions(-) 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 660ad330f07f3..b60cae5fac51e 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/package.xml b/sensing/vehicle_velocity_converter/package.xml index c44c55bcd40eb..4e8b08e7b952c 100644 --- a/sensing/vehicle_velocity_converter/package.xml +++ b/sensing/vehicle_velocity_converter/package.xml @@ -13,6 +13,7 @@ autoware_auto_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 0f4a22bbc9730..4e15a1a42fe53 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) From 9e1976c8f63a7061e193206693a7db626e5f1d47 Mon Sep 17 00:00:00 2001 From: a-maumau Date: Fri, 24 May 2024 16:38:59 +0900 Subject: [PATCH 3/3] change log output from screen to both Signed-off-by: a-maumau --- .../launch/vehicle_velocity_converter.launch.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ - +