From ed80956e6bf65b86bdd5e90a0642d3562e11cef6 Mon Sep 17 00:00:00 2001 From: "Takagi, Isamu" Date: Wed, 10 Aug 2022 17:35:04 +0900 Subject: [PATCH 1/2] refactor(mission_planner): prepare to support ad api Signed-off-by: Takagi, Isamu --- .../mission_planning.launch.py | 73 ------------------- .../launch/planning.launch.xml | 2 +- planning/mission_planner/CMakeLists.txt | 14 ++-- .../launch/goal_pose_visualizer.launch.xml | 6 +- .../launch/mission_planner.launch.xml | 6 +- .../goal_pose_visualizer.cpp | 2 +- .../goal_pose_visualizer.hpp | 6 +- .../mission_planner/mission_planner.cpp} | 2 +- .../mission_planner/mission_planner.hpp} | 6 +- .../mission_planner_lanelet2.cpp | 4 +- .../mission_planner_lanelet2.hpp | 8 +- .../utility_functions.cpp | 2 +- .../utility_functions.hpp | 6 +- 13 files changed, 32 insertions(+), 105 deletions(-) delete mode 100644 launch/tier4_planning_launch/launch/mission_planning/mission_planning.launch.py rename planning/mission_planner/{include/mission_planner => src/goal_pose_visualizer}/goal_pose_visualizer.hpp (87%) rename planning/mission_planner/{lib/mission_planner_base.cpp => src/mission_planner/mission_planner.cpp} (99%) rename planning/mission_planner/{include/mission_planner/mission_planner_base.hpp => src/mission_planner/mission_planner.hpp} (94%) rename planning/mission_planner/{include/mission_planner/lanelet2_impl => src/mission_planner_lanelet2}/mission_planner_lanelet2.hpp (89%) rename planning/mission_planner/{include/mission_planner/lanelet2_impl => src/mission_planner_lanelet2}/utility_functions.hpp (88%) diff --git a/launch/tier4_planning_launch/launch/mission_planning/mission_planning.launch.py b/launch/tier4_planning_launch/launch/mission_planning/mission_planning.launch.py deleted file mode 100644 index cc3952f93be96..0000000000000 --- a/launch/tier4_planning_launch/launch/mission_planning/mission_planning.launch.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2021 Tier IV, Inc. All rights reserved. -# -# 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. - -import launch -from launch.actions import DeclareLaunchArgument -from launch.substitutions import LaunchConfiguration -from launch_ros.actions import ComposableNodeContainer -from launch_ros.descriptions import ComposableNode - - -def generate_launch_description(): - container = ComposableNodeContainer( - name="mission_planning_container", - namespace="", - package="rclcpp_components", - executable="component_container", - composable_node_descriptions=[ - ComposableNode( - package="mission_planner", - plugin="mission_planner::MissionPlannerLanelet2", - name="mission_planner", - remappings=[ - ("input/vector_map", "/map/vector_map"), - ("input/goal_pose", "/planning/mission_planning/goal"), - ("input/checkpoint", "/planning/mission_planning/checkpoint"), - ("output/route", "/planning/mission_planning/route"), - ("debug/route_marker", "/planning/mission_planning/route_marker"), - ], - parameters=[ - { - "map_frame": "map", - "base_link_frame": "base_link", - } - ], - extra_arguments=[ - {"use_intra_process_comms": LaunchConfiguration("use_intra_process")} - ], - ), - ComposableNode( - package="mission_planner", - plugin="mission_planner::GoalPoseVisualizer", - name="goal_pose_visualizer", - remappings=[ - ("input/route", "/planning/mission_planning/route"), - ("output/goal_pose", "/planning/mission_planning/echo_back_goal_pose"), - ], - extra_arguments=[ - {"use_intra_process_comms": LaunchConfiguration("use_intra_process")} - ], - ), - ], - ) - return launch.LaunchDescription( - [ - DeclareLaunchArgument( - "use_intra_process", - default_value="false", - description="use ROS2 component container communication", - ), - container, - ] - ) diff --git a/launch/tier4_planning_launch/launch/planning.launch.xml b/launch/tier4_planning_launch/launch/planning.launch.xml index c3264496d401c..e179d410e345e 100644 --- a/launch/tier4_planning_launch/launch/planning.launch.xml +++ b/launch/tier4_planning_launch/launch/planning.launch.xml @@ -15,7 +15,7 @@ - + diff --git a/planning/mission_planner/CMakeLists.txt b/planning/mission_planner/CMakeLists.txt index 9b7f7874672bc..eb946565ce761 100644 --- a/planning/mission_planner/CMakeLists.txt +++ b/planning/mission_planner/CMakeLists.txt @@ -4,24 +4,24 @@ project(mission_planner) find_package(autoware_cmake REQUIRED) autoware_package() -ament_auto_add_library(mission_planner_node SHARED - lib/mission_planner_base.cpp +ament_auto_add_library(${PROJECT_NAME} SHARED + src/mission_planner/mission_planner.cpp src/mission_planner_lanelet2/mission_planner_lanelet2.cpp src/mission_planner_lanelet2/utility_functions.cpp ) -rclcpp_components_register_node(mission_planner_node +rclcpp_components_register_node(${PROJECT_NAME} PLUGIN "mission_planner::MissionPlannerLanelet2" - EXECUTABLE mission_planner + EXECUTABLE mission_planner_node ) -ament_auto_add_library(goal_pose_visualizer_node SHARED +ament_auto_add_library(goal_pose_visualizer SHARED src/goal_pose_visualizer/goal_pose_visualizer.cpp ) -rclcpp_components_register_node(goal_pose_visualizer_node +rclcpp_components_register_node(goal_pose_visualizer PLUGIN "mission_planner::GoalPoseVisualizer" - EXECUTABLE goal_pose_visualizer + EXECUTABLE goal_pose_visualizer_node ) ament_auto_package(INSTALL_TO_SHARE diff --git a/planning/mission_planner/launch/goal_pose_visualizer.launch.xml b/planning/mission_planner/launch/goal_pose_visualizer.launch.xml index ad7fc88e6b2a1..e177cd79e38d8 100644 --- a/planning/mission_planner/launch/goal_pose_visualizer.launch.xml +++ b/planning/mission_planner/launch/goal_pose_visualizer.launch.xml @@ -1,9 +1,9 @@ - + - - + + diff --git a/planning/mission_planner/launch/mission_planner.launch.xml b/planning/mission_planner/launch/mission_planner.launch.xml index 6c0461e9d1eeb..cebbca1dfd264 100644 --- a/planning/mission_planner/launch/mission_planner.launch.xml +++ b/planning/mission_planner/launch/mission_planner.launch.xml @@ -1,17 +1,17 @@ - + - + - + diff --git a/planning/mission_planner/src/goal_pose_visualizer/goal_pose_visualizer.cpp b/planning/mission_planner/src/goal_pose_visualizer/goal_pose_visualizer.cpp index 8c6c7388668e5..8767a7e117d0f 100644 --- a/planning/mission_planner/src/goal_pose_visualizer/goal_pose_visualizer.cpp +++ b/planning/mission_planner/src/goal_pose_visualizer/goal_pose_visualizer.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "mission_planner/goal_pose_visualizer.hpp" +#include "goal_pose_visualizer.hpp" namespace mission_planner { diff --git a/planning/mission_planner/include/mission_planner/goal_pose_visualizer.hpp b/planning/mission_planner/src/goal_pose_visualizer/goal_pose_visualizer.hpp similarity index 87% rename from planning/mission_planner/include/mission_planner/goal_pose_visualizer.hpp rename to planning/mission_planner/src/goal_pose_visualizer/goal_pose_visualizer.hpp index 65b3f91e4a9f0..28af8a4cb976c 100644 --- a/planning/mission_planner/include/mission_planner/goal_pose_visualizer.hpp +++ b/planning/mission_planner/src/goal_pose_visualizer/goal_pose_visualizer.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef MISSION_PLANNER__GOAL_POSE_VISUALIZER_HPP_ -#define MISSION_PLANNER__GOAL_POSE_VISUALIZER_HPP_ +#ifndef GOAL_POSE_VISUALIZER__GOAL_POSE_VISUALIZER_HPP_ +#define GOAL_POSE_VISUALIZER__GOAL_POSE_VISUALIZER_HPP_ #include @@ -36,4 +36,4 @@ class GoalPoseVisualizer : public rclcpp::Node }; } // namespace mission_planner -#endif // MISSION_PLANNER__GOAL_POSE_VISUALIZER_HPP_ +#endif // GOAL_POSE_VISUALIZER__GOAL_POSE_VISUALIZER_HPP_ diff --git a/planning/mission_planner/lib/mission_planner_base.cpp b/planning/mission_planner/src/mission_planner/mission_planner.cpp similarity index 99% rename from planning/mission_planner/lib/mission_planner_base.cpp rename to planning/mission_planner/src/mission_planner/mission_planner.cpp index abdcd2e81aabb..e210fc901c56e 100644 --- a/planning/mission_planner/lib/mission_planner_base.cpp +++ b/planning/mission_planner/src/mission_planner/mission_planner.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "mission_planner/mission_planner_base.hpp" +#include "mission_planner.hpp" #include #include diff --git a/planning/mission_planner/include/mission_planner/mission_planner_base.hpp b/planning/mission_planner/src/mission_planner/mission_planner.hpp similarity index 94% rename from planning/mission_planner/include/mission_planner/mission_planner_base.hpp rename to planning/mission_planner/src/mission_planner/mission_planner.hpp index c7c56479f3f2f..9ab1860c5f6f7 100644 --- a/planning/mission_planner/include/mission_planner/mission_planner_base.hpp +++ b/planning/mission_planner/src/mission_planner/mission_planner.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef MISSION_PLANNER__MISSION_PLANNER_BASE_HPP_ -#define MISSION_PLANNER__MISSION_PLANNER_BASE_HPP_ +#ifndef MISSION_PLANNER__MISSION_PLANNER_HPP_ +#define MISSION_PLANNER__MISSION_PLANNER_HPP_ #include #include @@ -70,4 +70,4 @@ class MissionPlanner : public rclcpp::Node }; } // namespace mission_planner -#endif // MISSION_PLANNER__MISSION_PLANNER_BASE_HPP_ +#endif // MISSION_PLANNER__MISSION_PLANNER_HPP_ diff --git a/planning/mission_planner/src/mission_planner_lanelet2/mission_planner_lanelet2.cpp b/planning/mission_planner/src/mission_planner_lanelet2/mission_planner_lanelet2.cpp index b52f1f6b0c0c6..1efc8a9b7c175 100644 --- a/planning/mission_planner/src/mission_planner_lanelet2/mission_planner_lanelet2.cpp +++ b/planning/mission_planner/src/mission_planner_lanelet2/mission_planner_lanelet2.cpp @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "mission_planner/lanelet2_impl/mission_planner_lanelet2.hpp" +#include "mission_planner_lanelet2.hpp" -#include "mission_planner/lanelet2_impl/utility_functions.hpp" +#include "utility_functions.hpp" #include #include diff --git a/planning/mission_planner/include/mission_planner/lanelet2_impl/mission_planner_lanelet2.hpp b/planning/mission_planner/src/mission_planner_lanelet2/mission_planner_lanelet2.hpp similarity index 89% rename from planning/mission_planner/include/mission_planner/lanelet2_impl/mission_planner_lanelet2.hpp rename to planning/mission_planner/src/mission_planner_lanelet2/mission_planner_lanelet2.hpp index 03c60cd28ef03..8e2e642f29512 100644 --- a/planning/mission_planner/include/mission_planner/lanelet2_impl/mission_planner_lanelet2.hpp +++ b/planning/mission_planner/src/mission_planner_lanelet2/mission_planner_lanelet2.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef MISSION_PLANNER__LANELET2_IMPL__MISSION_PLANNER_LANELET2_HPP_ -#define MISSION_PLANNER__LANELET2_IMPL__MISSION_PLANNER_LANELET2_HPP_ +#ifndef MISSION_PLANNER_LANELET2__MISSION_PLANNER_LANELET2_HPP_ +#define MISSION_PLANNER_LANELET2__MISSION_PLANNER_LANELET2_HPP_ #include #include @@ -25,7 +25,7 @@ #include // Autoware -#include "mission_planner/mission_planner_base.hpp" +#include "../mission_planner/mission_planner.hpp" #include @@ -67,4 +67,4 @@ class MissionPlannerLanelet2 : public MissionPlanner }; } // namespace mission_planner -#endif // MISSION_PLANNER__LANELET2_IMPL__MISSION_PLANNER_LANELET2_HPP_ +#endif // MISSION_PLANNER_LANELET2__MISSION_PLANNER_LANELET2_HPP_ diff --git a/planning/mission_planner/src/mission_planner_lanelet2/utility_functions.cpp b/planning/mission_planner/src/mission_planner_lanelet2/utility_functions.cpp index a4f298e6890e7..17a2f3d582150 100644 --- a/planning/mission_planner/src/mission_planner_lanelet2/utility_functions.cpp +++ b/planning/mission_planner/src/mission_planner_lanelet2/utility_functions.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "mission_planner/lanelet2_impl/utility_functions.hpp" +#include "utility_functions.hpp" #include diff --git a/planning/mission_planner/include/mission_planner/lanelet2_impl/utility_functions.hpp b/planning/mission_planner/src/mission_planner_lanelet2/utility_functions.hpp similarity index 88% rename from planning/mission_planner/include/mission_planner/lanelet2_impl/utility_functions.hpp rename to planning/mission_planner/src/mission_planner_lanelet2/utility_functions.hpp index e4616aaaae284..ca83eca5b1874 100644 --- a/planning/mission_planner/include/mission_planner/lanelet2_impl/utility_functions.hpp +++ b/planning/mission_planner/src/mission_planner_lanelet2/utility_functions.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef MISSION_PLANNER__LANELET2_IMPL__UTILITY_FUNCTIONS_HPP_ -#define MISSION_PLANNER__LANELET2_IMPL__UTILITY_FUNCTIONS_HPP_ +#ifndef MISSION_PLANNER_LANELET2__UTILITY_FUNCTIONS_HPP_ +#define MISSION_PLANNER_LANELET2__UTILITY_FUNCTIONS_HPP_ #include #include @@ -43,4 +43,4 @@ void setColor(std_msgs::msg::ColorRGBA * cl, double r, double g, double b, doubl void insertMarkerArray( visualization_msgs::msg::MarkerArray * a1, const visualization_msgs::msg::MarkerArray & a2); std::string toString(const geometry_msgs::msg::Pose & pose); -#endif // MISSION_PLANNER__LANELET2_IMPL__UTILITY_FUNCTIONS_HPP_ +#endif // MISSION_PLANNER_LANELET2__UTILITY_FUNCTIONS_HPP_ From bbad49987fc5651b13dd9c863d314e4e13123fff Mon Sep 17 00:00:00 2001 From: "Takagi, Isamu" Date: Fri, 12 Aug 2022 08:08:12 +0900 Subject: [PATCH 2/2] fix node name Signed-off-by: Takagi, Isamu --- planning/mission_planner/CMakeLists.txt | 12 ++++++------ .../launch/goal_pose_visualizer.launch.xml | 2 +- .../launch/mission_planner.launch.xml | 2 +- .../goal_pose_visualizer/goal_pose_visualizer.cpp | 2 +- .../mission_planner_lanelet2.cpp | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/planning/mission_planner/CMakeLists.txt b/planning/mission_planner/CMakeLists.txt index eb946565ce761..9d7a2d030d41c 100644 --- a/planning/mission_planner/CMakeLists.txt +++ b/planning/mission_planner/CMakeLists.txt @@ -4,24 +4,24 @@ project(mission_planner) find_package(autoware_cmake REQUIRED) autoware_package() -ament_auto_add_library(${PROJECT_NAME} SHARED +ament_auto_add_library(${PROJECT_NAME}_component SHARED src/mission_planner/mission_planner.cpp src/mission_planner_lanelet2/mission_planner_lanelet2.cpp src/mission_planner_lanelet2/utility_functions.cpp ) -rclcpp_components_register_node(${PROJECT_NAME} +rclcpp_components_register_node(${PROJECT_NAME}_component PLUGIN "mission_planner::MissionPlannerLanelet2" - EXECUTABLE mission_planner_node + EXECUTABLE ${PROJECT_NAME} ) -ament_auto_add_library(goal_pose_visualizer SHARED +ament_auto_add_library(goal_pose_visualizer_component SHARED src/goal_pose_visualizer/goal_pose_visualizer.cpp ) -rclcpp_components_register_node(goal_pose_visualizer +rclcpp_components_register_node(goal_pose_visualizer_component PLUGIN "mission_planner::GoalPoseVisualizer" - EXECUTABLE goal_pose_visualizer_node + EXECUTABLE goal_pose_visualizer ) ament_auto_package(INSTALL_TO_SHARE diff --git a/planning/mission_planner/launch/goal_pose_visualizer.launch.xml b/planning/mission_planner/launch/goal_pose_visualizer.launch.xml index e177cd79e38d8..9146c960b206a 100644 --- a/planning/mission_planner/launch/goal_pose_visualizer.launch.xml +++ b/planning/mission_planner/launch/goal_pose_visualizer.launch.xml @@ -2,7 +2,7 @@ - + diff --git a/planning/mission_planner/launch/mission_planner.launch.xml b/planning/mission_planner/launch/mission_planner.launch.xml index cebbca1dfd264..931b23c4bbe1b 100644 --- a/planning/mission_planner/launch/mission_planner.launch.xml +++ b/planning/mission_planner/launch/mission_planner.launch.xml @@ -5,7 +5,7 @@ - + diff --git a/planning/mission_planner/src/goal_pose_visualizer/goal_pose_visualizer.cpp b/planning/mission_planner/src/goal_pose_visualizer/goal_pose_visualizer.cpp index 8767a7e117d0f..157ce13c0b75e 100644 --- a/planning/mission_planner/src/goal_pose_visualizer/goal_pose_visualizer.cpp +++ b/planning/mission_planner/src/goal_pose_visualizer/goal_pose_visualizer.cpp @@ -17,7 +17,7 @@ namespace mission_planner { GoalPoseVisualizer::GoalPoseVisualizer(const rclcpp::NodeOptions & node_options) -: Node("goal_pose_visualizer_node", node_options) +: Node("goal_pose_visualizer", node_options) { sub_route_ = create_subscription( "input/route", rclcpp::QoS{1}.transient_local(), diff --git a/planning/mission_planner/src/mission_planner_lanelet2/mission_planner_lanelet2.cpp b/planning/mission_planner/src/mission_planner_lanelet2/mission_planner_lanelet2.cpp index 1efc8a9b7c175..693377ccf48dc 100644 --- a/planning/mission_planner/src/mission_planner_lanelet2/mission_planner_lanelet2.cpp +++ b/planning/mission_planner/src/mission_planner_lanelet2/mission_planner_lanelet2.cpp @@ -136,7 +136,7 @@ double projectGoalToMap( namespace mission_planner { MissionPlannerLanelet2::MissionPlannerLanelet2(const rclcpp::NodeOptions & node_options) -: MissionPlanner("mission_planner_node", node_options), is_graph_ready_(false) +: MissionPlanner("mission_planner", node_options), is_graph_ready_(false) { using std::placeholders::_1; map_subscriber_ = create_subscription(