Apollo  6.0
Open source self driving car software
pri_sec_fusion_component.h
Go to the documentation of this file.
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 
17 #pragma once
18 
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 #include "Eigen/Eigen"
24 
25 // Eigen 3.3.7: #define ALIVE (0)
26 // fastrtps: enum ChangeKind_t { ALIVE, ... };
27 #if defined(ALIVE)
28 #undef ALIVE
29 #endif
30 
31 #include "modules/drivers/lidar/proto/velodyne_config.pb.h"
32 #include "modules/drivers/proto/pointcloud.pb.h"
33 
34 #include "cyber/cyber.h"
36 
37 namespace apollo {
38 namespace drivers {
39 namespace velodyne {
40 
45 
46 class PriSecFusionComponent : public Component<PointCloud> {
47  public:
48  bool Init() override;
49  bool Proc(const std::shared_ptr<PointCloud>& point_cloud) override;
50 
51  private:
52  bool Fusion(std::shared_ptr<PointCloud> target,
53  std::shared_ptr<PointCloud> source);
54  bool IsExpired(const std::shared_ptr<PointCloud>& target,
55  const std::shared_ptr<PointCloud>& source);
56  bool QueryPoseAffine(const std::string& target_frame_id,
57  const std::string& source_frame_id,
58  Eigen::Affine3d* pose);
59  void AppendPointCloud(std::shared_ptr<PointCloud> point_cloud,
60  std::shared_ptr<PointCloud> point_cloud_add,
61  const Eigen::Affine3d& pose);
62 
63  FusionConfig conf_;
64  apollo::transform::Buffer* buffer_ptr_ = nullptr;
65  std::shared_ptr<Writer<PointCloud>> fusion_writer_;
66  std::vector<std::shared_ptr<Reader<PointCloud>>> readers_;
67 };
68 
70 } // namespace velodyne
71 } // namespace drivers
72 } // namespace apollo
bool Proc(const std::shared_ptr< PointCloud > &point_cloud) override
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: pri_sec_fusion_component.h:46
pcl::PointCloud< Point > PointCloud
Definition: types.h:64
Reader subscribes a channel, it has two main functions:
Definition: reader.h:68
Definition: buffer.h:33
#define CYBER_REGISTER_COMPONENT(name)
Definition: component.h:551
Eigen::Affine3d Affine3d
Definition: base_map_fwd.h:34
The Component can process up to four channels of messages. The message type is specified when the com...
Definition: component.h:58
apollo::cyber::Writer< T > Writer
Definition: sensor_canbus.h:67