Apollo 10.0
自动驾驶开放平台
third_party_perception_base.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2020 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 *****************************************************************************/
17
20
21namespace apollo {
22namespace third_party_perception {
23
28
30 apollo::cyber::Node* const node) : node_(node) {
31
34 FLAGS_localization_topic,
35 [this](
36 const std::shared_ptr<apollo::localization::LocalizationEstimate>
37 &localization) {
38 OnLocalization(*localization.get());
39 });
40
42 FLAGS_chassis_topic,
43 [this](const std::shared_ptr<apollo::canbus::Chassis> &chassis) {
44 OnChassis(*chassis.get());
45 });
46}
47
48std::string ThirdPartyPerception::Name() const {
49 return FLAGS_third_party_perception_node_name;
50}
51
55
57
59
61 ADEBUG << "Received chassis data: run chassis callback.";
62 std::lock_guard<std::mutex> lock(third_party_perception_mutex_);
63 chassis_.CopyFrom(message);
64}
65
67 ADEBUG << "Received localization data: run localization callback.";
68 std::lock_guard<std::mutex> lock(third_party_perception_mutex_);
69 localization_.CopyFrom(message);
70}
71
73 return true;
74}
75
76} // namespace third_party_perception
77} // 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
Node is the fundamental building block of Cyber RT.
Definition node.h:44
std::shared_ptr< apollo::cyber::Reader< apollo::canbus::Chassis > > chassis_reader_
std::shared_ptr< apollo::cyber::Reader< apollo::localization::LocalizationEstimate > > localization_reader_
void OnChassis(const apollo::canbus::Chassis &message)
virtual bool Process(apollo::perception::PerceptionObstacles *const response)
apollo::localization::LocalizationEstimate localization_
void OnLocalization(const apollo::localization::LocalizationEstimate &message)
#define ADEBUG
Definition log.h:41
Some string util functions.
class register implement
Definition arena_queue.h:37