Apollo  6.0
Open source self driving car software
end_condition_sampler.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 <utility>
26 #include <vector>
27 
33 
34 namespace apollo {
35 namespace planning {
36 
37 struct SamplePoint {
39  double ref_v;
40 };
41 
42 // Input: planning objective, vehicle kinematic/dynamic constraints,
43 // Output: sampled ending 1 dimensional states with corresponding time duration.
45  public:
47  const std::array<double, 3>& init_s, const std::array<double, 3>& init_d,
48  std::shared_ptr<PathTimeGraph> ptr_path_time_graph,
49  std::shared_ptr<PredictionQuerier> ptr_prediction_querier);
50 
51  virtual ~EndConditionSampler() = default;
52 
53  std::vector<std::pair<std::array<double, 3>, double>> SampleLatEndConditions()
54  const;
55 
56  std::vector<std::pair<std::array<double, 3>, double>>
57  SampleLonEndConditionsForCruising(const double ref_cruise_speed) const;
58 
59  std::vector<std::pair<std::array<double, 3>, double>>
60  SampleLonEndConditionsForStopping(const double ref_stop_point) const;
61 
62  std::vector<std::pair<std::array<double, 3>, double>>
63  SampleLonEndConditionsForPathTimePoints() const;
64 
65  private:
66  std::vector<SamplePoint> QueryPathTimeObstacleSamplePoints() const;
67 
68  void QueryFollowPathTimePoints(
69  const apollo::common::VehicleConfig& vehicle_config,
70  const std::string& obstacle_id,
71  std::vector<SamplePoint>* sample_points) const;
72 
73  void QueryOvertakePathTimePoints(
74  const apollo::common::VehicleConfig& vehicle_config,
75  const std::string& obstacle_id,
76  std::vector<SamplePoint>* sample_points) const;
77 
78  private:
79  std::array<double, 3> init_s_;
80  std::array<double, 3> init_d_;
81  FeasibleRegion feasible_region_;
82  std::shared_ptr<PathTimeGraph> ptr_path_time_graph_;
83  std::shared_ptr<PredictionQuerier> ptr_prediction_querier_;
84 };
85 
86 } // namespace planning
87 } // namespace apollo
Definition: feasible_region.h:30
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: end_condition_sampler.h:44
Planning module main class. It processes GPS and IMU as input, to generate planning info...
STPoint path_time_point
Definition: end_condition_sampler.h:38
double ref_v
Definition: end_condition_sampler.h:39
Definition: st_point.h:30
Definition: end_condition_sampler.h:37