Apollo 10.0
自动驾驶开放平台
command_processor_base.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2023 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
23#include <cxxabi.h>
24
25#include "modules/common_msgs/external_command_msgs/command_status.pb.h"
26#include "modules/external_command/command_processor/command_processor_base/proto/command_processor_config.pb.h"
27
28#include "cyber/common/file.h"
30
35namespace apollo {
36namespace external_command {
37
39 : processor_config_(std::make_shared<CommandProcessorConfig>()) {}
40
41bool CommandProcessorBase::Init(const std::shared_ptr<cyber::Node>& node) {
42 int status;
43 std::string class_name =
44 abi::__cxa_demangle(typeid(*this).name(), 0, 0, &status);
45 // Generate the default task config path from PluginManager.
46 std::string config_path =
49 "conf/config.pb.txt");
50 if (!cyber::common::GetProtoFromFile(config_path, processor_config_.get())) {
51 AERROR << "Cannot get config of " << class_name;
52 return false;
53 }
54 node_ = node;
55 return true;
56}
57
59 return *processor_config_;
60}
61
62const std::shared_ptr<cyber::Node>& CommandProcessorBase::Node() const {
63 return node_;
64}
65
66} // namespace external_command
67} // namespace apollo
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
virtual bool Init(const std::shared_ptr< cyber::Node > &node)
const CommandProcessorConfig & GetProcessorConfig() const
const std::shared_ptr< cyber::Node > & Node() const
#define AERROR
Definition log.h:44
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
Definition file.cc:132
class register implement
Definition arena_queue.h:37
Definition future.h:29