Skip to content
Snippets Groups Projects
Commit 5c3d924e authored by vvaquero's avatar vvaquero
Browse files

changes on the object structure

parent 121a2a5c
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,13 @@ void laserscanutils::Line::print() const ...@@ -15,6 +15,13 @@ void laserscanutils::Line::print() const
<< " number of points: " << np_ << std::endl; << " number of points: " << np_ << std::endl;
} }
float laserscanutils::Line::length()
{
return(std::sqrt( std::pow( (this->point_last_(0)-this->point_first_(0)), 2 ) + std::pow( (this->point_last_(1)-this->point_first_(1)), 2) ) );
}
void laserscanutils::Corner::print() const void laserscanutils::Corner::print() const
{ {
std::cout << "Corner Parameters : " << std::endl std::cout << "Corner Parameters : " << std::endl
...@@ -73,3 +80,13 @@ void laserscanutils::Object::print() const ...@@ -73,3 +80,13 @@ void laserscanutils::Object::print() const
} }
float laserscanutils::Object::getArea()
{
return this->size_x_*this->size_y_;
}
float laserscanutils::Object::getPerimeter()
{
return ( (this->size_x_*2) + (this->size_y_*2) );
}
...@@ -24,6 +24,7 @@ namespace laserscanutils ...@@ -24,6 +24,7 @@ namespace laserscanutils
//just a print method //just a print method
void print() const; void print() const;
float length();
}; };
struct Corner struct Corner
...@@ -68,6 +69,19 @@ namespace laserscanutils ...@@ -68,6 +69,19 @@ namespace laserscanutils
this->ref_act_point_ = {0.0, 0.0, 0.0}; this->ref_act_point_ = {0.0, 0.0, 0.0};
this->ref_old_point_ = {0.0, 0.0, 0.0}; this->ref_old_point_ = {0.0, 0.0, 0.0};
this->min_x_ = 1000.0;
this->min_y_ = 1000.0;
this->max_x_ = -1000.0;
this->max_y_ = -1000.0;
this->angle_ = 0.0;
this->orientation_ = 0.0;
this->object_center_ << 0.0, 0.0;
this->size_x_ = 0.0;
this->size_y_ = 0.0;
// this->polyline_points_ << 0.0, 0.0, 0.0, 0.0, 0.0,
// 0.0, 0.0, 0.0, 0.0, 0.0;
this->ref_type_ = -1; this->ref_type_ = -1;
this->ref_position_ = -1; this->ref_position_ = -1;
...@@ -84,15 +98,26 @@ namespace laserscanutils ...@@ -84,15 +98,26 @@ namespace laserscanutils
// Eigen::Vector2f linear_velocity_; // WRT?? // Eigen::Vector2f linear_velocity_; // WRT??
// Eigen::Vector2f angular_velocity_; // WRT?? // Eigen::Vector2f angular_velocity_; // WRT??
ScalarT id_; // Id of the object. -1 if unknown ScalarT id_; // Id of the object. -1 if unknown or MOBILE; other number if pre-associated.
// Description // Description
ScalarT area_;
Eigen::Vector3s ref_middle_point_; Eigen::Vector3s ref_middle_point_;
Eigen::Vector3s ref_centroid_point_; Eigen::Vector3s ref_centroid_point_;
Eigen::Vector3s ref_act_point_; Eigen::Vector3s ref_act_point_;
Eigen::Vector3s ref_old_point_; Eigen::Vector3s ref_old_point_;
float min_x_;
float min_y_;
float max_x_;
float max_y_;
float angle_;
float orientation_;
float size_x_;
float size_y_;
Eigen::Vector2s object_center_;
Eigen::MatrixXs polyline_points_; //<float,2,5>
int ref_type_; // Type of the reference. 8 = corner; 4 = init_line ; 2 = end_line; 1 = centroid. -1 = unkonwn; int ref_type_; // Type of the reference. 8 = corner; 4 = init_line ; 2 = end_line; 1 = centroid. -1 = unkonwn;
int ref_position_; // The position of the referenced corner (or line) in its corresponding list; int ref_position_; // The position of the referenced corner (or line) in its corresponding list;
...@@ -100,6 +125,8 @@ namespace laserscanutils ...@@ -100,6 +125,8 @@ namespace laserscanutils
// TODO: Bounding Box // TODO: Bounding Box
void print() const; void print() const;
float getArea();
float getPerimeter();
}; };
......
This diff is collapsed.
...@@ -65,7 +65,7 @@ namespace laserscanutils ...@@ -65,7 +65,7 @@ namespace laserscanutils
unsigned int scan_total_points_; //Total number of points in the raw scan unsigned int scan_total_points_; //Total number of points in the raw scan
unsigned int filtered_total_points_; //Total number of valid points after pre filter unsigned int filtered_total_points_; //Total number of valid points after pre filter
unsigned int number_of_clusters_; //Total number of clusters found in the scan unsigned int number_of_clusters_; //Total number of clusters found in the scan (valid and not valid)
unsigned int num_points_in_clusters_; // Total number of points in the clusters unsigned int num_points_in_clusters_; // Total number of points in the clusters
unsigned int number_of_valid_clusters_; //Total number of valid clusters found in the scan unsigned int number_of_valid_clusters_; //Total number of valid clusters found in the scan
unsigned int number_of_global_scan_; //Total number scan till now unsigned int number_of_global_scan_; //Total number scan till now
...@@ -204,44 +204,40 @@ namespace laserscanutils ...@@ -204,44 +204,40 @@ namespace laserscanutils
// /** \brief Calculate Features /** \brief Calculate Features
// * *
// * Calculate middle point, centroid, length, with, area... * Calculate middle point, centroid, length, with, area...
// * *
// * \param _alg_params is the structure of algorithm params for the Laser Object Detection Algorithm. * \param _alg_params is the structure of algorithm params for the Laser Object Detection Algorithm.
// * \param _points is the returned points from the conversion of ranges to homogeneous coordinates * \param _points is the returned points from the conversion of ranges to homogeneous coordinates
// * \param _global_scan_number is the global number of scan processed (to be used as header id) * \param _global_scan_number is the global number of scan processed (to be used as header id)
// * \param _scan_processed is the structure where all the information of elements in a scan is stored * \param _scan_processed is the structure where all the information of elements in a scan is stored
// * *
// **/ **/
// void extractFeaturesInClusters(const Eigen::MatrixXs & _points, void extractFeaturesInObject(const Eigen::MatrixXs & _points,
// laserscanutils::LaserScanProcessed & _scan_processed); Object &_object);
/** \brief Performs the corner association from two objects list /** \brief Performs the association from two objects list
* *
* From a list of objects of both previous and actual scans, computes the distances from all corners and find the * From a list of objects of both previous and actual scans, computes the distances and find the
* closest (euclidean dist threshold) ones as associated. * closest (euclidean dist threshold) ones as associated.
* *
* \param _prev_objects_list is the objects list from the previous scan
* \param _act_objects_list is the objects list from the actual scan
* \param _asso_threshold is the euclidean distance threshold for associate corners.
* \param _obj_asso_results is the vector with the association values! Binary [corner | l_angle | l_init_pt | l_final_pt ].
* *
**/ **/
// Old creates a vector but needs to be checked the structure...really is the solution? cross things....
void associateObjectsPrim(std::list<laserscanutils::Object> & _prev_objects_list,
std::list<laserscanutils::Object> & _act_objects_list,
float _threshold, float _angle_thr,
std::vector<int> &_obj_asso_results);
void associateObjects(std::list<laserscanutils::Object> & _prev_objects_list, void associateObjects(std::list<laserscanutils::Object> & _prev_objects_list,
std::list<laserscanutils::Object> & _act_objects_list, std::list<laserscanutils::Object> & _act_objects_list,
float _corner_threshold, float _angle_thr, float _line_ext_threshold); float _corner_threshold, float _angle_thr, float _line_ext_threshold);
// /** \brief Fullfils the bounding boxes and rest of parameters on the detections.
// *
// **/
// void objectsBB(laserscanutils::LaserScanProcessed & _act_scan);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment