Apollo 10.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>
21
22namespace apollo {
23namespace drivers {
24namespace lidar {
25template <typename ScanType>
27 public:
29
30 virtual ~LidarComponentBase() = default;
31
32 virtual bool Init() = 0;
33
34 virtual void ReadScanCallback(const std::shared_ptr<ScanType>& scan_message)
35 = 0;
36
37 bool InitBase(const LidarConfigBase& lidar_config_base) override {
38 RETURN_VAL_IF(!this->InitPacket(lidar_config_base), false);
39 RETURN_VAL_IF(!this->InitConverter(lidar_config_base), false);
40 return true;
41 }
42
43 bool WriteScan(const std::shared_ptr<ScanType>& scan_message) {
44 return BaseComponent::WriteScan(scan_message);
45 }
46
47 std::shared_ptr<PointCloud> AllocatePointCloud() {
48 return BaseComponent::AllocatePointCloud();
49 }
50
51 bool WritePointCloud(const std::shared_ptr<PointCloud>& point_cloud) {
52 return BaseComponent::WritePointCloud(point_cloud);
53 }
54};
55
56} // namespace lidar
57} // namespace drivers
58} // namespace apollo
59
60#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