Apollo  6.0
Open source self driving car software
yield_sign_scenario.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2019 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 <unordered_map>
26 #include <vector>
27 
30 #include "modules/planning/proto/planning.pb.h"
32 
33 namespace apollo {
34 namespace planning {
35 namespace scenario {
36 namespace yield_sign {
37 
38 // stage context
40  ScenarioYieldSignConfig scenario_config;
41  std::vector<std::string> current_yield_sign_overlap_ids;
42  double creep_start_time = 0.0;
43 };
44 
45 class YieldSignScenario : public Scenario {
46  public:
47  YieldSignScenario(const ScenarioConfig& config,
48  const ScenarioContext* context,
49  const std::shared_ptr<DependencyInjector>& injector)
50  : Scenario(config, context, injector) {}
51 
52  void Init() override;
53 
54  std::unique_ptr<Stage> CreateStage(
55  const ScenarioConfig::StageConfig& stage_config,
56  const std::shared_ptr<DependencyInjector>& injector);
57 
58  YieldSignContext* GetContext() { return &context_; }
59 
60  private:
61  static void RegisterStages();
62  bool GetScenarioConfig();
63 
64  private:
66  ScenarioConfig::StageType, Stage,
67  Stage* (*)(const ScenarioConfig::StageConfig& stage_config,
68  const std::shared_ptr<DependencyInjector>& injector)>
69  s_stage_factory_;
70  bool init_ = false;
71  YieldSignContext context_;
72 };
73 
74 } // namespace yield_sign
75 } // namespace scenario
76 } // namespace planning
77 } // namespace apollo
std::vector< std::string > current_yield_sign_overlap_ids
Definition: yield_sign_scenario.h:41
YieldSignScenario(const ScenarioConfig &config, const ScenarioContext *context, const std::shared_ptr< DependencyInjector > &injector)
Definition: yield_sign_scenario.h:47
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...
ScenarioYieldSignConfig scenario_config
Definition: yield_sign_scenario.h:40
Implements a Factory design pattern with Register and Create methods.
Definition: factory.h:60
YieldSignContext * GetContext()
Definition: yield_sign_scenario.h:58
Defines the Factory class.
bool Init(const char *binary_name)
double creep_start_time
Definition: yield_sign_scenario.h:42
Definition: scenario.h:41
Definition: stage.h:38