Apollo 10.0
自动驾驶开放平台
scenario_analyzer.cc
浏览该文件的文档.
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
18
22
23namespace apollo {
24namespace prediction {
25
26std::shared_ptr<ScenarioFeatures> ScenarioAnalyzer::Analyze(
27 const EnvironmentFeatures& environment_features) {
28 Scenario::Type scenario_type = Scenario::UNKNOWN;
29
30 if (environment_features.has_front_junction() &&
31 environment_features.GetFrontJunction().second <
32 FLAGS_junction_distance_threshold) {
33 scenario_type = Scenario::JUNCTION;
34 } else if (environment_features.has_ego_lane()) {
35 scenario_type = Scenario::CRUISE;
36 }
37
38 if (scenario_type == Scenario::CRUISE) {
39 auto cruise_scenario_features = std::make_shared<CruiseScenarioFeatures>();
40 cruise_scenario_features->BuildCruiseScenarioFeatures(environment_features);
41 return cruise_scenario_features;
42 }
43
44 if (scenario_type == Scenario::JUNCTION) {
45 auto junction_scenario_features =
46 std::make_shared<JunctionScenarioFeatures>();
47 // TODO(all) refactor this part
48 junction_scenario_features->BuildJunctionScenarioFeatures(
49 environment_features);
50 return junction_scenario_features;
51 }
52
53 return std::make_shared<ScenarioFeatures>();
54}
55
56} // namespace prediction
57} // namespace apollo
std::pair< std::string, double > GetFrontJunction() const
static std::shared_ptr< ScenarioFeatures > Analyze(const EnvironmentFeatures &environment_features)
class register implement
Definition arena_queue.h:37