Apollo  6.0
Open source self driving car software
emergency_pull_over_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_pull_over {
33 
34 // stage context
36  ScenarioEmergencyPullOverConfig scenario_config;
37  double target_slow_down_speed = 0.0;
38 };
39 
41  public:
42  EmergencyPullOverScenario(const ScenarioConfig& config,
43  const ScenarioContext* context,
44  const std::shared_ptr<DependencyInjector>& injector)
45  : Scenario(config, context, injector) {}
46 
47  void Init() override;
48 
49  std::unique_ptr<Stage> CreateStage(
50  const ScenarioConfig::StageConfig& stage_config,
51  const std::shared_ptr<DependencyInjector>& injector);
52 
53  EmergencyPullOverContext* GetContext() { return &context_; }
54 
55  private:
56  static void RegisterStages();
57  bool GetScenarioConfig();
58 
59  private:
61  ScenarioConfig::StageType, Stage,
62  Stage* (*)(const ScenarioConfig::StageConfig& stage_config,
63  const std::shared_ptr<DependencyInjector>& injector)>
64  s_stage_factory_;
65  bool init_ = false;
66  EmergencyPullOverContext context_;
67 };
68 
69 } // namespace emergency_pull_over
70 } // namespace scenario
71 } // namespace planning
72 } // namespace apollo
ScenarioEmergencyPullOverConfig scenario_config
Definition: emergency_pull_over_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
double target_slow_down_speed
Definition: emergency_pull_over_scenario.h:37
EmergencyPullOverScenario(const ScenarioConfig &config, const ScenarioContext *context, const std::shared_ptr< DependencyInjector > &injector)
Definition: emergency_pull_over_scenario.h:42
Defines the Factory class.
bool Init(const char *binary_name)
EmergencyPullOverContext * GetContext()
Definition: emergency_pull_over_scenario.h:53
Definition: scenario.h:41
Definition: stage.h:38