Apollo  6.0
Open source self driving car software
frame_supplement.h
Go to the documentation of this file.
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 
24 
25 namespace apollo {
26 namespace perception {
27 namespace base {
28 // sensor-specific frame supplements: Lidar, Radar, Camera
29 struct alignas(16) LidarFrameSupplement {
30  // @brief valid only when on_use = true
31  bool on_use = false;
32 
33  // @brief only reference of the original cloud in lidar coordinate system
34  std::shared_ptr<AttributePointCloud<PointF>> cloud_ptr;
35 
36  void Reset() {
37  on_use = false;
38  cloud_ptr = nullptr;
39  }
40 };
41 
42 typedef std::shared_ptr<LidarFrameSupplement> LidarFrameSupplementPtr;
43 typedef std::shared_ptr<const LidarFrameSupplement>
45 
46 struct alignas(16) RadarFrameSupplement {
47  // @brief valid only when on_use = true
48  bool on_use = false;
49  void Reset() { on_use = false; }
50 };
51 typedef std::shared_ptr<RadarFrameSupplement> RadarFrameSupplementPtr;
52 typedef std::shared_ptr<const RadarFrameSupplement>
54 
55 struct alignas(16) CameraFrameSupplement {
56  // @brief valid only when on_use = true
57  bool on_use = false;
58 
59  // @brief only reference of the image data
60  Image8UPtr image_ptr = nullptr;
61 
62  // TODO(guiyilin): modify interfaces of visualizer, use Image8U
63  std::shared_ptr<Blob<uint8_t>> image_blob = nullptr;
64 
65  void Reset() {
66  on_use = false;
67  image_ptr = nullptr;
68  image_blob = nullptr;
69  }
70 };
71 
72 typedef std::shared_ptr<CameraFrameSupplement> CameraFrameSupplementPtr;
73 typedef std::shared_ptr<const CameraFrameSupplement>
75 
76 struct alignas(16) UltrasonicFrameSupplement {
77  // @brief valid only when on_use = true
78  bool on_use = false;
79 
80  // @brief only reference of the image data
81  std::shared_ptr<ImpendingCollisionEdges> impending_collision_edges_ptr;
82 
83  void Reset() {
84  on_use = false;
85  impending_collision_edges_ptr = nullptr;
86  }
87 };
88 
89 typedef std::shared_ptr<UltrasonicFrameSupplement> UltrasonicFrameSupplementPtr;
90 typedef std::shared_ptr<const UltrasonicFrameSupplement>
92 
93 } // namespace base
94 } // namespace perception
95 } // namespace apollo
std::shared_ptr< const LidarFrameSupplement > LidarFrameSupplementConstPtr
Definition: frame_supplement.h:44
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
void Reset()
Definition: frame_supplement.h:65
std::shared_ptr< const UltrasonicFrameSupplement > UltrasonicFrameSupplementConstPtr
Definition: frame_supplement.h:91
Definition: frame_supplement.h:29
bool on_use
Definition: frame_supplement.h:31
void Reset()
Definition: frame_supplement.h:83
std::shared_ptr< CameraFrameSupplement > CameraFrameSupplementPtr
Definition: frame_supplement.h:72
std::shared_ptr< const RadarFrameSupplement > RadarFrameSupplementConstPtr
Definition: frame_supplement.h:53
std::shared_ptr< Image8U > Image8UPtr
Definition: image_8u.h:148
std::shared_ptr< const CameraFrameSupplement > CameraFrameSupplementConstPtr
Definition: frame_supplement.h:74
void Reset()
Definition: frame_supplement.h:49
std::shared_ptr< AttributePointCloud< PointF > > cloud_ptr
Definition: frame_supplement.h:34
std::shared_ptr< ImpendingCollisionEdges > impending_collision_edges_ptr
Definition: frame_supplement.h:81
Definition: frame_supplement.h:46
std::shared_ptr< LidarFrameSupplement > LidarFrameSupplementPtr
Definition: frame_supplement.h:42
std::shared_ptr< RadarFrameSupplement > RadarFrameSupplementPtr
Definition: frame_supplement.h:51
void Reset()
Definition: frame_supplement.h:36
std::shared_ptr< UltrasonicFrameSupplement > UltrasonicFrameSupplementPtr
Definition: frame_supplement.h:89
Definition: frame_supplement.h:55