Autoware.Auto
smooth_stop.hpp
Go to the documentation of this file.
1 // Copyright 2021 Tier IV, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef TRAJECTORY_FOLLOWER__SMOOTH_STOP_HPP_
16 #define TRAJECTORY_FOLLOWER__SMOOTH_STOP_HPP_
17 
18 #include <algorithm>
19 #include <cmath>
20 #include <experimental/optional> // NOLINT
21 #include <limits>
22 #include <utility>
23 #include <vector>
24 
25 #include "common/types.hpp"
26 #include "rclcpp/rclcpp.hpp"
28 
29 
30 namespace autoware
31 {
32 namespace motion
33 {
34 namespace control
35 {
36 namespace trajectory_follower
37 {
43 class TRAJECTORY_FOLLOWER_PUBLIC SmoothStop
44 {
45 public:
51  void init(const float64_t pred_vel_in_target, const float64_t pred_stop_dist);
52 
67  void setParams(
68  float64_t max_strong_acc, float64_t min_strong_acc, float64_t weak_acc, float64_t weak_stop_acc,
69  float64_t strong_stop_acc, float64_t min_fast_vel, float64_t min_running_vel,
70  float64_t min_running_acc,
71  float64_t weak_stop_time, float64_t weak_stop_dist, float64_t strong_stop_dist);
72 
79  std::experimental::optional<float64_t> calcTimeToStop(
80  const std::vector<std::pair<rclcpp::Time, float64_t>> & vel_hist) const;
81 
95  float64_t calculate(
96  const float64_t stop_dist, const float64_t current_vel, const float64_t current_acc,
97  const std::vector<std::pair<rclcpp::Time, float64_t>> & vel_hist, const float64_t delay_time);
98 
99 private:
100  struct Params
101  {
102  float64_t max_strong_acc;
103  float64_t min_strong_acc;
104  float64_t weak_acc;
105  float64_t weak_stop_acc;
106  float64_t strong_stop_acc;
107 
108  float64_t min_fast_vel;
109  float64_t min_running_vel;
110  float64_t min_running_acc;
111  float64_t weak_stop_time;
112 
113  float64_t weak_stop_dist;
114  float64_t strong_stop_dist;
115  };
116  Params m_params;
117 
118  float64_t m_strong_acc;
119  rclcpp::Time m_weak_acc_time;
120  bool8_t m_is_set_params = false;
121 };
122 } // namespace trajectory_follower
123 } // namespace control
124 } // namespace motion
125 } // namespace autoware
126 
127 #endif // TRAJECTORY_FOLLOWER__SMOOTH_STOP_HPP_
autoware::motion::control::trajectory_follower::SmoothStop
Smooth stop class to implement vehicle specific deceleration profiles.
Definition: smooth_stop.hpp:43
visibility_control.hpp
types.hpp
This file includes common type definition.
autoware::common::types::bool8_t
bool bool8_t
Definition: types.hpp:39
autoware
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24
autoware::motion::control::trajectory_follower
Definition: debug_values.hpp:29
motion
Definition: controller_base.hpp:31
autoware::common::types::float64_t
double float64_t
Definition: types.hpp:47