Apollo 10.0
自动驾驶开放平台
stage.h
浏览该文件的文档.
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 <map>
24#include <memory>
25#include <string>
26#include <vector>
27
28#include "modules/planning/planning_interface_base/scenario_base/proto/scenario_pipeline.pb.h"
29
32
33namespace apollo {
34namespace common {
35class TrajectoryPoint;
36} // namespace common
37} // namespace apollo
38
39namespace apollo {
40namespace planning {
41
42class Task;
43class Frame;
44class ReferenceLineInfo;
45
46class Stage {
47 public:
48 Stage();
49
50 virtual bool Init(const StagePipeline& config,
51 const std::shared_ptr<DependencyInjector>& injector,
52 const std::string& config_dir, void* context);
53
54 virtual ~Stage() = default;
55
62 const common::TrajectoryPoint& planning_init_point, Frame* frame) = 0;
63
64 const std::string& Name() const;
65
66 template <typename T>
67 T* GetContextAs() const {
68 return static_cast<T*>(context_);
69 }
70
71 const std::string& NextStage() const { return next_stage_; }
72
73 protected:
75 const common::TrajectoryPoint& planning_start_point, Frame* frame);
76
78 const common::TrajectoryPoint& planning_start_point, Frame* frame);
79
81
83
84 void RecordDebugInfo(ReferenceLineInfo* reference_line_info,
85 const std::string& name, const double time_diff_ms);
86
87 std::vector<std::shared_ptr<Task>> task_list_;
88 std::shared_ptr<Task> fallback_task_;
89 std::string next_stage_;
90 void* context_;
91 std::shared_ptr<DependencyInjector> injector_;
93
94 private:
95 std::string name_;
96};
97
98} // namespace planning
99} // namespace apollo
Frame holds all data for one planning cycle.
Definition frame.h:62
ReferenceLineInfo holds all data for one reference line.
std::string next_stage_
Definition stage.h:89
virtual StageResult FinishScenario()
Definition stage.cc:258
StageResult ExecuteTaskOnOpenSpace(Frame *frame)
Definition stage.cc:206
T * GetContextAs() const
Definition stage.h:67
const std::string & NextStage() const
Definition stage.h:71
virtual bool Init(const StagePipeline &config, const std::shared_ptr< DependencyInjector > &injector, const std::string &config_dir, void *context)
Definition stage.cc:43
std::shared_ptr< DependencyInjector > injector_
Definition stage.h:91
virtual StageResult Process(const common::TrajectoryPoint &planning_init_point, Frame *frame)=0
Each stage does its business logic inside Process function.
StagePipeline pipeline_config_
Definition stage.h:92
StageResult ExecuteTaskOnReferenceLineForOnlineLearning(const common::TrajectoryPoint &planning_start_point, Frame *frame)
Definition stage.cc:162
void RecordDebugInfo(ReferenceLineInfo *reference_line_info, const std::string &name, const double time_diff_ms)
Definition stage.cc:263
StageResult ExecuteTaskOnReferenceLine(const common::TrajectoryPoint &planning_start_point, Frame *frame)
Definition stage.cc:101
std::shared_ptr< Task > fallback_task_
Definition stage.h:88
const std::string & Name() const
Definition stage.cc:99
std::vector< std::shared_ptr< Task > > task_list_
Definition stage.h:87
virtual ~Stage()=default
Planning module main class.
class register implement
Definition arena_queue.h:37