Apollo  6.0
Open source self driving car software
stop_sign_unprotected_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 <unordered_map>
26 #include <utility>
27 #include <vector>
28 
31 #include "modules/planning/proto/planning.pb.h"
33 
34 namespace apollo {
35 namespace planning {
36 namespace scenario {
37 namespace stop_sign {
38 
39 // stage context
41  ScenarioStopSignUnprotectedConfig scenario_config;
43  double stop_start_time = 0.0;
44  double creep_start_time = 0.0;
45  // watch_vehicle: <lane_id, perception_obstacle_ids>
46  std::unordered_map<std::string, std::vector<std::string>> watch_vehicles;
47  std::vector<std::pair<hdmap::LaneInfoConstPtr, hdmap::OverlapInfoConstPtr>>
49 };
50 
52  public:
54  const ScenarioConfig& config, const ScenarioContext* context,
55  const std::shared_ptr<DependencyInjector>& injector)
56  : Scenario(config, context, injector) {}
57 
58  void Init() override;
59 
60  std::unique_ptr<Stage> CreateStage(
61  const ScenarioConfig::StageConfig& stage_config,
62  const std::shared_ptr<DependencyInjector>& injector);
63 
64  StopSignUnprotectedContext* GetContext() { return &context_; }
65 
66  private:
67  static void RegisterStages();
68  bool GetScenarioConfig();
69  int GetAssociatedLanes(const hdmap::StopSignInfo& stop_sign_info);
70 
71  private:
73  ScenarioConfig::StageType, Stage,
74  Stage* (*)(const ScenarioConfig::StageConfig& stage_config,
75  const std::shared_ptr<DependencyInjector>& injector)>
76  s_stage_factory_;
77  bool init_ = false;
79 };
80 
81 } // namespace stop_sign
82 } // namespace scenario
83 } // namespace planning
84 } // namespace apollo
Definition: stop_sign_unprotected_scenario.h:51
std::vector< std::pair< hdmap::LaneInfoConstPtr, hdmap::OverlapInfoConstPtr > > associated_lanes
Definition: stop_sign_unprotected_scenario.h:48
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
StopSignUnprotectedContext * GetContext()
Definition: stop_sign_unprotected_scenario.h:64
double creep_start_time
Definition: stop_sign_unprotected_scenario.h:44
StopSignUnprotectedScenario(const ScenarioConfig &config, const ScenarioContext *context, const std::shared_ptr< DependencyInjector > &injector)
Definition: stop_sign_unprotected_scenario.h:53
Planning module main class. It processes GPS and IMU as input, to generate planning info...
Definition: stop_sign_unprotected_scenario.h:40
Implements a Factory design pattern with Register and Create methods.
Definition: factory.h:60
std::string current_stop_sign_overlap_id
Definition: stop_sign_unprotected_scenario.h:42
ScenarioStopSignUnprotectedConfig scenario_config
Definition: stop_sign_unprotected_scenario.h:41
Defines the Factory class.
bool Init(const char *binary_name)
double stop_start_time
Definition: stop_sign_unprotected_scenario.h:43
std::unordered_map< std::string, std::vector< std::string > > watch_vehicles
Definition: stop_sign_unprotected_scenario.h:46
Definition: hdmap_common.h:343
Definition: scenario.h:41
Definition: stage.h:38