Apollo  6.0
Open source self driving car software
emergency_stop_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 
28 
29 namespace apollo {
30 namespace planning {
31 namespace scenario {
32 namespace emergency_stop {
33 
34 // stage context
36  ScenarioEmergencyStopConfig scenario_config;
37 };
38 
40  public:
41  EmergencyStopScenario(const ScenarioConfig& config,
42  const ScenarioContext* context,
43  const std::shared_ptr<DependencyInjector>& injector)
44  : Scenario(config, context, injector) {}
45 
46  void Init() override;
47 
48  std::unique_ptr<Stage> CreateStage(
49  const ScenarioConfig::StageConfig& stage_config,
50  const std::shared_ptr<DependencyInjector>& injector);
51 
52  EmergencyStopContext* GetContext() { return &context_; }
53 
54  private:
55  static void RegisterStages();
56  bool GetScenarioConfig();
57 
58  private:
60  ScenarioConfig::StageType, Stage,
61  Stage* (*)(const ScenarioConfig::StageConfig& stage_config,
62  const std::shared_ptr<DependencyInjector>& injector)>
63  s_stage_factory_;
64  bool init_ = false;
65  EmergencyStopContext context_;
66 };
67 
68 } // namespace emergency_stop
69 } // namespace scenario
70 } // namespace planning
71 } // namespace apollo
ScenarioEmergencyStopConfig scenario_config
Definition: emergency_stop_scenario.h:36
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...
Implements a Factory design pattern with Register and Create methods.
Definition: factory.h:60
EmergencyStopContext * GetContext()
Definition: emergency_stop_scenario.h:52
EmergencyStopScenario(const ScenarioConfig &config, const ScenarioContext *context, const std::shared_ptr< DependencyInjector > &injector)
Definition: emergency_stop_scenario.h:41
Defines the Factory class.
bool Init(const char *binary_name)
Definition: scenario.h:41
Definition: stage.h:38