Apollo 11.0
自动驾驶开放平台
sensor_frame.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 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#pragma once
17
18#include <memory>
19#include <string>
20#include <vector>
21
22#include "Eigen/Core"
23
27
28namespace apollo {
29namespace perception {
30namespace fusion {
31
34 double timestamp = 0.0;
35 Eigen::Affine3d sensor2world_pose;
36
37 SensorFrameHeader() = default;
38 SensorFrameHeader(const base::SensorInfo& info, double ts,
39 const Eigen::Affine3d& pose)
40 : sensor_info(info), timestamp(ts), sensor2world_pose(pose) {}
41
42 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
44
46 public:
48
54 explicit SensorFrame(const base::FrameConstPtr& base_frame_ptr);
55
61 void Initialize(const base::FrameConstPtr& base_frame_ptr);
62
69 void Initialize(const base::FrameConstPtr& base_frame_ptr,
70 const SensorPtr& sensor);
71
77 inline double GetTimestamp() const { return header_->timestamp; }
78
86 inline bool GetPose(Eigen::Affine3d* pose) const {
87 if (pose == nullptr) {
88 AERROR << "pose is not available";
89 return false;
90 }
91 *pose = header_->sensor2world_pose;
92 return true;
93 }
94
100 inline std::vector<SensorObjectPtr>& GetForegroundObjects() {
101 return foreground_objects_;
102 }
103
109 inline const std::vector<SensorObjectPtr>& GetForegroundObjects() const {
110 return foreground_objects_;
111 }
112
118 inline std::vector<SensorObjectPtr>& GetBackgroundObjects() {
119 return background_objects_;
120 }
121
127 inline const std::vector<SensorObjectPtr>& GetBackgroundObjects() const {
128 return background_objects_;
129 }
130
136 std::string GetSensorId() const;
137
144
150 SensorFrameHeaderConstPtr GetHeader() const { return header_; }
151
152 private:
153 std::vector<SensorObjectPtr> foreground_objects_;
154 std::vector<SensorObjectPtr> background_objects_;
155
156 // sensor-specific frame supplements
157 base::LidarFrameSupplement lidar_frame_supplement_;
158 base::RadarFrameSupplement radar_frame_supplement_;
159 base::CameraFrameSupplement camera_frame_supplement_;
160
161 SensorFrameHeaderPtr header_ = nullptr;
162};
163
164} // namespace fusion
165} // namespace perception
166} // namespace apollo
base::SensorType GetSensorType() const
Get the sensor type
const std::vector< SensorObjectPtr > & GetBackgroundObjects() const
Get the Background Objects object
SensorFrameHeaderConstPtr GetHeader() const
Get sensor frame header
void Initialize(const base::FrameConstPtr &base_frame_ptr)
Initialize sensor frame
const std::vector< SensorObjectPtr > & GetForegroundObjects() const
Get the Foreground Objects object
std::vector< SensorObjectPtr > & GetBackgroundObjects()
Get the Background Objects object
std::string GetSensorId() const
Get the sensor id
bool GetPose(Eigen::Affine3d *pose) const
Get the pose of the sensor frame
std::vector< SensorObjectPtr > & GetForegroundObjects()
Get the Foreground Objects object
double GetTimestamp() const
Get the timestamp of the sensor frame
#define AERROR
Definition log.h:44
SensorType
Sensor types are set in the order of lidar, radar, camera, ultrasonic Please make sure SensorType has...
Definition sensor_meta.h:29
std::shared_ptr< const Frame > FrameConstPtr
Definition frame.h:61
struct apollo::perception::fusion::SensorFrameHeader EIGEN_ALIGN16
std::shared_ptr< SensorFrameHeader > SensorFrameHeaderPtr
std::shared_ptr< const SensorFrameHeader > SensorFrameHeaderConstPtr
std::shared_ptr< Sensor > SensorPtr
class register implement
Definition arena_queue.h:37
SensorFrameHeader(const base::SensorInfo &info, double ts, const Eigen::Affine3d &pose)