diff --git a/planning/adaptive_cruise_controller/CMakeLists.txt b/planning/adaptive_cruise_controller/CMakeLists.txt
new file mode 100644
index 0000000000000..4d2adde6f1197
--- /dev/null
+++ b/planning/adaptive_cruise_controller/CMakeLists.txt
@@ -0,0 +1,50 @@
+cmake_minimum_required(VERSION 3.5)
+project(adaptive_cruise_controller)
+
+if(NOT CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 14)
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+ set(CMAKE_CXX_EXTENSIONS OFF)
+endif()
+if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ add_compile_options(-Wall -Wextra -Wpedantic -Werror)
+endif()
+
+find_package(ament_cmake_auto REQUIRED)
+ament_auto_find_build_dependencies()
+
+find_package(OpenCV REQUIRED)
+
+ament_auto_add_library(adaptive_cruise_controller SHARED
+ src/adaptive_cruise_control.cpp
+ src/adaptive_cruise_control_core.cpp
+ src/acc_pid.cpp
+ src/debug_marker.cpp
+ src/utilities.cpp
+)
+
+target_include_directories(adaptive_cruise_controller
+ PUBLIC
+ ${OpenCV_INCLUDE_DIRS}
+)
+
+target_link_libraries(adaptive_cruise_controller
+ ${OpenCV_LIBRARIES}
+)
+
+
+rclcpp_components_register_node(adaptive_cruise_controller
+ PLUGIN "motion_planning::AdaptiveCruiseControllerNode"
+ EXECUTABLE adaptive_cruise_controller_node
+)
+
+if(BUILD_TESTING)
+ find_package(ament_lint_auto REQUIRED)
+ ament_lint_auto_find_test_dependencies()
+endif()
+
+ament_auto_package(
+ INSTALL_TO_SHARE
+ config
+ launch
+)
diff --git a/planning/adaptive_cruise_controller/README.md b/planning/adaptive_cruise_controller/README.md
new file mode 100644
index 0000000000000..9e241706c6302
--- /dev/null
+++ b/planning/adaptive_cruise_controller/README.md
@@ -0,0 +1,25 @@
+# Adaptive Cruise Controller
+
+## Overview
+
+## Input topics
+
+| Name | Type | Description |
+| --------------------------- | ----------------------------------------------- | ----------------- |
+| `~/input/trajectory` | autoware_auto_planning_msgs::Trajectory | trajectory |
+| `~/input/odometry` | nav_msgs::Odometry | vehicle velocity |
+| `~/input/predicted_objects` | autoware_auto_perception_msgs::PredictedObjects | dynamic objects |
+
+## Output topics
+
+| Name | Type | Description |
+| ---------------------- | --------------------------------------- | -------------------------------------- |
+| `~output/trajectory` | autoware_auto_planning_msgs::Trajectory | trajectory to be followed |
+| `~output/stop_reasons` | tier4_planning_msgs::StopReasonArray | reasons that cause the vehicle to stop |
+
+
+## Role
+
+## Flowchart
+
+## Known Limits
diff --git a/planning/adaptive_cruise_controller/config/adaptive_cruise_control.param.yaml b/planning/adaptive_cruise_controller/config/adaptive_cruise_control.param.yaml
new file mode 100644
index 0000000000000..e744f1c540a11
--- /dev/null
+++ b/planning/adaptive_cruise_controller/config/adaptive_cruise_control.param.yaml
@@ -0,0 +1,25 @@
+/**:
+ ros__parameters:
+ decimate_step_length: 1.0
+ trajectory_extend_length: 5.0
+ rough_detection_area_expand_length: 3.0
+ detection_area_expand_length: 0.0
+ object_threshold_angle: 0.523
+ predicted_path_threshold_angle: 0.523
+ mininum_overlap_time_of_predicted_path: 2.0
+
+
+
+ object_low_velocity_thresh: 3.0 # if object velocity is lower than this value, adaptive cruise becomes disable.
+ object_stop_velocity_thresh: 1.0 # if object velocity is lower than this value, ignore the sign of object orientation
+ object_velocity_hysteresis_margin: 1.0 # hysteresis margin to change acc state for preventing chattering
+ reset_time_to_acc_state: 1.0
+ velocity_to_accleration_weight: 0.3 # target accleration is calculated by (target_velocity - current_velocity) * velocity_to_accleration_weight
+ acc_min_acceleration: -1.5
+ acc_min_jerk: -1.0
+ stop_min_acceleration: -3.0
+ object_min_acceleration: -3.0
+ minimum_margin_distance: 5.0
+ idling_time: 1.0
+ breaking_delay_time: 0.5
+ p_term_in_velocity_pid: 0.3
diff --git a/planning/adaptive_cruise_controller/config/plot_jugger_adaptive_cruise.control.xml b/planning/adaptive_cruise_controller/config/plot_jugger_adaptive_cruise.control.xml
new file mode 100644
index 0000000000000..b3f8719e8c43c
--- /dev/null
+++ b/planning/adaptive_cruise_controller/config/plot_jugger_adaptive_cruise.control.xml
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/acc_pid.hpp b/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/acc_pid.hpp
new file mode 100644
index 0000000000000..e45705035cf43
--- /dev/null
+++ b/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/acc_pid.hpp
@@ -0,0 +1,53 @@
+// Copyright 2020 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.
+// 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.
+
+#ifndef ADAPTIVE_CRUISE_CONTROLLER__ACC_PID_HPP_
+#define ADAPTIVE_CRUISE_CONTROLLER__ACC_PID_HPP_
+
+#include
+#include
+
+namespace motion_planning
+{
+
+class AccPidNode
+{
+public:
+ explicit AccPidNode(const double baselink2front, const AccParam & acc_param);
+
+ void updateState(
+ const rclcpp::Time & current_time, const double ego_velocity, const double obstacle_velocity,
+ const double dist_to_obstacle);
+ State getState() { return current_state_; }
+ void calculate(const AdaptiveCruiseInformation & acc_info, AccMotion & acc_motion);
+
+private:
+ double calcStoppingDistFromCurrentVel(const double current_velocity);
+ double calcEmergencyDistFromVel(const double current_velocity, const double obj_velocity);
+ void calculateTargetMotion(const AdaptiveCruiseInformation & acc_info, AccMotion & acc_motion);
+ void calcTrajectoryWithStopPoints(
+ const AdaptiveCruiseInformation & acc_info, AccMotion & acc_motion);
+ TrajectoryPoints insertStopPoint(
+ const double stop_distance_from_ego, const TrajectoryPoints & trajectory_points,
+ const geometry_msgs::msg::Pose & ego_pose, geometry_msgs::msg::Pose & stop_pose);
+
+ double baselink2front_;
+ AccParam acc_param_;
+ State current_state_ = State::NONE;
+ std::shared_ptr prev_acc_info_ptr_;
+};
+
+} // namespace motion_planning
+
+#endif // ADAPTIVE_CRUISE_CONTROLLER__ACC_PID_HPP_
diff --git a/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/adaptive_cruise_control.hpp b/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/adaptive_cruise_control.hpp
new file mode 100644
index 0000000000000..99e184b3c4124
--- /dev/null
+++ b/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/adaptive_cruise_control.hpp
@@ -0,0 +1,174 @@
+// Copyright 2020 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.
+// 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.
+
+#ifndef ADAPTIVE_CRUISE_CONTROLLER__ADAPTIVE_CRUISE_CONTROL_HPP_
+#define ADAPTIVE_CRUISE_CONTROLLER__ADAPTIVE_CRUISE_CONTROL_HPP_
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+namespace motion_planning
+{
+namespace bg = boost::geometry;
+using autoware_auto_perception_msgs::msg::ObjectClassification;
+using autoware_auto_perception_msgs::msg::PredictedObject;
+using autoware_auto_perception_msgs::msg::PredictedObjects;
+using autoware_auto_perception_msgs::msg::PredictedPath;
+using autoware_auto_planning_msgs::msg::Trajectory;
+using autoware_auto_planning_msgs::msg::TrajectoryPoint;
+using tier4_planning_msgs::msg::VelocityLimit;
+using tier4_planning_msgs::msg::VelocityLimitClearCommand;
+using TrajectoryPoints = std::vector;
+using nav_msgs::msg::Odometry;
+using tier4_autoware_utils::Point2d;
+using tier4_autoware_utils::Polygon2d;
+using vehicle_info_util::VehicleInfo;
+
+enum class CUT_IN_OUT {
+ NONE = 0,
+ CUT_IN = 1,
+ CUT_OUT = 2,
+};
+
+class AdaptiveCruiseControllerNode : public rclcpp::Node
+{
+public:
+ explicit AdaptiveCruiseControllerNode(const rclcpp::NodeOptions & options);
+
+private:
+ struct Param
+ {
+ // step length of decimated trajectory
+ double decimate_step_length;
+
+ // length to extend trajectory forward for
+ double trajectory_extend_length;
+
+ // length to expand rough detection area
+ double rough_detection_area_expand_length;
+
+ // length to expand detection area
+ double detection_area_expand_length;
+
+ // minimum diff-angle between object and trajectory to be considered as a target objects
+ double object_threshold_angle;
+
+ // minimum diff-angle between preidcted_path and trajectory to be considered as a target objects
+ double predicted_path_threshold_angle;
+
+ // minimum overlap time of predicted path and trajectory to be considered as a target objects
+ double mininum_overlap_time_of_predicted_path;
+ };
+ Param param_;
+
+ AccParam acc_param_;
+
+ rclcpp::Publisher::SharedPtr pub_trajectory_;
+ rclcpp::Publisher::SharedPtr pub_clear_velocity_limit_;
+ rclcpp::Publisher::SharedPtr pub_velocity_limit_;
+ rclcpp::Subscription::SharedPtr sub_trajectory_;
+ rclcpp::Subscription::SharedPtr sub_objects_;
+ rclcpp::Subscription::SharedPtr sub_odometry_;
+
+ tier4_autoware_utils::SelfPoseListener self_pose_listener_;
+
+ void onTrajectory(const Trajectory::ConstSharedPtr msg);
+ void onPredictedObjects(const PredictedObjects::ConstSharedPtr msg);
+ void onOdometry(const Odometry::ConstSharedPtr msg);
+
+ bool isDataReady();
+ TrajectoryPoints trimTrajectoryWithIndexFromSelfPose(
+ const TrajectoryPoints & input, const geometry_msgs::msg::PoseStamped & self_pose);
+ TrajectoryPoint getExtendTrajectoryPoint(
+ const double extend_distance, const TrajectoryPoint & goal_point);
+ TrajectoryPoints extendTrajectory(const TrajectoryPoints & input, const double extend_distance);
+ TrajectoryPoints decimateTrajectory(const TrajectoryPoints & input, const double step_length);
+ TrajectoryPoint getBackwardPointFromBasePoint(
+ const TrajectoryPoint & p_from, const TrajectoryPoint & p_to, const TrajectoryPoint & p_base,
+ const double backward_length);
+ void createPolygonFromTrajectoryPoints(
+ const TrajectoryPoints & trajectory_points, const double expand_width,
+ std::vector & polygon);
+ void extractVehicleObjectsInPolygon(
+ const PredictedObjects & objects, const std::vector & target_polygons,
+ PredictedObjects & objects_in_polygon);
+ void getTargetObjects(
+ const PredictedObjects & objects, const std::vector & target_polygons,
+ const TrajectoryPoints & target_trajectory, PredictedObjects & target_objects);
+ void getNearestObject(
+ const PredictedObjects & objects, const TrajectoryPoints & trajectory_points,
+ PredictedObject & nearest_object);
+ VelocityLimit createVelocityLimitMsg(
+ const double velocity, const double acceleration, const double jerk);
+ VelocityLimitClearCommand createVelocityLimitClearCommandMsg();
+
+ PredictedPath getHighestConfidencePathFromObject(const PredictedObject & object);
+ geometry_msgs::msg::Pose getObjectPose(const PredictedObject & object);
+ bool isObjectVelocityHigh(const PredictedObject & object);
+ bool isTargetObjectType(const PredictedObject & object);
+
+ Odometry::ConstSharedPtr current_odometry_ptr_;
+ PredictedObjects::ConstSharedPtr current_objects_ptr_;
+ geometry_msgs::msg::PoseStamped::ConstSharedPtr current_pose_;
+ VehicleInfo vehicle_info_;
+
+ std::shared_ptr controller_ptr_;
+
+ // only for debug
+ void fillAndPublishDebugOutput(const PredictedObject & target_object);
+ void publishDebugOutputWithNoTarget();
+ double calcAcc(
+ const geometry_msgs::msg::TwistStamped & twist,
+ std::shared_ptr & prev_twist, const double prev_acc,
+ const double lowpass_gain = 0.6, const double timeout = 1.0);
+
+ void resetObjectTwistHistory();
+ CUT_IN_OUT detectCutInAndOut(
+ AdaptiveCruiseInformation acc_info, const double threshold_length = 10.0);
+
+ geometry_msgs::msg::TwistStamped toTwistStamped(
+ const std_msgs::msg::Header & header, const geometry_msgs::msg::Twist & twist);
+
+ std::shared_ptr debug_node_ptr_;
+ std::shared_ptr prev_acc_info_;
+ std::shared_ptr prev_ego_twist_;
+ double ego_accel_ = 0.0;
+ std::shared_ptr prev_object_twist_;
+ double obj_accel_ = 0.0;
+
+ bool need_to_clear_velocity_limit_ = false;
+};
+
+} // namespace motion_planning
+
+#endif // ADAPTIVE_CRUISE_CONTROLLER__ADAPTIVE_CRUISE_CONTROL_HPP_
diff --git a/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/adaptive_cruise_control_core.hpp b/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/adaptive_cruise_control_core.hpp
new file mode 100644
index 0000000000000..6b1e31559b93a
--- /dev/null
+++ b/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/adaptive_cruise_control_core.hpp
@@ -0,0 +1,69 @@
+// Copyright 2020 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.
+// 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.
+
+#ifndef ADAPTIVE_CRUISE_CONTROLLER__ADAPTIVE_CRUISE_CONTROL_CORE_HPP_
+#define ADAPTIVE_CRUISE_CONTROLLER__ADAPTIVE_CRUISE_CONTROL_CORE_HPP_
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+namespace motion_planning
+{
+
+using autoware_auto_perception_msgs::msg::PredictedObject;
+using autoware_auto_planning_msgs::msg::TrajectoryPoint;
+using TrajectoryPoints = std::vector;
+using nav_msgs::msg::Odometry;
+
+class AdaptiveCruiseControlCore
+{
+public:
+ explicit AdaptiveCruiseControlCore(const double baselink2front, const AccParam & acc_param);
+ std::shared_ptr getAccInfoPtr() { return acc_info_ptr_; }
+ std::shared_ptr getPrevAccInfoPtr() { return prev_acc_info_ptr_; }
+
+ void calcInformationForAdaptiveCruise(
+ const TrajectoryPoints & trajectory_points, const geometry_msgs::msg::PoseStamped & pose,
+ const Odometry & odometry, const PredictedObject & object, const rclcpp::Time & object_time);
+
+ void calculate();
+ bool getTargetMotion(double & target_velocity, double & target_acc, double & target_jerk);
+ TrajectoryPoints getAccTrajectory(bool & emergency_flag);
+ State getState();
+ AccMotion getAccMotion() { return acc_motion_; };
+
+private:
+ // parameter
+ double baselink2front_;
+ AccParam acc_param_;
+
+ // variables
+ std::shared_ptr acc_pid_node_ptr_;
+ double prev_target_velocity_;
+ std::shared_ptr acc_info_ptr_;
+ std::shared_ptr prev_acc_info_ptr_;
+ AccMotion acc_motion_;
+
+ // functions
+ double getIdealDistanceToObject(const double current_velocity, const double object_velocity);
+};
+
+} // namespace motion_planning
+
+#endif // ADAPTIVE_CRUISE_CONTROLLER__ADAPTIVE_CRUISE_CONTROL_CORE_HPP_
diff --git a/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/debug_marker.hpp b/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/debug_marker.hpp
new file mode 100644
index 0000000000000..0e7ba84f77356
--- /dev/null
+++ b/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/debug_marker.hpp
@@ -0,0 +1,122 @@
+// Copyright 2020 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.
+// 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.
+#ifndef ADAPTIVE_CRUISE_CONTROLLER__DEBUG_MARKER_HPP_
+#define ADAPTIVE_CRUISE_CONTROLLER__DEBUG_MARKER_HPP_
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+namespace motion_planning
+{
+
+using autoware_auto_perception_msgs::msg::PredictedObject;
+using autoware_auto_perception_msgs::msg::Shape;
+using tier4_debug_msgs::msg::Float32MultiArrayStamped;
+using visualization_msgs::msg::Marker;
+using visualization_msgs::msg::MarkerArray;
+
+class DebugValues
+{
+public:
+ enum class TYPE {
+ CURRENT_VEL = 0,
+ CURRENT_ACC = 1,
+ CURRENT_OBJECT_VEL = 2,
+ CURRENT_OBJECT_VEL_DIFF_DIST = 3,
+ CURRENT_OBJECT_ACC = 4,
+ CURRENT_OBJECT_DISTANCE = 5,
+ IDEAL_OBJECT_DISTANCE = 6,
+ FLAG_CUTIN_OBJECT = 7,
+ FLAG_CUTOUT_OBJECT = 8,
+ FLAG_FIND_OBJECT = 9,
+ FLAG_ADAPTIVE_CRUISE = 10,
+ FLAG_STOP = 11,
+ FLAG_NONE = 12,
+ CURRENT_TARGET_VELOCITY = 13,
+ SIZE
+ };
+
+ /**
+ * @brief get the index corresponding to the given value TYPE
+ * @param [in] type the TYPE enum for which to get the index
+ * @return index of the type
+ */
+ int getValuesIdx(const TYPE type) const { return static_cast(type); }
+ /**
+ * @brief get all the debug values as an std::array
+ * @return array of all debug values
+ */
+ std::array(TYPE::SIZE)> getValues() const { return values_; }
+ /**
+ * @brief set the given type to the given value
+ * @param [in] type TYPE of the value
+ * @param [in] value value to set
+ */
+ void setValues(const TYPE type, const double val) { values_.at(static_cast(type)) = val; }
+ /**
+ * @brief set the given type to the given value
+ * @param [in] type index of the type
+ * @param [in] value value to set
+ */
+ void setValues(const int type, const double val) { values_.at(type) = val; }
+
+ void resetValues() { values_.fill(0.0); }
+
+private:
+ static constexpr int num_debug_values_ = static_cast(TYPE::SIZE);
+ std::array(TYPE::SIZE)> values_;
+};
+
+class AdaptiveCruiseControllerDebugNode
+{
+public:
+ explicit AdaptiveCruiseControllerDebugNode(rclcpp::Node * node);
+ void setDebugValues(const DebugValues::TYPE type, const double val)
+ {
+ debug_values_.setValues(type, val);
+ }
+ void resetDebugValues(){
+ debug_values_.resetValues();
+ }
+ void setVirtualWall(
+ const geometry_msgs::msg::Pose & stop_pose, const double offset, const bool is_stop_wall);
+ void setTargetPolygon(const PredictedObject & object);
+ void clearMarker();
+ void clearVirtualWall();
+ void clearTargetPolygon();
+ void publish();
+ void publishMarker();
+ void publishDebugValues();
+
+private:
+ Float32MultiArrayStamped convertDebugValuesToMsg(const DebugValues debug_value);
+
+ rclcpp::Node * node_;
+
+ rclcpp::Publisher::SharedPtr pub_debug_marker_;
+ rclcpp::Publisher::SharedPtr pub_debug_value_;
+ DebugValues debug_values_;
+ std::shared_ptr target_vehicle_marker_ptr_;
+ std::shared_ptr virtual_wall_marker_ptr_;
+};
+
+} // namespace motion_planning
+
+#endif // OBSTACLE_STOP_PLANNER__DEBUG_MARKER_HPP_
diff --git a/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/utilities.hpp b/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/utilities.hpp
new file mode 100644
index 0000000000000..2182f3b19d705
--- /dev/null
+++ b/planning/adaptive_cruise_controller/include/adaptive_cruise_controller/utilities.hpp
@@ -0,0 +1,118 @@
+// Copyright 2020 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.
+// 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.
+
+#ifndef ADAPTIVE_CRUISE_CONTROLLER__UTILITIES_HPP_
+#define ADAPTIVE_CRUISE_CONTROLLER__UTILITIES_HPP_
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+namespace motion_planning
+{
+
+namespace bg = boost::geometry;
+
+using autoware_auto_perception_msgs::msg::PredictedObject;
+using autoware_auto_perception_msgs::msg::PredictedPath;
+using autoware_auto_planning_msgs::msg::Trajectory;
+using autoware_auto_planning_msgs::msg::TrajectoryPoint;
+using TrajectoryPoints = std::vector;
+using tier4_autoware_utils::Point2d;
+using tier4_autoware_utils::Polygon2d;
+
+struct AccParam
+{
+ double object_low_velocity_thresh;
+ double object_stop_velocity_thresh;
+ double object_velocity_hysteresis_margin;
+ double reset_time_to_acc_state;
+ double velocity_to_accleration_weight;
+ double acc_min_acceleration;
+ double acc_min_jerk;
+ double stop_min_acceleration;
+ double object_min_acceleration;
+ double minimum_margin_distance;
+ double idling_time;
+ double breaking_delay_time;
+ double p_term_in_velocity_pid;
+};
+
+enum State { NONE = 0, ACC = 1, STOP = 2 };
+
+struct AccMotion
+{
+ bool use_target_motion;
+ double target_velocity;
+ double target_acceleration;
+ double target_jerk;
+ bool use_trajectory;
+ TrajectoryPoints planned_trajectory;
+ geometry_msgs::msg::Pose stop_pose;
+ bool emergency; // true when ACC makes a plan to collide with a car in front
+};
+
+struct AdaptiveCruiseInformation
+{
+ rclcpp::Time info_time; // current time of pose stamped
+ double current_ego_velocity;
+ double current_object_velocity;
+ double current_distance_to_object;
+ double ideal_distance_to_object;
+ geometry_msgs::msg::Pose current_ego_pose;
+ PredictedObject target_object;
+ TrajectoryPoints original_trajectory;
+};
+
+void convexHull(const std::vector & points, std::vector & polygon_points);
+bool isObjectWithinPolygon(
+ const std::vector & target_polygons, const Polygon2d & object_polygon,
+ const double overlap_threshold = 0.1);
+bool getDiffAngleWithTrajectory(
+ const geometry_msgs::msg::Pose & pose, const TrajectoryPoints & trajectory_points,
+ double & diff_angle);
+bool isAngleAlignedWithTrajectory(
+ const geometry_msgs::msg::Pose & pose, const TrajectoryPoints & trajectory_points,
+ const double threshold_angle);
+bool isPoseNearTrajectory(
+ const geometry_msgs::msg::Pose & pose, const TrajectoryPoints & trajectory_points,
+ const double threshold_dist, const double threshold_angle);
+bool isPathNearTrajectory(
+ const PredictedPath & path, const TrajectoryPoints & trajectory_points,
+ const double threshold_dist, const double threshold_angle, const double minmum_overlap_time);
+
+void convertObjectToBoostPolygon(const PredictedObject & object, Polygon2d & object_polygon);
+void convertcvPointsToBoostPolygon(
+ const std::vector & points, Polygon2d & object_polygon);
+bool isClockWise(const Polygon2d & polygon);
+Polygon2d inverseClockWise(const Polygon2d & polygon);
+geometry_msgs::msg::Pose lerpByPose(
+ const geometry_msgs::msg::Pose & p1, const geometry_msgs::msg::Pose & p2, const double t);
+
+} // namespace motion_planning
+
+#endif // ADAPTIVE_CRUISE_CONTROLLER__UTILITIES_HPP_
diff --git a/planning/adaptive_cruise_controller/launch/adaptive_cruise_controller.launch.xml b/planning/adaptive_cruise_controller/launch/adaptive_cruise_controller.launch.xml
new file mode 100644
index 0000000000000..84edd6eac030b
--- /dev/null
+++ b/planning/adaptive_cruise_controller/launch/adaptive_cruise_controller.launch.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/planning/adaptive_cruise_controller/package.xml b/planning/adaptive_cruise_controller/package.xml
new file mode 100644
index 0000000000000..5f3796b26957a
--- /dev/null
+++ b/planning/adaptive_cruise_controller/package.xml
@@ -0,0 +1,37 @@
+
+
+ adaptive_cruise_controller
+ 0.1.0
+ The adaptive_cruise_controller package
+
+ Tomoya Kimura
+
+ Apache License 2.0
+
+ ament_cmake_auto
+
+ autoware_auto_perception_msgs
+ autoware_auto_planning_msgs
+ diagnostic_msgs
+ nav_msgs
+ rclcpp
+ rclcpp_components
+ std_msgs
+ tf2
+ tf2_eigen
+ tf2_geometry_msgs
+ tf2_ros
+ tier4_autoware_utils
+ tier4_debug_msgs
+ tier4_planning_msgs
+ vehicle_info_util
+ visualization_msgs
+
+ ament_lint_auto
+ autoware_lint_common
+
+
+ ament_cmake
+
+
+
diff --git a/planning/adaptive_cruise_controller/src/acc_pid.cpp b/planning/adaptive_cruise_controller/src/acc_pid.cpp
new file mode 100644
index 0000000000000..dfbbcf4a5bc5c
--- /dev/null
+++ b/planning/adaptive_cruise_controller/src/acc_pid.cpp
@@ -0,0 +1,207 @@
+// Copyright 2020 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.
+// 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
+
+#include
+#include
+#include