From 7a55d57565f1e7660c0a3db37395673043865401 Mon Sep 17 00:00:00 2001
From: danielsanchezaran <daniel.sanchez@tier4.jp>
Date: Mon, 10 Jun 2024 18:45:12 +0900
Subject: [PATCH] refactor(control_validator)!: prefix package and namespace
 with autoware (#7304)

* rename folders

Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>

* rename add prefix

Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>

* change param path

Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>

* fix pluggin problem

Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>

* fix extra prefixes

Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>

* change back launchers

Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>

* add namespace to address conflict

Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>

* delete stubborn file

Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>

---------

Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
---
 .github/CODEOWNERS                            |  2 +-
 .../CMakeLists.txt                            | 20 +++++++++----------
 .../README.md                                 |  0
 .../config/control_validator.param.yaml       |  0
 .../image/control_validator.drawio.svg        |  0
 .../image/trajectory_deviation.drawio.svg     |  0
 .../control_validator.hpp                     | 16 +++++++--------
 .../debug_marker.hpp                          |  6 +++---
 .../autoware_control_validator}/utils.hpp     | 10 +++++-----
 .../launch/control_validator.launch.xml       |  4 ++--
 .../msg/ControlValidatorStatus.msg            |  0
 .../package.xml                               |  4 ++--
 .../src/control_validator.cpp                 | 12 +++++------
 .../src/debug_marker.cpp                      |  2 +-
 .../src/utils.cpp                             |  6 +++---
 .../launch/control.launch.py                  |  4 ++--
 .../diagnostic_aggregator/control.param.yaml  |  2 +-
 17 files changed, 44 insertions(+), 44 deletions(-)
 rename control/{control_validator => autoware_control_validator}/CMakeLists.txt (50%)
 rename control/{control_validator => autoware_control_validator}/README.md (100%)
 rename control/{control_validator => autoware_control_validator}/config/control_validator.param.yaml (100%)
 rename control/{control_validator => autoware_control_validator}/image/control_validator.drawio.svg (100%)
 rename control/{control_validator => autoware_control_validator}/image/trajectory_deviation.drawio.svg (100%)
 rename control/{control_validator/include/control_validator => autoware_control_validator/include/autoware_control_validator}/control_validator.hpp (86%)
 rename control/{control_validator/include/control_validator => autoware_control_validator/include/autoware_control_validator}/debug_marker.hpp (92%)
 rename control/{control_validator/include/control_validator => autoware_control_validator/include/autoware_control_validator}/utils.hpp (88%)
 rename control/{control_validator => autoware_control_validator}/launch/control_validator.launch.xml (79%)
 rename control/{control_validator => autoware_control_validator}/msg/ControlValidatorStatus.msg (100%)
 rename control/{control_validator => autoware_control_validator}/package.xml (93%)
 rename control/{control_validator => autoware_control_validator}/src/control_validator.cpp (95%)
 rename control/{control_validator => autoware_control_validator}/src/debug_marker.cpp (98%)
 rename control/{control_validator => autoware_control_validator}/src/utils.cpp (98%)

diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index e13158d02f9ef..e24ee56c4165d 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -46,7 +46,7 @@ common/traffic_light_utils/** kotaro.uetake@tier4.jp satoshi.ota@tier4.jp shunsu
 common/tvm_utility/** ambroise.vincent@arm.com xinyu.wang@tier4.jp
 control/autoware_autonomous_emergency_braking/** daniel.sanchez@tier4.jp mamoru.sobue@tier4.jp takamasa.horibe@tier4.jp tomoya.kimura@tier4.jp
 control/control_performance_analysis/** berkay@leodrive.ai fumiya.watanabe@tier4.jp satoshi.ota@tier4.jp shumpei.wakabayashi@tier4.jp taiki.tanaka@tier4.jp takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp tomoya.kimura@tier4.jp
-control/control_validator/** kyoichi.sugahara@tier4.jp makoto.kurihara@tier4.jp mamoru.sobue@tier4.jp takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp
+control/autoware_control_validator/** kyoichi.sugahara@tier4.jp makoto.kurihara@tier4.jp mamoru.sobue@tier4.jp takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp
 control/autoware_external_cmd_selector/** fumiya.watanabe@tier4.jp satoshi.ota@tier4.jp shumpei.wakabayashi@tier4.jp taiki.tanaka@tier4.jp takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp tomoya.kimura@tier4.jp
 control/autoware_joy_controller/** fumiya.watanabe@tier4.jp satoshi.ota@tier4.jp shumpei.wakabayashi@tier4.jp taiki.tanaka@tier4.jp takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp tomoya.kimura@tier4.jp
 control/autoware_lane_departure_checker/** kyoichi.sugahara@tier4.jp makoto.kurihara@tier4.jp
diff --git a/control/control_validator/CMakeLists.txt b/control/autoware_control_validator/CMakeLists.txt
similarity index 50%
rename from control/control_validator/CMakeLists.txt
rename to control/autoware_control_validator/CMakeLists.txt
index fab942c4dc001..1a4119e47a723 100644
--- a/control/control_validator/CMakeLists.txt
+++ b/control/autoware_control_validator/CMakeLists.txt
@@ -1,23 +1,23 @@
 cmake_minimum_required(VERSION 3.22)
-project(control_validator)
+project(autoware_control_validator)
 
 find_package(autoware_cmake REQUIRED)
 autoware_package()
 
-ament_auto_add_library(control_validator_helpers SHARED
+ament_auto_add_library(autoware_control_validator_helpers SHARED
   src/utils.cpp
   src/debug_marker.cpp
 )
 
 # control validator
-ament_auto_add_library(control_validator_component SHARED
-  include/control_validator/control_validator.hpp
+ament_auto_add_library(autoware_control_validator_component SHARED
+  include/autoware_control_validator/control_validator.hpp
   src/control_validator.cpp
 )
-target_link_libraries(control_validator_component control_validator_helpers)
-rclcpp_components_register_node(control_validator_component
-  PLUGIN "control_validator::ControlValidator"
-  EXECUTABLE control_validator_node
+target_link_libraries(autoware_control_validator_component autoware_control_validator_helpers)
+rclcpp_components_register_node(autoware_control_validator_component
+  PLUGIN "autoware::control_validator::ControlValidator"
+  EXECUTABLE autoware_control_validator_node
 )
 
 rosidl_generate_interfaces(
@@ -28,12 +28,12 @@ rosidl_generate_interfaces(
 
 # to use a message defined in the same package
 if(${rosidl_cmake_VERSION} VERSION_LESS 2.5.0)
-  rosidl_target_interfaces(control_validator_component
+  rosidl_target_interfaces(autoware_control_validator_component
     ${PROJECT_NAME} "rosidl_typesupport_cpp")
 else()
   rosidl_get_typesupport_target(
     cpp_typesupport_target ${PROJECT_NAME} "rosidl_typesupport_cpp")
-  target_link_libraries(control_validator_component "${cpp_typesupport_target}")
+  target_link_libraries(autoware_control_validator_component "${cpp_typesupport_target}")
 endif()
 
 # if(BUILD_TESTING)
diff --git a/control/control_validator/README.md b/control/autoware_control_validator/README.md
similarity index 100%
rename from control/control_validator/README.md
rename to control/autoware_control_validator/README.md
diff --git a/control/control_validator/config/control_validator.param.yaml b/control/autoware_control_validator/config/control_validator.param.yaml
similarity index 100%
rename from control/control_validator/config/control_validator.param.yaml
rename to control/autoware_control_validator/config/control_validator.param.yaml
diff --git a/control/control_validator/image/control_validator.drawio.svg b/control/autoware_control_validator/image/control_validator.drawio.svg
similarity index 100%
rename from control/control_validator/image/control_validator.drawio.svg
rename to control/autoware_control_validator/image/control_validator.drawio.svg
diff --git a/control/control_validator/image/trajectory_deviation.drawio.svg b/control/autoware_control_validator/image/trajectory_deviation.drawio.svg
similarity index 100%
rename from control/control_validator/image/trajectory_deviation.drawio.svg
rename to control/autoware_control_validator/image/trajectory_deviation.drawio.svg
diff --git a/control/control_validator/include/control_validator/control_validator.hpp b/control/autoware_control_validator/include/autoware_control_validator/control_validator.hpp
similarity index 86%
rename from control/control_validator/include/control_validator/control_validator.hpp
rename to control/autoware_control_validator/include/autoware_control_validator/control_validator.hpp
index 56125cc40b74e..d26abfc2ecd2f 100644
--- a/control/control_validator/include/control_validator/control_validator.hpp
+++ b/control/autoware_control_validator/include/autoware_control_validator/control_validator.hpp
@@ -12,12 +12,12 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef CONTROL_VALIDATOR__CONTROL_VALIDATOR_HPP_
-#define CONTROL_VALIDATOR__CONTROL_VALIDATOR_HPP_
+#ifndef AUTOWARE_CONTROL_VALIDATOR__CONTROL_VALIDATOR_HPP_
+#define AUTOWARE_CONTROL_VALIDATOR__CONTROL_VALIDATOR_HPP_
 
+#include "autoware_control_validator/debug_marker.hpp"
+#include "autoware_control_validator/msg/control_validator_status.hpp"
 #include "autoware_vehicle_info_utils/vehicle_info_utils.hpp"
-#include "control_validator/debug_marker.hpp"
-#include "control_validator/msg/control_validator_status.hpp"
 
 #include <diagnostic_updater/diagnostic_updater.hpp>
 #include <rclcpp/rclcpp.hpp>
@@ -29,11 +29,11 @@
 #include <memory>
 #include <string>
 
-namespace control_validator
+namespace autoware::control_validator
 {
+using autoware_control_validator::msg::ControlValidatorStatus;
 using autoware_planning_msgs::msg::Trajectory;
 using autoware_planning_msgs::msg::TrajectoryPoint;
-using control_validator::msg::ControlValidatorStatus;
 using diagnostic_updater::DiagnosticStatusWrapper;
 using diagnostic_updater::Updater;
 using nav_msgs::msg::Odometry;
@@ -94,6 +94,6 @@ class ControlValidator : public rclcpp::Node
 
   std::shared_ptr<ControlValidatorDebugMarkerPublisher> debug_pose_publisher_;
 };
-}  // namespace control_validator
+}  // namespace autoware::control_validator
 
-#endif  // CONTROL_VALIDATOR__CONTROL_VALIDATOR_HPP_
+#endif  // AUTOWARE_CONTROL_VALIDATOR__CONTROL_VALIDATOR_HPP_
diff --git a/control/control_validator/include/control_validator/debug_marker.hpp b/control/autoware_control_validator/include/autoware_control_validator/debug_marker.hpp
similarity index 92%
rename from control/control_validator/include/control_validator/debug_marker.hpp
rename to control/autoware_control_validator/include/autoware_control_validator/debug_marker.hpp
index 2d3a209cbd7da..cde596ed7e1ab 100644
--- a/control/control_validator/include/control_validator/debug_marker.hpp
+++ b/control/autoware_control_validator/include/autoware_control_validator/debug_marker.hpp
@@ -12,8 +12,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef CONTROL_VALIDATOR__DEBUG_MARKER_HPP_
-#define CONTROL_VALIDATOR__DEBUG_MARKER_HPP_
+#ifndef AUTOWARE_CONTROL_VALIDATOR__DEBUG_MARKER_HPP_
+#define AUTOWARE_CONTROL_VALIDATOR__DEBUG_MARKER_HPP_
 
 #include <rclcpp/rclcpp.hpp>
 
@@ -57,4 +57,4 @@ class ControlValidatorDebugMarkerPublisher
   }
 };
 
-#endif  // CONTROL_VALIDATOR__DEBUG_MARKER_HPP_
+#endif  // AUTOWARE_CONTROL_VALIDATOR__DEBUG_MARKER_HPP_
diff --git a/control/control_validator/include/control_validator/utils.hpp b/control/autoware_control_validator/include/autoware_control_validator/utils.hpp
similarity index 88%
rename from control/control_validator/include/control_validator/utils.hpp
rename to control/autoware_control_validator/include/autoware_control_validator/utils.hpp
index edf97aaf5f510..69faa2fbe4abc 100644
--- a/control/control_validator/include/control_validator/utils.hpp
+++ b/control/autoware_control_validator/include/autoware_control_validator/utils.hpp
@@ -12,8 +12,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef CONTROL_VALIDATOR__UTILS_HPP_
-#define CONTROL_VALIDATOR__UTILS_HPP_
+#ifndef AUTOWARE_CONTROL_VALIDATOR__UTILS_HPP_
+#define AUTOWARE_CONTROL_VALIDATOR__UTILS_HPP_
 
 #include <motion_utils/trajectory/conversion.hpp>
 #include <rclcpp/rclcpp.hpp>
@@ -24,7 +24,7 @@
 #include <utility>
 #include <vector>
 
-namespace control_validator
+namespace autoware::control_validator
 {
 using autoware_planning_msgs::msg::Trajectory;
 using autoware_planning_msgs::msg::TrajectoryPoint;
@@ -50,6 +50,6 @@ Trajectory alignTrajectoryWithReferenceTrajectory(
 
 double calcMaxLateralDistance(
   const Trajectory & trajectory, const Trajectory & predicted_trajectory);
-}  // namespace control_validator
+}  // namespace autoware::control_validator
 
-#endif  // CONTROL_VALIDATOR__UTILS_HPP_
+#endif  // AUTOWARE_CONTROL_VALIDATOR__UTILS_HPP_
diff --git a/control/control_validator/launch/control_validator.launch.xml b/control/autoware_control_validator/launch/control_validator.launch.xml
similarity index 79%
rename from control/control_validator/launch/control_validator.launch.xml
rename to control/autoware_control_validator/launch/control_validator.launch.xml
index 9727e06e60523..651398a17fc78 100644
--- a/control/control_validator/launch/control_validator.launch.xml
+++ b/control/autoware_control_validator/launch/control_validator.launch.xml
@@ -1,9 +1,9 @@
 <launch>
-  <arg name="control_validator_param_path" default="$(find-pkg-share control_validator)/config/control_validator.param.yaml"/>
+  <arg name="control_validator_param_path" default="$(find-pkg-share autoware_control_validator)/config/control_validator.param.yaml"/>
   <arg name="input_reference_trajectory" default="/planning/scenario_planning/trajectory"/>
   <arg name="input_predicted_trajectory" default="/control/trajectory_follower/lateral/predicted_trajectory"/>
 
-  <node name="control_validator" exec="control_validator_node" pkg="control_validator" output="screen">
+  <node name="control_validator" exec="autoware_control_validator_node" pkg="autoware_control_validator" output="screen">
     <!-- load config a file -->
     <param from="$(var control_validator_param_path)"/>
 
diff --git a/control/control_validator/msg/ControlValidatorStatus.msg b/control/autoware_control_validator/msg/ControlValidatorStatus.msg
similarity index 100%
rename from control/control_validator/msg/ControlValidatorStatus.msg
rename to control/autoware_control_validator/msg/ControlValidatorStatus.msg
diff --git a/control/control_validator/package.xml b/control/autoware_control_validator/package.xml
similarity index 93%
rename from control/control_validator/package.xml
rename to control/autoware_control_validator/package.xml
index 93779d28d6218..2059308ef9029 100644
--- a/control/control_validator/package.xml
+++ b/control/autoware_control_validator/package.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0"?>
 <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
 <package format="3">
-  <name>control_validator</name>
+  <name>autoware_control_validator</name>
   <version>0.1.0</version>
-  <description>ros node for control_validator</description>
+  <description>ros node for autoware_control_validator</description>
   <maintainer email="kyoichi.sugahara@tier4.jp">Kyoichi Sugahara</maintainer>
   <maintainer email="takamasa.horibe@tier4.jp">Takamasa Horibe</maintainer>
   <maintainer email="makoto.kurihara@tier4.jp">Makoto Kurihara</maintainer>
diff --git a/control/control_validator/src/control_validator.cpp b/control/autoware_control_validator/src/control_validator.cpp
similarity index 95%
rename from control/control_validator/src/control_validator.cpp
rename to control/autoware_control_validator/src/control_validator.cpp
index be103647f1b36..e056a32437938 100644
--- a/control/control_validator/src/control_validator.cpp
+++ b/control/autoware_control_validator/src/control_validator.cpp
@@ -12,15 +12,15 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "control_validator/control_validator.hpp"
+#include "autoware_control_validator/control_validator.hpp"
 
-#include "control_validator/utils.hpp"
+#include "autoware_control_validator/utils.hpp"
 
 #include <memory>
 #include <string>
 #include <utility>
 
-namespace control_validator
+namespace autoware::control_validator
 {
 using diagnostic_msgs::msg::DiagnosticStatus;
 
@@ -61,7 +61,7 @@ void ControlValidator::setupParameters()
   }
 
   try {
-    vehicle_info_ = autoware::vehicle_info_utils::VehicleInfoUtils(*this).getVehicleInfo();
+    vehicle_info_ = autoware::vehicle_info_utils::VehicleInfoUtil(*this).getVehicleInfo();
   } catch (...) {
     RCLCPP_ERROR(get_logger(), "failed to get vehicle info. use default value.");
     vehicle_info_.front_overhang_m = 0.5;
@@ -210,7 +210,7 @@ void ControlValidator::displayStatus()
     "predicted trajectory is too far from planning trajectory!!");
 }
 
-}  // namespace control_validator
+}  // namespace autoware::control_validator
 
 #include <rclcpp_components/register_node_macro.hpp>
-RCLCPP_COMPONENTS_REGISTER_NODE(control_validator::ControlValidator)
+RCLCPP_COMPONENTS_REGISTER_NODE(autoware::control_validator::ControlValidator)
diff --git a/control/control_validator/src/debug_marker.cpp b/control/autoware_control_validator/src/debug_marker.cpp
similarity index 98%
rename from control/control_validator/src/debug_marker.cpp
rename to control/autoware_control_validator/src/debug_marker.cpp
index 2dbdc558b305b..9ef2786c0aef6 100644
--- a/control/control_validator/src/debug_marker.cpp
+++ b/control/autoware_control_validator/src/debug_marker.cpp
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "control_validator/debug_marker.hpp"
+#include "autoware_control_validator/debug_marker.hpp"
 
 #include <motion_utils/marker/marker_helper.hpp>
 #include <tier4_autoware_utils/ros/marker_helper.hpp>
diff --git a/control/control_validator/src/utils.cpp b/control/autoware_control_validator/src/utils.cpp
similarity index 98%
rename from control/control_validator/src/utils.cpp
rename to control/autoware_control_validator/src/utils.cpp
index fab8b9f6f888b..e7cace049af6e 100644
--- a/control/control_validator/src/utils.cpp
+++ b/control/autoware_control_validator/src/utils.cpp
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "control_validator/utils.hpp"
+#include "autoware_control_validator/utils.hpp"
 
 #include <motion_utils/trajectory/interpolation.hpp>
 #include <motion_utils/trajectory/trajectory.hpp>
@@ -23,7 +23,7 @@
 #include <utility>
 #include <vector>
 
-namespace control_validator
+namespace autoware::control_validator
 {
 
 void shiftPose(Pose & pose, double longitudinal)
@@ -162,4 +162,4 @@ double calcMaxLateralDistance(
   return max_dist;
 }
 
-}  // namespace control_validator
+}  // namespace autoware::control_validator
diff --git a/launch/tier4_control_launch/launch/control.launch.py b/launch/tier4_control_launch/launch/control.launch.py
index 1183514e9a3cb..2dd12b1705dd3 100644
--- a/launch/tier4_control_launch/launch/control.launch.py
+++ b/launch/tier4_control_launch/launch/control.launch.py
@@ -386,8 +386,8 @@ def launch_setup(context, *args, **kwargs):
 
     # control validator checker
     control_validator_component = ComposableNode(
-        package="control_validator",
-        plugin="control_validator::ControlValidator",
+        package="autoware_control_validator",
+        plugin="autoware::control_validator::ControlValidator",
         name="control_validator",
         remappings=[
             ("~/input/kinematics", "/localization/kinematic_state"),
diff --git a/system/system_error_monitor/config/diagnostic_aggregator/control.param.yaml b/system/system_error_monitor/config/diagnostic_aggregator/control.param.yaml
index 3c8a5c77b2e44..9da5b14780dd1 100644
--- a/system/system_error_monitor/config/diagnostic_aggregator/control.param.yaml
+++ b/system/system_error_monitor/config/diagnostic_aggregator/control.param.yaml
@@ -70,7 +70,7 @@
 
                 control_validator:
                   type: diagnostic_aggregator/GenericAnalyzer
-                  path: control_validator
+                  path: autoware_control_validator
                   contains: [": control_validation_max_distance_deviation"]
                   timeout: 1.0