Apollo 11.0
自动驾驶开放平台
apollo::perception::fusion::SensorDataManager类 参考

#include <sensor_data_manager.h>

apollo::perception::fusion::SensorDataManager 的协作图:

Public 成员函数

bool Init ()
 Initialization
 
void Reset ()
 Reset the data
 
void AddSensorMeasurements (const base::FrameConstPtr &frame_ptr)
 Add the data frame, which contains the obstacles detected by the sensor
 
bool IsLidar (const base::FrameConstPtr &frame_ptr)
 Is the data frame detected by lidar
 
bool IsRadar (const base::FrameConstPtr &frame_ptr)
 Is the data frame detected by radar
 
bool IsCamera (const base::FrameConstPtr &frame_ptr)
 Is the data frame detected by camera
 
void GetLatestSensorFrames (double timestamp, const std::string &sensor_id, std::vector< SensorFramePtr > *frames) const
 Get the latest sensor frames
 
void GetLatestFrames (double timestamp, std::vector< SensorFramePtr > *frames) const
 Get the latest sensor frames
 
bool GetPose (const std::string &sensor_id, double timestamp, Eigen::Affine3d *pose) const
 Get the Pose object
 
base::BaseCameraModelPtr GetCameraIntrinsic (const std::string &sensor_id) const
 Get the Camera Intrinsic object
 

详细描述

在文件 sensor_data_manager.h 第 36 行定义.

成员函数说明

◆ AddSensorMeasurements()

void apollo::perception::fusion::SensorDataManager::AddSensorMeasurements ( const base::FrameConstPtr &  frame_ptr)

Add the data frame, which contains the obstacles detected by the sensor

参数
frame_ptrSensor detection input data frame

在文件 sensor_data_manager.cc 第 45 行定义.

46 {
47 const base::SensorInfo& sensor_info = frame_ptr->sensor_info;
48 std::string sensor_id = sensor_info.name;
49 const auto it = sensors_.find(sensor_id);
50 SensorPtr sensor_ptr = nullptr;
51 if (it == sensors_.end()) {
52 if (!sensor_manager_->IsSensorExist(sensor_id)) {
53 AERROR << "Failed to find sensor " << sensor_id << " in sensor manager.";
54 return;
55 }
56 sensor_ptr.reset(new Sensor(sensor_info));
57 sensors_.emplace(sensor_id, sensor_ptr);
58 } else {
59 sensor_ptr = it->second;
60 }
61
62 sensor_ptr->AddFrame(frame_ptr);
63}
bool IsSensorExist(const std::string &name) const
#define AERROR
Definition log.h:44
std::shared_ptr< Sensor > SensorPtr

◆ GetCameraIntrinsic()

base::BaseCameraModelPtr apollo::perception::fusion::SensorDataManager::GetCameraIntrinsic ( const std::string &  sensor_id) const

Get the Camera Intrinsic object

参数
sensor_id
返回
base::BaseCameraModelPtr

在文件 sensor_data_manager.cc 第 135 行定义.

136 {
137 return sensor_manager_->GetUndistortCameraModel(sensor_id);
138}
std::shared_ptr< BaseCameraModel > GetUndistortCameraModel(const std::string &name) const

◆ GetLatestFrames()

void apollo::perception::fusion::SensorDataManager::GetLatestFrames ( double  timestamp,
std::vector< SensorFramePtr > *  frames 
) const

Get the latest sensor frames

参数
timestamp
frames

在文件 sensor_data_manager.cc 第 94 行定义.

95 {
96 if (frames == nullptr) {
97 AERROR << "Nullptr error.";
98 return;
99 }
100
101 frames->clear();
102 for (auto it = sensors_.begin(); it != sensors_.end(); ++it) {
103 SensorFramePtr frame = it->second->QueryLatestFrame(timestamp);
104 if (frame != nullptr) {
105 frames->push_back(frame);
106 }
107 }
108
109 if (frames->empty()) {
110 return;
111 }
112
113 std::sort(frames->begin(), frames->end(),
114 [](const SensorFramePtr& p1, const SensorFramePtr& p2) {
115 return p1->GetTimestamp() < p2->GetTimestamp();
116 });
117}
std::shared_ptr< SensorFrame > SensorFramePtr

