Apollo 11.0
自动驾驶开放平台
sensor_object.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
21#include "Eigen/Core"
22
26
27namespace apollo {
28namespace perception {
29namespace fusion {
30
32 public:
33 SensorObject() = delete;
34
35 explicit SensorObject(const std::shared_ptr<const base::Object>& object_ptr);
36
37 SensorObject(const std::shared_ptr<const base::Object>& object_ptr,
38 const std::shared_ptr<const SensorFrameHeader>& frame_header);
39
40 SensorObject(const std::shared_ptr<const base::Object>& object_ptr,
41 const std::shared_ptr<SensorFrame>& frame_ptr);
42
43 // Getter
44 // @brief get frame timestamp which might be different with object timestamp
45 double GetTimestamp() const;
46 bool GetRelatedFramePose(Eigen::Affine3d* pose) const;
47
48 std::string GetSensorId() const;
50
51 inline std::shared_ptr<const base::Object> GetBaseObject() const {
52 return object_;
53 }
54
55 inline double GetInvisiblePeriod() const { return invisible_period_; }
56
57 inline void SetInvisiblePeriod(double period) { invisible_period_ = period; }
58
59 private:
60 // FRIEND_TEST(SensorObjectTest, test);
61
62 std::shared_ptr<const base::Object> object_;
63 double invisible_period_ = 0.0;
64 std::shared_ptr<const SensorFrameHeader> frame_header_ = nullptr;
65};
66
67typedef std::shared_ptr<SensorObject> SensorObjectPtr;
68typedef std::shared_ptr<const SensorObject> SensorObjectConstPtr;
69
71 public:
73 ~FusedObject() = default;
74
75 inline double GetTimestamp() const { return object_->latest_tracked_time; }
76
77 inline std::shared_ptr<base::Object> GetBaseObject() { return object_; }
78
79 private:
80 std::shared_ptr<base::Object> object_;
81};
82
83typedef std::shared_ptr<FusedObject> FusedObjectPtr;
84
85bool IsLidar(const SensorObjectConstPtr& obj);
86bool IsRadar(const SensorObjectConstPtr& obj);
87bool IsCamera(const SensorObjectConstPtr& obj);
88
89} // namespace fusion
90} // namespace perception
91} // namespace apollo
std::shared_ptr< base::Object > GetBaseObject()
std::shared_ptr< const base::Object > GetBaseObject() const
bool GetRelatedFramePose(Eigen::Affine3d *pose) const
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 SensorObject > SensorObjectConstPtr
std::shared_ptr< SensorObject > SensorObjectPtr
bool IsCamera(const SensorObjectConstPtr &obj)
std::shared_ptr< FusedObject > FusedObjectPtr
bool IsLidar(const SensorObjectConstPtr &obj)
bool IsRadar(const SensorObjectConstPtr &obj)
class register implement
Definition arena_queue.h:37