Apollo
10.0
自动驾驶开放平台
lidar_driver_component.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
*****************************************************************************/
16
#include "
modules/drivers/lidar/lidar_driver_component.h
"
17
18
#include "modules/drivers/lidar/proto/lidar_parameter.pb.h"
19
20
namespace
apollo
{
21
namespace
drivers {
22
namespace
lidar {
23
24
LidarDriverComponent::LidarDriverComponent
() {}
25
bool
LidarDriverComponent::Init
() {
26
if
(!
GetProtoConfig
(&conf_)) {
27
AERROR
<<
"load config error, file:"
<<
config_file_path_
;
28
return
false
;
29
}
30
node_ =
apollo::cyber::CreateNode
(
"drivers_lidar"
);
31
AINFO
<<
"conf:"
<< conf_.DebugString();
32
LidarDriverFactory::Instance()->RegisterLidarClients();
33
driver_ = LidarDriverFactory::Instance()->CreateLidarDriver(node_, conf_);
34
if
(driver_ ==
nullptr
|| !driver_->Init()) {
35
AERROR
<<
"driver init error"
;
36
return
false
;
37
}
38
return
true
;
39
}
40
41
}
// namespace lidar
42
}
// namespace drivers
43
}
// namespace apollo
apollo::cyber::ComponentBase::GetProtoConfig
bool GetProtoConfig(T *config) const
Definition
component_base.h:63
apollo::cyber::ComponentBase::config_file_path_
std::string config_file_path_
Definition
component_base.h:120
apollo::drivers::lidar::LidarDriverComponent::LidarDriverComponent
LidarDriverComponent()
Definition
lidar_driver_component.cc:24
apollo::drivers::lidar::LidarDriverComponent::Init
bool Init() override
Definition
lidar_driver_component.cc:25
lidar_driver_component.h
AERROR
#define AERROR
Definition
log.h:44
AINFO
#define AINFO
Definition
log.h:42
apollo::cyber::CreateNode
std::unique_ptr< Node > CreateNode(const std::string &node_name, const std::string &name_space)
Definition
cyber.cc:33
apollo
class register implement
Definition
arena_queue.h:37
modules
drivers
lidar
lidar_driver_component.cc