Apollo  6.0
Open source self driving car software
junction_analyzer.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 
17 #pragma once
18 
19 #include <memory>
20 #include <string>
21 #include <unordered_map>
22 #include <vector>
23 
25 #include "modules/prediction/proto/feature.pb.h"
26 
27 namespace apollo {
28 namespace prediction {
29 
31  public:
36  void Init(const std::string& junction_id);
37 
41  void Clear();
42 
47  const std::string& GetJunctionId();
48 
53  double ComputeJunctionRange();
54 
60  const JunctionFeature& GetJunctionFeature(const std::string& start_lane_id);
61 
67  JunctionFeature GetJunctionFeature(
68  const std::vector<std::string>& start_lane_ids);
69 
70  private:
74  void SetAllJunctionExits();
75 
81  std::vector<JunctionExit> GetJunctionExits(const std::string& start_lane_id);
82 
88  bool IsExitLane(const std::string& lane_id);
89 
90  private:
91  // junction_info pointer associated to the input junction_id
92  std::shared_ptr<const apollo::hdmap::JunctionInfo> junction_info_ptr_;
93  // Hashtable: exit_lane_id -> junction_exit
94  std::unordered_map<std::string, JunctionExit> junction_exits_;
95  // Hashtable: start_lane_id -> junction_feature
96  std::unordered_map<std::string, JunctionFeature> junction_features_;
97 };
98 
99 } // namespace prediction
100 } // namespace apollo
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
void Init(const std::string &junction_id)
Initialize by junction ID, if junction id differs from prev cycle.
const JunctionFeature & GetJunctionFeature(const std::string &start_lane_id)
Get junction feature starting from start_lane_id.
Definition: junction_analyzer.h:30
void Clear()
Clear all stored data.
double ComputeJunctionRange()
Compute junction range.
const std::string & GetJunctionId()
Get junction ID.