◆ GetLatestSensorFrames()

void apollo::perception::fusion::SensorDataManager::GetLatestSensorFrames ( double  timestamp,
const std::string &  sensor_id,
std::vector< SensorFramePtr > *  frames 
) const

Get the latest sensor frames

参数
timestamp
sensor_id
frames

在文件 sensor_data_manager.cc 第 80 行定义.

82 {
83 if (frames == nullptr) {
84 AERROR << "Nullptr error.";
85 return;
86 }
87 const auto it = sensors_.find(sensor_id);
88 if (it == sensors_.end()) {
89 return;
90 }
91 return it->second->QueryLatestFrames(timestamp, frames);
92}

◆ GetPose()

bool apollo::perception::fusion::SensorDataManager::GetPose ( const std::string &  sensor_id,
double  timestamp,
Eigen::Affine3d *  pose 
) const

Get the Pose object

参数
sensor_id
timestamp
pose
返回
true
false

在文件 sensor_data_manager.cc 第 119 行定义.

120 {
121 if (pose == nullptr) {
122 AERROR << "Nullptr error.";
123 return false;
124 }
125
126 const auto it = sensors_.find(sensor_id);
127 if (it == sensors_.end()) {
128 AERROR << "Failed to find sensor " << sensor_id << " for get pose.";
129 return false;
130 }
131
132 return it->second->GetPose(timestamp, pose);
133}

◆ Init()

bool apollo::perception::fusion::SensorDataManager::Init ( )

Initialization

返回
true
false

在文件 sensor_data_manager.cc 第 30 行定义.

30 {
31 if (inited_) {
32 return true;
33 }
34 sensor_manager_ = algorithm::SensorManager::Instance();
35 inited_ = true;
36 return true;
37}

◆ IsCamera()

bool apollo::perception::fusion::SensorDataManager::IsCamera ( const base::FrameConstPtr &  frame_ptr)

Is the data frame detected by camera

参数
frame_ptr
返回
true detected by camera
false not detected by camera

在文件 sensor_data_manager.cc 第 75 行定义.

75 {
76 base::SensorType type = frame_ptr->sensor_info.type;
77 return sensor_manager_->IsCamera(type);
78}
bool IsCamera(const std::string &name) const
SensorType
Sensor types are set in the order of lidar, radar, camera, ultrasonic Please make sure SensorType has...
Definition sensor_meta.h:29

◆ IsLidar()

bool apollo::perception::fusion::SensorDataManager::IsLidar ( const base::FrameConstPtr &  frame_ptr)

Is the data frame detected by lidar

参数
frame_ptr
返回
true detected by lidar
false not detected by lidar

在文件 sensor_data_manager.cc 第 65 行定义.

65 {
66 base::SensorType type = frame_ptr->sensor_info.type;
67 return sensor_manager_->IsLidar(type);
68}
bool IsLidar(const std::string &name) const

◆ IsRadar()

bool apollo::perception::fusion::SensorDataManager::IsRadar ( const base::FrameConstPtr &  frame_ptr)

Is the data frame detected by radar

参数
frame_ptr
返回
true detected by radar
false not detected by radar

在文件 sensor_data_manager.cc 第 70 行定义.

70 {
71 base::SensorType type = frame_ptr->sensor_info.type;
72 return sensor_manager_->IsRadar(type);
73}
bool IsRadar(const std::string &name) const

◆ Reset()

void apollo::perception::fusion::SensorDataManager::Reset ( )

Reset the data

在文件 sensor_data_manager.cc 第 39 行定义.

39 {
40 inited_ = false;
41 sensor_manager_ = nullptr;
42 sensors_.clear();
43}

该类的文档由以下文件生成: