Apollo  6.0
Open source self driving car software
park_and_go_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 
20 #pragma once
21 
22 #include <memory>
23 
25 
26 namespace apollo {
27 namespace planning {
28 namespace scenario {
29 namespace park_and_go {
30 
31 // stage context
33  ScenarioParkAndGoConfig scenario_config;
34 };
35 
36 class ParkAndGoScenario : public Scenario {
37  public:
38  ParkAndGoScenario(const ScenarioConfig& config,
39  const ScenarioContext* context,
40  const std::shared_ptr<DependencyInjector>& injector)
41  : Scenario(config, context, injector) {}
42 
43  void Init() override;
44 
45  std::unique_ptr<Stage> CreateStage(
46  const ScenarioConfig::StageConfig& stage_config,
47  const std::shared_ptr<DependencyInjector>& injector) override;
48 
49  ParkAndGoContext* GetContext() { return &context_; }
50 
51  private:
52  static void RegisterStages();
53  bool GetScenarioConfig();
54 
55  private:
57  ScenarioConfig::StageType, Stage,
58  Stage* (*)(const ScenarioConfig::StageConfig& stage_config,
59  const std::shared_ptr<DependencyInjector>& injector)>
60  s_stage_factory_;
61  bool init_ = false;
62  ParkAndGoContext context_;
63 };
64 
65 } // namespace park_and_go
66 } // namespace scenario
67 } // namespace planning
68 } // namespace apollo
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
ScenarioParkAndGoConfig scenario_config
Definition: park_and_go_scenario.h:33
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
ParkAndGoScenario(const ScenarioConfig &config, const ScenarioContext *context, const std::shared_ptr< DependencyInjector > &injector)
Definition: park_and_go_scenario.h:38
ParkAndGoContext * GetContext()
Definition: park_and_go_scenario.h:49
bool Init(const char *binary_name)
Definition: scenario.h:41
Definition: stage.h:38