Apollo  6.0
Open source self driving car software
valet_parking_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 #include <string>
25 
29 #include "modules/map/proto/map_id.pb.h"
31 
32 namespace apollo {
33 namespace planning {
34 namespace scenario {
35 namespace valet_parking {
36 
38  ScenarioValetParkingConfig scenario_config;
42 };
43 
45  public:
46  ValetParkingScenario(const ScenarioConfig& config,
47  const ScenarioContext* context,
48  const std::shared_ptr<DependencyInjector>& injector)
49  : Scenario(config, context, injector) {}
50 
51  void Init() override;
52 
53  std::unique_ptr<Stage> CreateStage(
54  const ScenarioConfig::StageConfig& stage_config,
55  const std::shared_ptr<DependencyInjector>& injector) override;
56 
57  static bool IsTransferable(const Frame& frame,
58  const double parking_start_range);
59 
60  ValetParkingContext* GetContext() { return &context_; }
61 
62  private:
63  static void RegisterStages();
64  bool GetScenarioConfig();
65  static bool SearchTargetParkingSpotOnPath(
66  const hdmap::Path& nearby_path, const std::string& target_parking_id,
67  hdmap::PathOverlap* parking_space_overlap);
68  static bool CheckDistanceToParkingSpot(
69  const common::VehicleState& vehicle_state, const hdmap::Path& nearby_path,
70  const double parking_start_range,
71  const hdmap::PathOverlap& parking_space_overlap);
72 
73  private:
74  bool init_ = false;
76  ScenarioConfig::StageType, Stage,
77  Stage* (*)(const ScenarioConfig::StageConfig& stage_config,
78  const std::shared_ptr<DependencyInjector>& injector)>
79  s_stage_factory_;
80  ValetParkingContext context_;
81  const hdmap::HDMap* hdmap_ = nullptr;
82 };
83 
84 } // namespace valet_parking
85 } // namespace scenario
86 } // namespace planning
87 } // namespace apollo
Definition: path.h:91
ValetParkingContext * GetContext()
Definition: valet_parking_scenario.h:60
ScenarioValetParkingConfig scenario_config
Definition: valet_parking_scenario.h:38
bool pre_stop_rightaway_flag
Definition: valet_parking_scenario.h:40
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...
Frame holds all data for one planning cycle.
Definition: frame.h:61
std::string target_parking_spot_id
Definition: valet_parking_scenario.h:39
Implements a Factory design pattern with Register and Create methods.
Definition: factory.h:60
Definition: path.h:103
hdmap::MapPathPoint pre_stop_rightaway_point
Definition: valet_parking_scenario.h:41
Definition: path.h:215
High-precision map loader interface.
Definition: hdmap.h:53
bool Init(const char *binary_name)
Definition: scenario.h:41
Definition: stage.h:38
ValetParkingScenario(const ScenarioConfig &config, const ScenarioContext *context, const std::shared_ptr< DependencyInjector > &injector)
Definition: valet_parking_scenario.h:46