Apollo 11.0
自动驾驶开放平台
third_party_perception_component.cc
浏览该文件的文档.
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
18
20#include "modules/third_party_perception/proto/third_party_perception_component.pb.h"
21
23
24namespace apollo {
25namespace third_party_perception {
26
29 third_party_perception_param;
30 if (!GetProtoConfig(&third_party_perception_param)) {
31 AINFO << "load third party perception param failed";
32 return false;
33 }
34
36 third_party_perception_param.device_type();
37
39 perception_ = std::make_shared<ThirdPartyPerceptionSmartereye>(node_.get());
40 } else if (device_type == ThirdPartyPerceptionDeviceType::MOBILEYE) {
41 perception_ = std::make_shared<ThirdPartyPerceptionMobileye>(node_.get());
42 } else {
43 perception_ = std::make_shared<ThirdPartyPerception>(node_.get());
44 }
45
46 if (!perception_->Init().ok()) {
47 return false;
48 }
49
50 writer_ = node_->CreateWriter<apollo::perception::PerceptionObstacles>(
51 FLAGS_perception_obstacle_topic);
52
53 return perception_->Start().ok();
54}
55
57 auto response = std::make_shared<apollo::perception::PerceptionObstacles>();
58 if (!perception_->Process(response.get())) {
59 return false;
60 }
61 writer_->Write(response);
62 return true;
63}
64
65} // namespace third_party_perception
66} // namespace apollo
bool GetProtoConfig(T *config) const
std::shared_ptr< Node > node_
bool Proc() override
The Proc logic of the component, which called by the CyberRT frame.
#define AINFO
Definition log.h:42
class register implement
Definition arena_queue.h:37
DECLARE_string(flagfile)