Apollo  6.0
Open source self driving car software
navi_path_decider.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 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 
22 #pragma once
23 
24 #include <map>
25 #include <string>
26 #include <vector>
27 
28 #include "gflags/gflags.h"
29 #include "gtest/gtest_prod.h"
30 #include "modules/common/proto/pnc_point.pb.h"
34 #include "modules/planning/proto/planning_config.pb.h"
35 #include "modules/planning/proto/task_config.pb.h"
37 
42 namespace apollo {
43 namespace planning {
44 
53 class NaviPathDecider : public NaviTask {
54  public:
56  virtual ~NaviPathDecider() = default;
57 
58  bool Init(const PlanningConfig &config) override;
59 
68  Frame *frame, ReferenceLineInfo *reference_line_info) override;
69 
70  private:
81  apollo::common::Status Process(const ReferenceLine &reference_line,
82  const common::TrajectoryPoint &init_point,
83  const std::vector<const Obstacle *> &obstacles,
84  PathDecision *const path_decision,
85  PathData *const path_data);
86 
93  bool GetBasicPathData(const ReferenceLine &reference_line,
94  std::vector<common::PathPoint> *const path_points);
95 
101  void MoveToDestLane(const double dest_ref_line_y,
102  std::vector<common::PathPoint> *const path_points);
103 
109  void KeepLane(const double dest_ref_line_y,
110  std::vector<common::PathPoint> *const path_points);
111 
112  void RecordDebugInfo(const PathData &path_data);
113 
120  bool IsSafeChangeLane(const ReferenceLine &reference_line,
121  const PathDecision &path_decision);
122 
132  double NudgeProcess(const ReferenceLine &reference_line,
133  const std::vector<common::PathPoint> &path_data_points,
134  const std::vector<const Obstacle *> &obstacles,
135  const PathDecision &path_decision,
136  const common::VehicleState &vehicle_state);
140  double CalculateDistanceToDestLane();
141 
142  private:
143  double max_keep_lane_distance_ = 0.0;
144  double min_keep_lane_offset_ = 0.0;
145  double max_keep_lane_shift_y_ = 0.0;
146  double keep_lane_shift_compensation_ = 0.0;
147  double move_dest_lane_compensation_ = 0.0;
148  uint32_t start_plan_point_from_ = 0;
149  std::map<double, double> move_dest_lane_config_talbe_;
150  std::vector<double> max_speed_levels_;
151 
152  double start_plan_v_ = 0.0;
153  double start_plan_a_ = 0.0;
154  apollo::common::PathPoint start_plan_point_;
155 
156  std::string cur_reference_line_lane_id_;
157  std::map<std::string, bool> last_lane_id_to_nudge_flag_;
158  NaviObstacleDecider obstacle_decider_;
159  common::VehicleState vehicle_state_;
160  NaviPathDeciderConfig config_;
161 
162  FRIEND_TEST(NaviPathDeciderTest, MoveToDestLane);
163  FRIEND_TEST(NaviPathDeciderTest, KeepLane);
164 };
165 
166 } // namespace planning
167 } // namespace apollo
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
ReferenceLineInfo holds all data for one reference line.
Definition: reference_line_info.h:54
Definition: navi_task.h:33
apollo::common::Status Execute(Frame *frame, ReferenceLineInfo *reference_line_info) override
Overrided implementation of the virtual function "Execute" in the base class "Task".
Definition: path_data.h:36
Definition: reference_line.h:39
virtual ~NaviPathDecider()=default
bool Init(const PlanningConfig &config) override
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
NaviPathDecider is used to generate the local driving path of the .* vehicle in navigation mode...
Definition: navi_path_decider.h:53
NaviObstacleDecider is used to make appropriate decisions for obstacles around the vehicle in navigat...
Definition: navi_obstacle_decider.h:51