From 6f40830ee5eeb34eb88150a314308053a16ff77f Mon Sep 17 00:00:00 2001 From: Satoshi OTA <44889564+satoshi-ota@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:06:12 +0900 Subject: [PATCH] refactor(factor): move steering factor interface to motion utils (#9337) Signed-off-by: satoshi-ota --- .../factor}/steering_factor_interface.hpp | 15 ++++++--------- .../src/factor}/steering_factor_interface.cpp | 8 ++++---- .../behavior_path_planner_node.hpp | 4 ++-- .../CMakeLists.txt | 1 - .../interface/scene_module_interface.hpp | 8 +++----- .../interface/scene_module_manager_interface.hpp | 2 +- 6 files changed, 16 insertions(+), 22 deletions(-) rename {planning/behavior_path_planner/autoware_behavior_path_planner_common/include/autoware/behavior_path_planner_common/interface => common/autoware_motion_utils/include/autoware/motion_utils/factor}/steering_factor_interface.hpp (78%) rename {planning/behavior_path_planner/autoware_behavior_path_planner_common/src/interface => common/autoware_motion_utils/src/factor}/steering_factor_interface.cpp (85%) diff --git a/planning/behavior_path_planner/autoware_behavior_path_planner_common/include/autoware/behavior_path_planner_common/interface/steering_factor_interface.hpp b/common/autoware_motion_utils/include/autoware/motion_utils/factor/steering_factor_interface.hpp similarity index 78% rename from planning/behavior_path_planner/autoware_behavior_path_planner_common/include/autoware/behavior_path_planner_common/interface/steering_factor_interface.hpp rename to common/autoware_motion_utils/include/autoware/motion_utils/factor/steering_factor_interface.hpp index eb644dee05b32..5b701a73ac543 100644 --- a/planning/behavior_path_planner/autoware_behavior_path_planner_common/include/autoware/behavior_path_planner_common/interface/steering_factor_interface.hpp +++ b/common/autoware_motion_utils/include/autoware/motion_utils/factor/steering_factor_interface.hpp @@ -1,4 +1,4 @@ -// Copyright 2022 Tier IV, Inc. +// Copyright 2022 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. @@ -12,19 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef AUTOWARE__BEHAVIOR_PATH_PLANNER_COMMON__INTERFACE__STEERING_FACTOR_INTERFACE_HPP_ -#define AUTOWARE__BEHAVIOR_PATH_PLANNER_COMMON__INTERFACE__STEERING_FACTOR_INTERFACE_HPP_ - -#include +#ifndef AUTOWARE__MOTION_UTILS__FACTOR__STEERING_FACTOR_INTERFACE_HPP_ +#define AUTOWARE__MOTION_UTILS__FACTOR__STEERING_FACTOR_INTERFACE_HPP_ #include #include #include -#include #include -namespace steering_factor_interface +namespace autoware::motion_utils { using autoware_adapi_v1_msgs::msg::PlanningBehavior; @@ -49,6 +46,6 @@ class SteeringFactorInterface SteeringFactor steering_factor_{}; }; -} // namespace steering_factor_interface +} // namespace autoware::motion_utils -#endif // AUTOWARE__BEHAVIOR_PATH_PLANNER_COMMON__INTERFACE__STEERING_FACTOR_INTERFACE_HPP_ +#endif // AUTOWARE__MOTION_UTILS__FACTOR__STEERING_FACTOR_INTERFACE_HPP_ diff --git a/planning/behavior_path_planner/autoware_behavior_path_planner_common/src/interface/steering_factor_interface.cpp b/common/autoware_motion_utils/src/factor/steering_factor_interface.cpp similarity index 85% rename from planning/behavior_path_planner/autoware_behavior_path_planner_common/src/interface/steering_factor_interface.cpp rename to common/autoware_motion_utils/src/factor/steering_factor_interface.cpp index 8f39063b5a93b..f85b5b26cd0c2 100644 --- a/planning/behavior_path_planner/autoware_behavior_path_planner_common/src/interface/steering_factor_interface.cpp +++ b/common/autoware_motion_utils/src/factor/steering_factor_interface.cpp @@ -1,4 +1,4 @@ -// Copyright 2022 Tier IV, Inc. +// Copyright 2022 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. @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "autoware/behavior_path_planner_common/interface/steering_factor_interface.hpp" +#include -namespace steering_factor_interface +namespace autoware::motion_utils { void SteeringFactorInterface::set( const std::array & pose, const std::array distance, const uint16_t direction, @@ -29,4 +29,4 @@ void SteeringFactorInterface::set( steering_factor_.status = status; steering_factor_.detail = detail; } -} // namespace steering_factor_interface +} // namespace autoware::motion_utils diff --git a/planning/behavior_path_planner/autoware_behavior_path_planner/include/autoware/behavior_path_planner/behavior_path_planner_node.hpp b/planning/behavior_path_planner/autoware_behavior_path_planner/include/autoware/behavior_path_planner/behavior_path_planner_node.hpp index 5085af0d143bf..f0bd4486eb04a 100644 --- a/planning/behavior_path_planner/autoware_behavior_path_planner/include/autoware/behavior_path_planner/behavior_path_planner_node.hpp +++ b/planning/behavior_path_planner/autoware_behavior_path_planner/include/autoware/behavior_path_planner/behavior_path_planner_node.hpp @@ -17,10 +17,10 @@ #include "autoware/behavior_path_planner_common/data_manager.hpp" #include "autoware/behavior_path_planner_common/interface/scene_module_interface.hpp" -#include "autoware/behavior_path_planner_common/interface/steering_factor_interface.hpp" #include "autoware/universe_utils/ros/logger_level_configure.hpp" #include "planner_manager.hpp" +#include #include #include @@ -52,6 +52,7 @@ namespace autoware::behavior_path_planner { +using autoware::motion_utils::SteeringFactorInterface; using autoware_adapi_v1_msgs::msg::OperationModeState; using autoware_map_msgs::msg::LaneletMapBin; using autoware_perception_msgs::msg::PredictedObject; @@ -65,7 +66,6 @@ using autoware_vehicle_msgs::msg::TurnIndicatorsCommand; using nav_msgs::msg::OccupancyGrid; using nav_msgs::msg::Odometry; using rcl_interfaces::msg::SetParametersResult; -using steering_factor_interface::SteeringFactorInterface; using tier4_planning_msgs::msg::AvoidanceDebugMsgArray; using tier4_planning_msgs::msg::LateralOffset; using tier4_planning_msgs::msg::PathWithLaneId; diff --git a/planning/behavior_path_planner/autoware_behavior_path_planner_common/CMakeLists.txt b/planning/behavior_path_planner/autoware_behavior_path_planner_common/CMakeLists.txt index 22faf1a6375d8..ac33966a1bf7c 100644 --- a/planning/behavior_path_planner/autoware_behavior_path_planner_common/CMakeLists.txt +++ b/planning/behavior_path_planner/autoware_behavior_path_planner_common/CMakeLists.txt @@ -8,7 +8,6 @@ find_package(magic_enum CONFIG REQUIRED) ament_auto_add_library(${PROJECT_NAME} SHARED src/turn_signal_decider.cpp - src/interface/steering_factor_interface.cpp src/interface/scene_module_visitor.cpp src/interface/scene_module_interface.cpp src/interface/scene_module_manager_interface.cpp diff --git a/planning/behavior_path_planner/autoware_behavior_path_planner_common/include/autoware/behavior_path_planner_common/interface/scene_module_interface.hpp b/planning/behavior_path_planner/autoware_behavior_path_planner_common/include/autoware/behavior_path_planner_common/interface/scene_module_interface.hpp index 997009edf0f43..60a5faf6cd929 100644 --- a/planning/behavior_path_planner/autoware_behavior_path_planner_common/include/autoware/behavior_path_planner_common/interface/scene_module_interface.hpp +++ b/planning/behavior_path_planner/autoware_behavior_path_planner_common/include/autoware/behavior_path_planner_common/interface/scene_module_interface.hpp @@ -20,8 +20,8 @@ #include "autoware/behavior_path_planner_common/marker_utils/utils.hpp" #include "autoware/behavior_path_planner_common/utils/utils.hpp" -#include #include +#include #include #include #include @@ -35,8 +35,7 @@ #include #include -#include -#include +#include #include #include #include @@ -57,6 +56,7 @@ namespace autoware::behavior_path_planner { +using autoware::motion_utils::SteeringFactorInterface; using autoware::objects_of_interest_marker_interface::ColorName; using autoware::objects_of_interest_marker_interface::ObjectsOfInterestMarkerInterface; using autoware::rtc_interface::RTCInterface; @@ -64,7 +64,6 @@ using autoware::universe_utils::calcOffsetPose; using autoware::universe_utils::generateUUID; using autoware_adapi_v1_msgs::msg::PlanningBehavior; using autoware_adapi_v1_msgs::msg::SteeringFactor; -using steering_factor_interface::SteeringFactorInterface; using tier4_planning_msgs::msg::AvoidanceDebugMsgArray; using tier4_planning_msgs::msg::PathWithLaneId; using tier4_planning_msgs::msg::StopFactor; @@ -74,7 +73,6 @@ using tier4_rtc_msgs::msg::State; using unique_identifier_msgs::msg::UUID; using visualization_msgs::msg::MarkerArray; using PlanResult = PathWithLaneId::SharedPtr; -using autoware_adapi_v1_msgs::msg::PlanningBehavior; enum class ModuleStatus { IDLE = 0, diff --git a/planning/behavior_path_planner/autoware_behavior_path_planner_common/include/autoware/behavior_path_planner_common/interface/scene_module_manager_interface.hpp b/planning/behavior_path_planner/autoware_behavior_path_planner_common/include/autoware/behavior_path_planner_common/interface/scene_module_manager_interface.hpp index 5b61ea8152367..65df5e15dad41 100644 --- a/planning/behavior_path_planner/autoware_behavior_path_planner_common/include/autoware/behavior_path_planner_common/interface/scene_module_manager_interface.hpp +++ b/planning/behavior_path_planner/autoware_behavior_path_planner_common/include/autoware/behavior_path_planner_common/interface/scene_module_manager_interface.hpp @@ -106,7 +106,7 @@ class SceneModuleManagerInterface void publishSteeringFactor() { - autoware_adapi_v1_msgs::msg::SteeringFactorArray steering_factor_array; + SteeringFactorArray steering_factor_array; steering_factor_array.header.frame_id = "map"; steering_factor_array.header.stamp = node_->now();