Apollo 11.0
自动驾驶开放平台
sensor_frame.cc
浏览该文件的文档.
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 *****************************************************************************/
17
18namespace apollo {
19namespace perception {
20namespace fusion {
21
23
25 Initialize(base_frame_ptr);
26}
27
28void SensorFrame::Initialize(const base::FrameConstPtr& base_frame_ptr) {
29 header_.reset(new SensorFrameHeader(base_frame_ptr->sensor_info,
30 base_frame_ptr->timestamp,
31 base_frame_ptr->sensor2world_pose));
32
33 lidar_frame_supplement_ = base_frame_ptr->lidar_frame_supplement;
34 radar_frame_supplement_ = base_frame_ptr->radar_frame_supplement;
35 camera_frame_supplement_ = base_frame_ptr->camera_frame_supplement;
36
37 const auto& base_objects = base_frame_ptr->objects;
38 foreground_objects_.reserve(base_objects.size());
39
40 for (const auto& base_obj : base_objects) {
41 SensorObjectPtr obj(new SensorObject(base_obj, header_));
42 if (base_obj->lidar_supplement.is_background) {
43 background_objects_.emplace_back(obj);
44 } else {
45 foreground_objects_.emplace_back(obj);
46 }
47 }
48}
49
51 const SensorPtr& sensor) {
52 Initialize(base_frame_ptr);
53}
54
55std::string SensorFrame::GetSensorId() const {
56 if (header_ == nullptr) {
57 return std::string("");
58 }
59
60 return header_->sensor_info.name;
61}
62
64 if (header_ == nullptr) {
66 }
67
68 return header_->sensor_info.type;
69}
70
71} // namespace fusion
72} // namespace perception
73} // namespace apollo
base::SensorType GetSensorType() const
Get the sensor type
void Initialize(const base::FrameConstPtr &base_frame_ptr)
Initialize sensor frame
std::string GetSensorId() const
Get the sensor id
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
std::shared_ptr< SensorObject > SensorObjectPtr
std::shared_ptr< Sensor > SensorPtr
class register implement
Definition arena_queue.h:37