Apollo  6.0
Open source self driving car software
speed_decider.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2017 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 
21 #pragma once
22 
23 #include <memory>
24 #include <string>
25 #include <unordered_map>
26 
30 
31 namespace apollo {
32 namespace planning {
33 
34 class SpeedDecider : public Task {
35  public:
36  SpeedDecider(const TaskConfig& config,
37  const std::shared_ptr<DependencyInjector>& injector);
38 
40  ReferenceLineInfo* reference_line_info) override;
41 
42  private:
43  enum STLocation {
44  ABOVE = 1,
45  BELOW = 2,
46  CROSS = 3,
47  };
48 
49  STLocation GetSTLocation(const PathDecision* const path_decision,
50  const SpeedData& speed_profile,
51  const STBoundary& st_boundary) const;
52 
53  bool CheckKeepClearCrossable(const PathDecision* const path_decision,
54  const SpeedData& speed_profile,
55  const STBoundary& keep_clear_st_boundary) const;
56 
57  bool CheckKeepClearBlocked(const PathDecision* const path_decision,
58  const Obstacle& keep_clear_obstacle) const;
59 
67  bool CheckIsFollow(const Obstacle& obstacle,
68  const STBoundary& boundary) const;
69 
70  bool CheckStopForPedestrian(const Obstacle& obstacle) const;
71 
72  bool CreateStopDecision(const Obstacle& obstacle,
73  ObjectDecisionType* const stop_decision,
74  double stop_distance) const;
75 
79  bool CreateFollowDecision(const Obstacle& obstacle,
80  ObjectDecisionType* const follow_decision) const;
81 
85  bool CreateYieldDecision(const Obstacle& obstacle,
86  ObjectDecisionType* const yield_decision) const;
87 
91  bool CreateOvertakeDecision(
92  const Obstacle& obstacle,
93  ObjectDecisionType* const overtake_decision) const;
94 
95  common::Status MakeObjectDecision(const SpeedData& speed_profile,
96  PathDecision* const path_decision) const;
97 
98  void AppendIgnoreDecision(Obstacle* obstacle) const;
99 
105  bool IsFollowTooClose(const Obstacle& obstacle) const;
106 
107  private:
108  SLBoundary adc_sl_boundary_;
109  common::TrajectoryPoint init_point_;
110  const ReferenceLine* reference_line_ = nullptr;
111 };
112 
113 } // namespace planning
114 } // namespace apollo
This is the class that associates an Obstacle with its path properties. An obstacle&#39;s path properties...
Definition: obstacle.h:60
Definition: speed_decider.h:34
PathDecision represents all obstacle decisions on one path.
Definition: path_decision.h:38
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Planning module main class. It processes GPS and IMU as input, to generate planning info...
Frame holds all data for one planning cycle.
Definition: frame.h:61
common::Status Execute(Frame *frame, ReferenceLineInfo *reference_line_info) override
ReferenceLineInfo holds all data for one reference line.
Definition: reference_line_info.h:54
Definition: st_boundary.h:38
SpeedDecider(const TaskConfig &config, const std::shared_ptr< DependencyInjector > &injector)
Definition: reference_line.h:39
Definition: task.h:35
A general class to denote the return status of an API call. It can either be an OK status for success...
Definition: status.h:43
Definition: speed_data.h:30