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

#include <spp_cluster_list.h>

apollo::perception::lidar::SppClusterList 的协作图:

Public 成员函数

 SppClusterList ()
 
void Init (size_t size, const std::string &sensor_name="velodyne64")
 
void Reset ()
 
void resize (size_t size)
 
void AddPointSample (size_t cluster_id, const base::PointF &point, float height, uint32_t point_id)
 
std::vector< SppClusterPtr > & clusters ()
 
const std::vector< SppClusterPtr > & clusters () const
 
size_t size () const
 
SppClusterPtr & operator[] (int id)
 
const SppClusterPtr & operator[] (int id) const
 
void Merge (SppClusterList *rhs)
 
size_t HeightCut (float max_gap, size_t start_id=0)
 
bool ComputeHeightAndSplitCluster (size_t id, float max_gap)
 
void RemoveEmptyClusters ()
 
void EraseCluster (size_t id)
 
SppClusterList & operator= (const SppLabelImage &rhs)
 

详细描述

在文件 spp_cluster_list.h 第 29 行定义.

构造及析构函数说明

◆ SppClusterList()

apollo::perception::lidar::SppClusterList::SppClusterList ( )
inline

在文件 spp_cluster_list.h 第 31 行定义.

31{ clusters_.reserve(kDefaultReserveSize); }

成员函数说明

◆ AddPointSample()

void apollo::perception::lidar::SppClusterList::AddPointSample ( size_t  cluster_id,
const base::PointF &  point,
float  height,
uint32_t  point_id 
)

在文件 spp_cluster_list.cc 第 40 行定义.

42 {
43 if (clusters_.size() <= cluster_id) {
44 resize(cluster_id + 1);
45 }
46 clusters_[cluster_id]->AddPointSample(point, height, point_id);
47}

◆ clusters() [1/2]

std::vector< SppClusterPtr > & apollo::perception::lidar::SppClusterList::clusters ( )
inline

在文件 spp_cluster_list.h 第 50 行定义.

50{ return clusters_; }

◆ clusters() [2/2]

const std::vector< SppClusterPtr > & apollo::perception::lidar::SppClusterList::clusters ( ) const
inline

在文件 spp_cluster_list.h 第 53 行定义.

53 {
54 return clusters_;
55 }

◆ ComputeHeightAndSplitCluster()

bool apollo::perception::lidar::SppClusterList::ComputeHeightAndSplitCluster ( size_t  id,
float  max_gap 
)

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

70 {
71 if (id >= clusters_.size()) {
72 return false;
73 }
74
75 clusters_[id]->SortPoint();
76 std::vector<SppPoint>& points = clusters_[id]->points;
77 std::vector<uint32_t>& indices = clusters_[id]->point_ids;
78
79 float gap = 0.f;
80 std::vector<size_t> split_indices(1, 0);
81 for (size_t i = 1; i < points.size(); ++i) {
82 if (points[i].h < 0) {
83 continue;
84 }
85 gap = points[i].z - points[i - 1].z;
86 if (gap > max_gap) {
87 split_indices.push_back(i);
88 }
89 }
90 size_t split_num = split_indices.size();
91 if (split_num > 0) {
92 size_t max_index = split_indices.size() - 1;
93 size_t length = points.size() - split_indices.back();
94 size_t max_length = length;
95 for (size_t i = 1; i < split_indices.size(); ++i) {
96 length = split_indices[i] - split_indices[i - 1];
97 if (length > max_length) {
98 max_length = length;
99 max_index = i - 1;
100 }
101 }
102 // the highest split is not stable
103 if (max_index != split_indices.size() - 1) {
104 size_t split_index = split_indices[max_index + 1];
105 points.resize(split_index);
106 indices.resize(split_index);
107 return true;
108 }
109 }
110 return false;
111}

◆ EraseCluster()

void apollo::perception::lidar::SppClusterList::EraseCluster ( size_t  id)

在文件 spp_cluster_list.cc 第 126 行定义.

