Apollo  6.0
Open source self driving car software
lane_change_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 
21 #pragma once
22 
23 #include <list>
24 #include <memory>
25 #include <string>
26 
28 #include "modules/planning/proto/planning_config.pb.h"
29 #include "modules/planning/proto/planning_status.pb.h"
31 
32 namespace apollo {
33 namespace planning {
34 
35 class LaneChangeDecider : public Decider {
36  public:
37  LaneChangeDecider(const TaskConfig& config,
38  const std::shared_ptr<DependencyInjector>& injector);
39 
45  static bool IsClearToChangeLane(ReferenceLineInfo* reference_line_info);
46 
57  static bool IsPerceptionBlocked(const ReferenceLineInfo& reference_line_info,
58  const double search_beam_length,
59  const double search_beam_radius_intensity,
60  const double search_range,
61  const double is_block_angle_threshold);
62 
63  static void UpdatePreparationDistance(
64  const bool is_opt_succeed, const Frame* frame,
65  const ReferenceLineInfo* const reference_line_info,
66  PlanningContext* planning_context);
67 
68  private:
69  common::Status Process(
70  Frame* frame,
71  ReferenceLineInfo* const current_reference_line_info) override;
72 
73  static bool HysteresisFilter(const double obstacle_distance,
74  const double safe_distance,
75  const double distance_buffer,
76  const bool is_obstacle_blocking);
77 
78  void UpdateStatus(ChangeLaneStatus::Status status_code,
79  const std::string& path_id);
80  void UpdateStatus(double timestamp, ChangeLaneStatus::Status status_code,
81  const std::string& path_id);
82 
83  void PrioritizeChangeLane(
84  const bool is_prioritize_change_lane,
85  std::list<ReferenceLineInfo>* reference_line_info) const;
86 
87  void RemoveChangeLane(
88  std::list<ReferenceLineInfo>* reference_line_info) const;
89 
90  std::string GetCurrentPathId(
91  const std::list<ReferenceLineInfo>& reference_line_info) const;
92 };
93 
94 } // namespace planning
95 } // namespace apollo
static bool IsPerceptionBlocked(const ReferenceLineInfo &reference_line_info, const double search_beam_length, const double search_beam_radius_intensity, const double search_range, const double is_block_angle_threshold)
A static function to estimate if an obstacle in certain range in front of ADV blocks too much space p...
Definition: planning_context.h:33
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
LaneChangeDecider(const TaskConfig &config, const std::shared_ptr< DependencyInjector > &injector)
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
static void UpdatePreparationDistance(const bool is_opt_succeed, const Frame *frame, const ReferenceLineInfo *const reference_line_info, PlanningContext *planning_context)
static bool IsClearToChangeLane(ReferenceLineInfo *reference_line_info)
A static function to check if the ChangeLanePath type of reference line is safe or if current referen...
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
Definition: lane_change_decider.h:35