Apollo  6.0
Open source self driving car software
rule_based_stop_decider.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2019 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 
17 #pragma once
18 #include <memory>
19 
21 #include "modules/planning/proto/planning_config.pb.h"
23 
24 namespace apollo {
25 namespace planning {
26 
27 class RuleBasedStopDecider : public Decider {
28  public:
29  RuleBasedStopDecider(const TaskConfig& config,
30  const std::shared_ptr<DependencyInjector>& injector);
31 
32  private:
33  apollo::common::Status Process(
34  Frame* const frame,
35  ReferenceLineInfo* const reference_line_info) override;
36 
37  // @brief Rule-based stop at path end
38  void AddPathEndStop(Frame* const frame,
39  ReferenceLineInfo* const reference_line_info);
40 
41  // @brief Rule-based stop for urgent lane change
42  void CheckLaneChangeUrgency(Frame* const frame);
43 
44  // @brief Rule-based stop for side pass on reverse lane
45  void StopOnSidePass(Frame* const frame,
46  ReferenceLineInfo* const reference_line_info);
47 
48  // @brief Check if necessary to set stop fence used for nonscenario side pass
49  bool CheckSidePassStop(const PathData& path_data,
50  const ReferenceLineInfo& reference_line_info,
51  double* stop_s_on_pathdata);
52 
53  // @brief Set stop fence for side pass
54  bool BuildSidePassStopFence(const PathData& path_data,
55  const double stop_s_on_pathdata,
56  common::PathPoint* stop_point, Frame* const frame,
57  ReferenceLineInfo* const reference_line_info);
58 
59  // @brief Check if ADV stop at a stop fence
60  bool CheckADCStop(const PathData& path_data,
61  const ReferenceLineInfo& reference_line_info,
62  const double stop_s_on_pathdata);
63 
64  // @brief Check if needed to check clear again for side pass
65  bool CheckClearDone(const ReferenceLineInfo& reference_line_info,
66  const common::PathPoint& stop_point);
67 
68  private:
69  static constexpr char const* PATH_END_VO_ID_PREFIX = "PATH_END_";
70  RuleBasedStopDeciderConfig rule_based_stop_decider_config_;
71  bool is_clear_to_change_lane_ = false;
72  bool is_change_lane_planning_succeed_ = false;
73 };
74 } // namespace planning
75 } // namespace apollo
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
ReferenceLineInfo holds all data for one reference line.
Definition: reference_line_info.h:54
Definition: rule_based_stop_decider.h:27
Definition: path_data.h:36
RuleBasedStopDecider(const TaskConfig &config, const std::shared_ptr< DependencyInjector > &injector)
Definition: decider.h:32
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