From 8781d1d783a65a4b8ba2a85d552384f7f85a8214 Mon Sep 17 00:00:00 2001 From: Zulfaqar Azmi <93502286+zulfaqar-azmi-t4@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:09:09 +0900 Subject: [PATCH 1/2] refactor(traffic_light_module): boost::optional to std::optional (#5912) Signed-off-by: Muhammad Zulfaqar --- .../behavior_velocity_traffic_light_module/package.xml | 1 - .../behavior_velocity_traffic_light_module/src/debug.cpp | 2 -- .../behavior_velocity_traffic_light_module/src/manager.cpp | 1 - .../behavior_velocity_traffic_light_module/src/manager.hpp | 3 ++- .../behavior_velocity_traffic_light_module/src/scene.cpp | 7 ++----- .../behavior_velocity_traffic_light_module/src/scene.hpp | 7 +++---- 6 files changed, 7 insertions(+), 14 deletions(-) diff --git a/planning/behavior_velocity_traffic_light_module/package.xml b/planning/behavior_velocity_traffic_light_module/package.xml index c658f0890b986..39c454e59dcb2 100644 --- a/planning/behavior_velocity_traffic_light_module/package.xml +++ b/planning/behavior_velocity_traffic_light_module/package.xml @@ -24,7 +24,6 @@ eigen geometry_msgs lanelet2_extension - libboost-dev motion_utils pluginlib rclcpp diff --git a/planning/behavior_velocity_traffic_light_module/src/debug.cpp b/planning/behavior_velocity_traffic_light_module/src/debug.cpp index 9a0ba4f37c3c0..b3dedaa29d6ad 100644 --- a/planning/behavior_velocity_traffic_light_module/src/debug.cpp +++ b/planning/behavior_velocity_traffic_light_module/src/debug.cpp @@ -26,8 +26,6 @@ namespace behavior_velocity_planner { -using tier4_autoware_utils::appendMarkerArray; - visualization_msgs::msg::MarkerArray TrafficLightModule::createDebugMarkerArray() { visualization_msgs::msg::MarkerArray debug_marker_array; diff --git a/planning/behavior_velocity_traffic_light_module/src/manager.cpp b/planning/behavior_velocity_traffic_light_module/src/manager.cpp index 908627540bdcc..fa1a516c107b0 100644 --- a/planning/behavior_velocity_traffic_light_module/src/manager.cpp +++ b/planning/behavior_velocity_traffic_light_module/src/manager.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include namespace behavior_velocity_planner { diff --git a/planning/behavior_velocity_traffic_light_module/src/manager.hpp b/planning/behavior_velocity_traffic_light_module/src/manager.hpp index c36c6af1128ce..87213d8a5ed3f 100644 --- a/planning/behavior_velocity_traffic_light_module/src/manager.hpp +++ b/planning/behavior_velocity_traffic_light_module/src/manager.hpp @@ -26,6 +26,7 @@ #include #include +#include namespace behavior_velocity_planner { @@ -57,7 +58,7 @@ class TrafficLightModuleManager : public SceneModuleManagerInterfaceWithRTC // Debug rclcpp::Publisher::SharedPtr pub_tl_state_; - boost::optional first_ref_stop_path_point_index_; + std::optional first_ref_stop_path_point_index_; }; class TrafficLightModulePlugin : public PluginWrapper diff --git a/planning/behavior_velocity_traffic_light_module/src/scene.cpp b/planning/behavior_velocity_traffic_light_module/src/scene.cpp index a74ff8c0cb5e8..d2d18d74a5c1a 100644 --- a/planning/behavior_velocity_traffic_light_module/src/scene.cpp +++ b/planning/behavior_velocity_traffic_light_module/src/scene.cpp @@ -19,7 +19,6 @@ #include #include -#include // To be replaced by std::optional in C++17 #include @@ -31,9 +30,7 @@ #include #include -#include #include -#include #include namespace behavior_velocity_planner @@ -52,14 +49,14 @@ bool getBackwardPointFromBasePoint( return true; } -boost::optional findNearestCollisionPoint( +std::optional findNearestCollisionPoint( const LineString2d & line1, const LineString2d & line2, const Point2d & origin) { std::vector collision_points; bg::intersection(line1, line2, collision_points); if (collision_points.empty()) { - return boost::none; + return std::nullopt; } // check nearest collision point diff --git a/planning/behavior_velocity_traffic_light_module/src/scene.hpp b/planning/behavior_velocity_traffic_light_module/src/scene.hpp index 6e46709267427..c7b2472289bf5 100644 --- a/planning/behavior_velocity_traffic_light_module/src/scene.hpp +++ b/planning/behavior_velocity_traffic_light_module/src/scene.hpp @@ -17,7 +17,6 @@ #include #include -#include #include #include @@ -81,7 +80,7 @@ class TrafficLightModule : public SceneModuleInterface inline State getTrafficLightModuleState() const { return state_; } - inline boost::optional getFirstRefStopPathPointIndex() const + inline std::optional getFirstRefStopPathPointIndex() const { return first_ref_stop_path_point_index_; } @@ -130,9 +129,9 @@ class TrafficLightModule : public SceneModuleInterface // prevent stop chattering std::unique_ptr