Apollo 11.0
自动驾驶开放平台
lidar_component_base.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2024 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#ifndef APOLLO_LIDAR_COMPONENT_BASE_H
17#define APOLLO_LIDAR_COMPONENT_BASE_H
18
19#include <memory>
20
22
23namespace apollo {
24namespace drivers {
25namespace lidar {
26template <typename ScanType>
28 public:
30
31 virtual ~LidarComponentBase() = default;
32
33 virtual bool Init() = 0;
34
35 virtual void ReadScanCallback(
36 const std::shared_ptr<ScanType>& scan_message) = 0;
37
38 bool InitBase(const LidarConfigBase& lidar_config_base) override {
39 RETURN_VAL_IF(!this->InitPacket(lidar_config_base), false);
40 RETURN_VAL_IF(!this->InitConverter(lidar_config_base), false);
41 return true;
42 }
43
44 bool WriteScan(const std::shared_ptr<ScanType>& scan_message) {
45 return BaseComponent::WriteScan(scan_message);
46 }
47
48 std::shared_ptr<PointCloud> AllocatePointCloud() {
49 return BaseComponent::AllocatePointCloud();
50 }
51
52 bool WritePointCloud(const std::shared_ptr<PointCloud>& point_cloud) {
53 return BaseComponent::WritePointCloud(point_cloud);
54 }
55};
56
57} // namespace lidar
58} // namespace drivers
59} // namespace apollo
60
61#endif // APOLLO_LIDAR_COMPONENT_BASE_H
bool InitConverter(const LidarConfigBase &lidar_config_base)
bool InitPacket(const LidarConfigBase &lidar_config_base)
bool WriteScan(const std::shared_ptr< ScanType > &scan_message)
LidarComponentBaseImpl< ScanType > BaseComponent
std::shared_ptr< PointCloud > AllocatePointCloud()
bool WritePointCloud(const std::shared_ptr< PointCloud > &point_cloud)
virtual void ReadScanCallback(const std::shared_ptr< ScanType > &scan_message)=0
bool InitBase(const LidarConfigBase &lidar_config_base) override
#define RETURN_VAL_IF(condition, val)
Definition log.h:114
class register implement
Definition arena_queue.h:37