Apollo 11.0
自动驾驶开放平台
task.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 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
22
25
26namespace apollo {
27namespace planning {
28
31
33 : frame_(nullptr),
34 reference_line_info_(nullptr),
35 injector_(nullptr),
36 config_path_(""),
37 default_config_path_(""),
38 name_("") {}
39
40bool Task::Init(const std::string& config_dir, const std::string& name,
41 const std::shared_ptr<DependencyInjector>& injector) {
42 injector_ = injector;
43 name_ = name;
45 config_dir + "/" + ConfigUtil::TransformToPathName(name) + ".pb.txt";
46
47 // Get the name of this class.
48 int status;
49 std::string class_name =
50 abi::__cxa_demangle(typeid(*this).name(), 0, 0, &status);
51 // Generate the default task config path from PluginManager.
54 ->GetPluginConfPath<Task>(class_name, "conf/default_conf.pb.txt");
55 return true;
56}
57
58const std::string& Task::Name() const { return name_; }
59
60Status Task::Execute(Frame* frame, ReferenceLineInfo* reference_line_info) {
61 frame_ = frame;
62 reference_line_info_ = reference_line_info;
63 return Status::OK();
64}
65
67 frame_ = frame;
68 return Status::OK();
69}
70
71} // namespace planning
72} // namespace apollo
A general class to denote the return status of an API call.
Definition status.h:43
static Status OK()
generate a success status.
Definition status.h:60
std::string GetPluginConfPath(const std::string &class_name, const std::string &conf_name)
get plugin configuration file location
static PluginManager * Instance()
get singleton instance of PluginManager
static std::string TransformToPathName(const std::string &name)
Tranform the name to part of path.
Frame holds all data for one planning cycle.
Definition frame.h:62
ReferenceLineInfo holds all data for one reference line.
std::string config_path_
Definition task.h:61
const std::string & Name() const
Definition task.cc:58
std::shared_ptr< DependencyInjector > injector_
Definition task.h:59
ReferenceLineInfo * reference_line_info_
Definition task.h:58
std::string name_
Definition task.h:63
virtual bool Init(const std::string &config_dir, const std::string &name, const std::shared_ptr< DependencyInjector > &injector)
Definition task.cc:40
std::string default_config_path_
Definition task.h:62
virtual common::Status Execute(Frame *frame, ReferenceLineInfo *reference_line_info)
Definition task.cc:60
Planning module main class.
class register implement
Definition arena_queue.h:37