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

#include <sensor.h>

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

Public 成员函数

 Sensor ()=delete
 
 Sensor (const base::SensorInfo &sensor_info)
 
void QueryLatestFrames (double timestamp, std::vector< SensorFramePtr > *frames)
 query frames whose time stamp is in range (_latest_fused_time_stamp, time_stamp]
 
SensorFramePtr QueryLatestFrame (double timestamp)
 query latest frame whose time stamp is in range (_latest_fused_time_stamp, time_stamp]
 
bool GetPose (double timestamp, Eigen::Affine3d *pose) const
 
std::string GetSensorId () const
 
base::SensorType GetSensorType () const
 
void AddFrame (const base::FrameConstPtr &frame_ptr)
 
void SetLatestQueryTimestamp (const double latest_query_timestamp)
 

静态 Public 成员函数

static void SetMaxCachedFrameNumber (size_t number)
 

详细描述

在文件 sensor.h 第 32 行定义.

构造及析构函数说明

◆ Sensor() [1/2]

apollo::perception::fusion::Sensor::Sensor ( )
delete

◆ Sensor() [2/2]

apollo::perception::fusion::Sensor::Sensor ( const base::SensorInfo &  sensor_info)
inlineexplicit

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

37 : sensor_info_(sensor_info) {}

成员函数说明

◆ AddFrame()

void apollo::perception::fusion::Sensor::AddFrame ( const base::FrameConstPtr &  frame_ptr)

在文件 sensor.cc 第 71 行定义.

71 {
72 SensorFramePtr frame(new SensorFrame(frame_ptr));
73 if (frames_.size() == kMaxCachedFrameNum) {
74 frames_.pop_front();
75 }
76 frames_.emplace_back(frame);
77}
std::shared_ptr< SensorFrame > SensorFramePtr

◆ GetPose()

bool apollo::perception::fusion::Sensor::GetPose ( double  timestamp,
Eigen::Affine3d *  pose 
) const

在文件 sensor.cc 第 55 行定义.

55 {
56 if (pose == nullptr) {
57 AERROR << "pose is not available";
58 return false;
59 }
60 for (int i = static_cast<int>(frames_.size()) - 1; i >= 0; --i) {
61 double time_diff = timestamp - frames_[i]->GetTimestamp();
62 if (fabs(time_diff) < 1.0e-3) { // > ?
63 return frames_[i]->GetPose(pose);
64 }
65 }
66
67 AWARN << "Failed to find pose for timestamp: " << timestamp;
68 return false;
69}
#define AERROR
Definition log.h:44
#define AWARN
Definition log.h:43

◆ GetSensorId()

std::string apollo::perception::fusion::Sensor::GetSensorId ( ) const
inline

在文件 sensor.h 第 60 行定义.

60{ return sensor_info_.name; }

◆ GetSensorType()

base::SensorType apollo::perception::fusion::Sensor::GetSensorType ( ) const
inline

在文件 sensor.h 第 63 行定义.

63{ return sensor_info_.type; }

◆ QueryLatestFrame()

SensorFramePtr apollo::perception::fusion::Sensor::QueryLatestFrame ( double  timestamp)

query latest frame whose time stamp is in range (_latest_fused_time_stamp, time_stamp]

参数
timestamp
返回
SensorFramePtr

在文件 sensor.cc 第 43 行定义.

43 {
44 SensorFramePtr latest_frame = nullptr;
45 for (size_t i = 0; i < frames_.size(); ++i) {
46 if (frames_[i]->GetTimestamp() > latest_query_timestamp_ &&
47 frames_[i]->GetTimestamp() <= timestamp) {
48 latest_frame = frames_[i];
49 latest_query_timestamp_ = frames_[i]->GetTimestamp();
50 }
51 }
52 return latest_frame;
53}

◆ QueryLatestFrames()

void apollo::perception::fusion::Sensor::QueryLatestFrames ( double  timestamp,
std::vector< SensorFramePtr > *  frames 
)

query frames whose time stamp is in range (_latest_fused_time_stamp, time_stamp]

参数
timestamp
frames

在文件 sensor.cc 第 26 行定义.

27 {
28 if (frames == nullptr) {
29 AERROR << "frames are not available";
30 return;
31 }
32
33 frames->clear();
34 for (size_t i = 0; i < frames_.size(); ++i) {
35 if (frames_[i]->GetTimestamp() > latest_query_timestamp_ &&
36 frames_[i]->GetTimestamp() <= timestamp) {
37 frames->push_back(frames_[i]);
38 }
39 }
40 latest_query_timestamp_ = timestamp;
41}

◆ SetLatestQueryTimestamp()

void apollo::perception::fusion::Sensor::SetLatestQueryTimestamp ( const double  latest_query_timestamp)
inline

在文件 sensor.h 第 71 行定义.

71 {
72 latest_query_timestamp_ = latest_query_timestamp;
73 }

◆ SetMaxCachedFrameNumber()

static void apollo::perception::fusion::Sensor::SetMaxCachedFrameNumber ( size_t  number)
inlinestatic

在文件 sensor.h 第 67 行定义.

67 {
68 kMaxCachedFrameNum = number;
69 }

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