Apollo  6.0
Open source self driving car software
evaluator_manager.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 
22 #pragma once
23 
24 #include <list>
25 #include <map>
26 #include <memory>
27 #include <unordered_map>
28 #include <vector>
29 
30 #include "cyber/common/macros.h"
33 #include "modules/prediction/proto/prediction_conf.pb.h"
34 
39 namespace apollo {
40 namespace prediction {
41 
43  public:
48 
52  virtual ~EvaluatorManager() = default;
53 
58  void Init(const PredictionConf& config);
59 
64  Evaluator* GetEvaluator(const ObstacleConf::EvaluatorType& type);
65 
69  void Run(ObstaclesContainer* obstacles_container);
70 
71  void EvaluateObstacle(Obstacle* obstacle,
72  ObstaclesContainer* obstacles_container,
73  std::vector<Obstacle*> dynamic_env);
74 
75  void EvaluateObstacle(Obstacle* obstacle,
76  ObstaclesContainer* obstacles_container);
77 
78  private:
79  void BuildObstacleIdHistoryMap(ObstaclesContainer* obstacles_container,
80  size_t max_num_frame);
81 
82  void DumpCurrentFrameEnv(ObstaclesContainer* obstacles_container);
83 
88  void RegisterEvaluator(const ObstacleConf::EvaluatorType& type);
89 
95  std::unique_ptr<Evaluator> CreateEvaluator(
96  const ObstacleConf::EvaluatorType& type);
97 
101  void RegisterEvaluators();
102 
103  private:
104  std::map<ObstacleConf::EvaluatorType, std::unique_ptr<Evaluator>> evaluators_;
105 
106  ObstacleConf::EvaluatorType vehicle_on_lane_evaluator_ =
107  ObstacleConf::CRUISE_MLP_EVALUATOR;
108 
109  ObstacleConf::EvaluatorType vehicle_on_lane_caution_evaluator_ =
110  ObstacleConf::CRUISE_MLP_EVALUATOR;
111 
112  ObstacleConf::EvaluatorType vehicle_in_junction_evaluator_ =
113  ObstacleConf::JUNCTION_MLP_EVALUATOR;
114 
115  ObstacleConf::EvaluatorType vehicle_in_junction_caution_evaluator_ =
116  ObstacleConf::JUNCTION_MAP_EVALUATOR;
117 
118  ObstacleConf::EvaluatorType vehicle_default_caution_evaluator_ =
119  ObstacleConf::SEMANTIC_LSTM_EVALUATOR;
120 
121  ObstacleConf::EvaluatorType cyclist_on_lane_evaluator_ =
122  ObstacleConf::CYCLIST_KEEP_LANE_EVALUATOR;
123 
124  ObstacleConf::EvaluatorType pedestrian_evaluator_ =
125  ObstacleConf::SEMANTIC_LSTM_EVALUATOR;
126 
127  ObstacleConf::EvaluatorType default_on_lane_evaluator_ =
128  ObstacleConf::MLP_EVALUATOR;
129 
130  std::unordered_map<int, ObstacleHistory> obstacle_id_history_map_;
131 
132  std::unique_ptr<SemanticMap> semantic_map_;
133 };
134 
135 } // namespace prediction
136 } // namespace apollo
Prediction obstacle.
Definition: obstacle.h:52
Definition: obstacles_container.h:39
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
void Init(const PredictionConf &config)
Initializer.
Definition: evaluator_manager.h:42
void Run(ObstaclesContainer *obstacles_container)
Run evaluators.
virtual ~EvaluatorManager()=default
Destructor.
void EvaluateObstacle(Obstacle *obstacle, ObstaclesContainer *obstacles_container, std::vector< Obstacle *> dynamic_env)
Definition: evaluator.h:39
Evaluator * GetEvaluator(const ObstacleConf::EvaluatorType &type)
Get evaluator.
Define the data container base class.