126 {
127 if (clusters_.size() <= id) {
128 return;
129 }
130 clusters_[id] = clusters_.back();
131 clusters_.resize(clusters_.size() - 1);
132}

◆ HeightCut()

size_t apollo::perception::lidar::SppClusterList::HeightCut ( float  max_gap,
size_t  start_id = 0 
)

在文件 spp_cluster_list.cc 第 56 行定义.

56 {
57 size_t size = clusters_.size();
58 size_t count = 0;
59 for (size_t i = start_id; i < size; ++i) {
60 if (clusters_[i]->points.size() > 0) {
61 if (ComputeHeightAndSplitCluster(i, max_gap)) {
62 ++count;
63 }
64 }
65 }
66 AINFO << "Split " << count << " clusters in 3d";
67 return count;
68}
bool ComputeHeightAndSplitCluster(size_t id, float max_gap)
#define AINFO
Definition log.h:42

◆ Init()

void apollo::perception::lidar::SppClusterList::Init ( size_t  size,
const std::string &  sensor_name = "velodyne64" 
)

在文件 spp_cluster_list.cc 第 25 行定义.

25 {
26 sensor_name_ = sensor_name;
27 clusters_.clear();
28 SppClusterPool::Instance(sensor_name_).BatchGet(size, &clusters_);
29}
void BatchGet(size_t num, std::vector< std::shared_ptr< ObjectType > > *data) override
static LightObjectPool & Instance(const std::string &sensor_name="velodyne64")

◆ Merge()

void apollo::perception::lidar::SppClusterList::Merge ( SppClusterList *  rhs)

在文件 spp_cluster_list.cc 第 49 行定义.

49 {
50 clusters_.reserve(clusters_.size() + rhs->clusters_.size());
51 for (size_t i = 0; i < rhs->size(); ++i) {
52 clusters_.push_back((*rhs)[static_cast<int>(i)]);
53 }
54}

◆ operator=()

SppClusterList & apollo::perception::lidar::SppClusterList::operator= ( const SppLabelImage &  rhs)
inline

在文件 spp_cluster_list.h 第 83 行定义.

83 {
84 clusters_ = rhs.GetClusters();
85 return *this;
86 }

◆ operator[]() [1/2]

SppClusterPtr & apollo::perception::lidar::SppClusterList::operator[] ( int  id)
inline

在文件 spp_cluster_list.h 第 61 行定义.

61{ return clusters_[id]; }

◆ operator[]() [2/2]

const SppClusterPtr & apollo::perception::lidar::SppClusterList::operator[] ( int  id) const
inline

在文件 spp_cluster_list.h 第 64 行定义.

64{ return clusters_[id]; }

◆ RemoveEmptyClusters()

void apollo::perception::lidar::SppClusterList::RemoveEmptyClusters ( )

在文件 spp_cluster_list.cc 第 113 行定义.

113 {
114 size_t current = 0;
115 for (size_t i = 0; i < clusters_.size(); ++i) {
116 if (clusters_[i]->points.size() > 0) {
117 if (current != i) {
118 clusters_[current] = clusters_[i];
119 }
120 ++current;
121 }
122 }
123 clusters_.resize(current);
124}

◆ Reset()

void apollo::perception::lidar::SppClusterList::Reset ( )
inline

在文件 spp_cluster_list.h 第 37 行定义.

37{ clusters_.clear(); }

◆ resize()

void apollo::perception::lidar::SppClusterList::resize ( size_t  size)

在文件 spp_cluster_list.cc 第 31 行定义.

31 {
32 if (clusters_.size() < size) {
33 SppClusterPool::Instance(sensor_name_)
34 .BatchGet(size - clusters_.size(), &clusters_);
35 } else {
36 clusters_.resize(size);
37 }
38}

◆ size()

size_t apollo::perception::lidar::SppClusterList::size ( ) const
inline

在文件 spp_cluster_list.h 第 58 行定义.

58{ return clusters_.size(); }

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