Apollo
10.0
自动驾驶开放平台
gnss_component.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
#include "
modules/drivers/gnss/gnss_component.h
"
17
18
namespace
apollo
{
19
namespace
drivers {
20
namespace
gnss {
21
22
using
apollo::cyber::proto::RoleAttributes
;
23
24
GnssDriverComponent::GnssDriverComponent
()
25
: monitor_logger_buffer_(
26
apollo
::common::monitor::
MonitorMessageItem
::
GNSS
) {}
27
28
bool
GnssDriverComponent::Init
() {
29
config::Config
gnss_config;
30
if
(!
apollo::cyber::common::GetProtoFromFile
(
config_file_path_
,
31
&gnss_config)) {
32
monitor_logger_buffer_.ERROR(
"Unable to load gnss conf file: "
+
33
config_file_path_
);
34
return
false
;
35
}
36
AINFO
<<
"Gnss config: "
<< gnss_config.DebugString();
37
38
raw_stream_.reset(
new
RawStream
(gnss_config,
node_
));
39
40
if
(!raw_stream_->Init()) {
41
monitor_logger_buffer_.ERROR(
"Init gnss stream failed"
);
42
AERROR
<<
"Init gnss stream failed"
;
43
return
false
;
44
}
45
raw_stream_->Start();
46
monitor_logger_buffer_.INFO(
"gnss is started."
);
47
return
true
;
48
}
49
50
}
// namespace gnss
51
}
// namespace drivers
52
}
// namespace apollo
apollo::cyber::ComponentBase::node_
std::shared_ptr< Node > node_
Definition
component_base.h:119
apollo::cyber::ComponentBase::config_file_path_
std::string config_file_path_
Definition
component_base.h:120
apollo::drivers::gnss::GnssDriverComponent::GnssDriverComponent
GnssDriverComponent()
Definition
gnss_component.cc:24
apollo::drivers::gnss::GnssDriverComponent::Init
bool Init() override
Definition
gnss_component.cc:28
apollo::drivers::gnss::RawStream
Definition
raw_stream.h:38
gnss_component.h
AERROR
#define AERROR
Definition
log.h:44
AINFO
#define AINFO
Definition
log.h:42
apollo::cyber::common::GetProtoFromFile
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
apollo::drivers::gnss::MessageType::GNSS
@ GNSS
apollo
class register implement
Definition
arena_queue.h:37
apollo::common::monitor::MonitorMessageItem
Definition
monitor_log.proto:7
apollo::cyber::proto::RoleAttributes
Definition
role_attributes.proto:12
apollo::drivers::gnss::config::Config
Definition
config.proto:104
modules
drivers
gnss
gnss_component.cc