Apollo  6.0
Open source self driving car software
traffic_light_protected_scenario.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 
21 #pragma once
22 
23 #include <memory>
24 #include <string>
25 #include <vector>
26 
28 #include "modules/planning/proto/planning.pb.h"
30 
31 namespace apollo {
32 namespace planning {
33 namespace scenario {
34 namespace traffic_light {
35 
36 // stage context
38  ScenarioTrafficLightProtectedConfig scenario_config;
39  std::vector<std::string> current_traffic_light_overlap_ids;
40 };
41 
43  public:
45  const ScenarioConfig& config, const ScenarioContext* context,
46  const std::shared_ptr<DependencyInjector>& injector)
47  : Scenario(config, context, injector) {}
48 
49  void Init() override;
50 
51  std::unique_ptr<Stage> CreateStage(
52  const ScenarioConfig::StageConfig& stage_config,
53  const std::shared_ptr<DependencyInjector>& injector);
54 
55  TrafficLightProtectedContext* GetContext() { return &context_; }
56 
57  private:
58  static void RegisterStages();
59  bool GetScenarioConfig();
60 
61  private:
63  ScenarioConfig::StageType, Stage,
64  Stage* (*)(const ScenarioConfig::StageConfig& stage_config,
65  const std::shared_ptr<DependencyInjector>& injector)>
66  s_stage_factory_;
67  bool init_ = false;
69 };
70 
71 } // namespace traffic_light
72 } // namespace scenario
73 } // namespace planning
74 } // namespace apollo
Definition: traffic_light_protected_scenario.h:37
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::vector< std::string > current_traffic_light_overlap_ids
Definition: traffic_light_protected_scenario.h:39
Planning module main class. It processes GPS and IMU as input, to generate planning info...
Implements a Factory design pattern with Register and Create methods.
Definition: factory.h:60
TrafficLightProtectedContext * GetContext()
Definition: traffic_light_protected_scenario.h:55
TrafficLightProtectedScenario(const ScenarioConfig &config, const ScenarioContext *context, const std::shared_ptr< DependencyInjector > &injector)
Definition: traffic_light_protected_scenario.h:44
Defines the Factory class.
ScenarioTrafficLightProtectedConfig scenario_config
Definition: traffic_light_protected_scenario.h:38
bool Init(const char *binary_name)
Definition: traffic_light_protected_scenario.h:42
Definition: scenario.h:41
Definition: stage.h:38