-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDetector.hpp
More file actions
97 lines (77 loc) · 2.65 KB
/
Copy pathDetector.hpp
File metadata and controls
97 lines (77 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**
* @file Detector.hpp
* @author Víctor Moreno Borràs (victor.moreno.borras@estudiantat.upc.edu)
* @brief It contains the specification of the Detector module.
* @version 2.0
* @date 2024-04-20
*
* @copyright Copyright (c) 2024 BCN eMotorsport
*
*/
#ifndef DETECTOR_HPP
#define DETECTOR_HPP
#include <vector>
#include "objects/Cluster.hpp"
#include "objects/Params.hpp"
#include "utils/FEC.hpp"
#include <pcl/point_types.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/features/normal_3d.h>
#include <pcl/kdtree/kdtree.h>
#include <pcl/sample_consensus/method_types.h>
#include <pcl/sample_consensus/model_types.h>
#include <pcl/segmentation/sac_segmentation.h>
#include <pcl/segmentation/extract_clusters.h>
/**
* @brief The Detector module .
* It is responsible for:
* - Clustering stage
* - Classification stage
*/
class Detector {
private:
/* ------------------ Private Constructor And Destructor ------------------ */
Detector();
~Detector();
/* -------------------------- Private Utils -------------------------- */
FEC fec;
/* -------------------------- Private Attributes -------------------------- */
float eps_;
int maxPts_, minPts_;
std::vector<Cluster> clusters;
pcl::PointCloud<pcl::PointXYZI>::Ptr cloud;
/* ---------------------------- Private Methods --------------------------- */
/**
* @brief It uses the Fast Euclidean Clustering algorithm.
*
*/
void fastEuclideanClustering();
public:
/* --------------------------- Singleton Pattern -------------------------- */
static Detector& getInstance() {
static Detector instance;
return instance;
}
Detector(Detector const &) = delete;
void operator=(Detector const &) = delete;
/* -------------------------- Getters --------------------------- */
inline std::vector<Cluster> &getClusters() { return clusters; }
inline pcl::PointCloud<pcl::PointXYZI>::Ptr getCloudPoints() { return cloud; }
/* ---------------------------- Public Methods ---------------------------- */
/**
* Initializes the point cloud from a vector, and the octree.
*
* @param[in] params The parameters for the Detector module.
*/
void init(const Params::Detector ¶ms);
/**
* Update the cloud with the data of the vector.
*
* @param[in] buffer The parameters for the Detector module.
*/
void update(const std::vector<pcl::PointXYZI> buffer);
void update(const pcl::PointCloud<pcl::PointXYZI>::Ptr &buffer);
void generateClusters(void);
void classification(std::vector<Cluster> &clusters, std::vector<Cluster> &cones);
};
#endif