Apollo  6.0
Open source self driving car software
traffic_light_unprotected_right_turn_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 
29 #include "modules/planning/proto/planning.pb.h"
31 
32 namespace apollo {
33 namespace planning {
34 namespace scenario {
35 namespace traffic_light {
36 
37 // stage context
39  ScenarioTrafficLightUnprotectedRightTurnConfig scenario_config;
40  std::vector<std::string> current_traffic_light_overlap_ids;
41  double stop_start_time = 0.0;
42  double creep_start_time = 0.0;
43 };
44 
46  public:
48  const ScenarioConfig& config, 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 
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;
72 };
73 
74 } // namespace traffic_light
75 } // namespace scenario
76 } // namespace planning
77 } // namespace apollo
ScenarioTrafficLightUnprotectedRightTurnConfig scenario_config
Definition: traffic_light_unprotected_right_turn_scenario.h:39
std::vector< std::string > current_traffic_light_overlap_ids
Definition: traffic_light_unprotected_right_turn_scenario.h:40
Definition: traffic_light_unprotected_right_turn_scenario.h:45
TrafficLightUnprotectedRightTurnContext * GetContext()
Definition: traffic_light_unprotected_right_turn_scenario.h:58
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
double stop_start_time
Definition: traffic_light_unprotected_right_turn_scenario.h:41
Planning module main class. It processes GPS and IMU as input, to generate planning info...
TrafficLightUnprotectedRightTurnScenario(const ScenarioConfig &config, const ScenarioContext *context, const std::shared_ptr< DependencyInjector > &injector)
Definition: traffic_light_unprotected_right_turn_scenario.h:47
Implements a Factory design pattern with Register and Create methods.
Definition: factory.h:60
Definition: traffic_light_unprotected_right_turn_scenario.h:38
double creep_start_time
Definition: traffic_light_unprotected_right_turn_scenario.h:42
Defines the Factory class.
bool Init(const char *binary_name)
Definition: scenario.h:41
Definition: stage.h:38