This class provides a thread for computing in real time the superquadric, filtering the point cloud and the superquadric. More...
#include <superqComputation.h>
Inherits Thread.
Public Member Functions | |
SuperqComputation (yarp::os::Mutex &mutex_shared, int _rate, bool _filter_points, bool _filter_superq, bool _fixed_window, std::deque< yarp::sig::Vector > &_points, std::string _tag_file, double _threshold_median, const yarp::os::Property &filters_points_par, yarp::sig::Vector &_x, yarp::sig::Vector &_x_filtered, const yarp::os::Property &filters_superq_par, const yarp::os::Property &optimizer_par, const std::string &_homeContextPath, bool _save_points, yarp::os::ResourceFinder *rf) | |
void | setPointsFilterPar (const yarp::os::Property &newOptions, bool first_time) |
Set options for filtering the point cloud. More... | |
void | setSuperqFilterPar (const yarp::os::Property &newOptions, bool first_time) |
Set options for filtering the superquadric. More... | |
void | setIpoptPar (const yarp::os::Property &newOptions, bool first_time) |
Set options for the optimization problem solved by Ipopt. More... | |
yarp::os::Property | getPointsFilterPar () |
Get options used for filtering the point cloud. More... | |
yarp::os::Property | getSuperqFilterPar () |
Get options used for filtering the superquadric. More... | |
yarp::os::Property | getIpoptPar () |
Get options used for solving the optimization problem with Ipopt. More... | |
void | setPar (const std::string &par_name, const std::string &value) |
Set a parameter equal to a value. More... | |
virtual bool | threadInit () |
Init function of Thread class. | |
virtual void | run () |
Run function of Thread class. | |
virtual void | threadRelease () |
Release function of Thread class. | |
void | savePoints (const std::string &namefile, const yarp::sig::Vector &colors) |
Save point cloud used for reconstructing the superquadric. More... | |
bool | readPointCloud () |
Read the object point cloud from txt for offline tests. | |
void | filter () |
Filter the received point cloud. | |
bool | computeSuperq () |
Compute the superquadric modeling the object. More... | |
void | filterSuperq () |
Filter the superquadri with the median filter. | |
void | resetMedianFilter () |
Reset median filter. | |
int | adaptWindComputation () |
Compute window size according to the object velocity. | |
bool | configFilterSuperq () |
Configure superquadric filter. | |
bool | config3Dpoints () |
Configure point cloud filter. | |
yarp::sig::Vector | getSolution (bool filtered_or_not) |
Return the computed superquadric. More... | |
void | sendPoints (const std::deque< yarp::sig::Vector > &p) |
Get the point cloud for computing the superquadric. More... | |
void | getPoints3D () |
Get the point cloud for computing the superquadric. | |
double | getTime () |
Return the computation time for estimating the superquadric. More... | |
Data Fields | |
int | std_median_order |
median order width | |
int | max_median_order |
max median order width | |
yarp::sig::Vector & | x |
Object superquadric. | |
yarp::sig::Vector & | x_filtered |
Filtered object superquadric. | |
std::deque< yarp::sig::Vector > & | points |
Object point cloud. | |
std::deque< cv::Point > | blob_points |
Object 2D blob. | |
Protected Attributes | |
int | count |
Count variable. | |
bool | save_points |
Boolean variable for enabling point cloud saving. | |
std::string | tag_file |
Tag name of files for saving 3D points. | |
std::string | homeContextPath |
Path where code context is located. | |
yarp::os::ConstString | pointCloudFileName |
Pointcloud name file in case the module runs offline. | |
std::vector< cv::Point > | contour |
OpenCV variable for blob extraction. | |
yarp::os::BufferedPort< yarp::os::Bottle > | pointPort |
Port for receiving point cloud. | |
double | radius |
Radius for spatial density filter. | |
int | nnThreshold |
Density threshold for spatial density filter. | |
int | numVertices |
int | median_order |
Median filder order. | |
int | min_median_order |
Minimum median filder order allowed. | |
int | new_median_order |
New median filder order estimated. | |
bool | filter_points |
Boolean variable for enabling point cloud filtering. | |
bool | fixed_window |
Boolean variable for enabling the use of a fixed window during the median filter. | |
bool | filter_superq |
Boolean variable for enabling superquadric filtering. | |
double | threshold_median |
Threshold for velocity estimation for median order. | |
double | min_norm_vel |
Minimum norm of velocity for considering the object moving. | |
bool | go_on |
Boolean variable for going to the next step of the state machine. | |
bool | one_shot |
double | tol |
Tolerance of the optimization problem. | |
double | sum |
double | max_cpu_time |
Max cpu time allowed for solving the optimization problem. | |
int | acceptable_iter |
Acceptable iter of Ipopt algorithm. | |
int | max_iter |
Maximum iteration allowed of Ipopt algorithm. | |
int | optimizer_points |
Number of 3D points used for optimization. | |
bool | bounds_automatic |
Boolean varibal for enabling automatic computation of variables bounds. | |
std::string | mu_strategy |
Mu strategy of the Ipopt algorithm. | |
std::string | nlp_scaling_method |
NLP scaling method of the Ipopt algorithm. | |
yarp::sig::Vector | elem_x |
double | t_superq |
Time required for computing superquadric. | |
int | count_file |
std::string | ob_class |
Objec class: cylinder, sphere of box. | |
yarp::os::ResourceFinder * | rf |
double | t |
double | t0 |
yarp::os::Mutex | mutex |
yarp::os::Mutex & | mutex_shared |
iCub::ctrl::MedianFilter * | mFilter |
Median filter for discarding wrong superquadrics. | |
iCub::ctrl::AWPolyEstimator * | PolyEst |
Time Polyestimator for estimating object velocity. | |
yarp::os::Property | filter_points_par |
Parameters of point cloud filter. | |
yarp::os::Property | filter_superq_par |
Parameters of superquadric filter. | |
yarp::os::Property | ipopt_par |
Parameters of the Ipopt optimization problem. | |
This class provides a thread for computing in real time the superquadric, filtering the point cloud and the superquadric.
The optimization problem for estimating the superquadric is solved with Ipopt software package.
Definition at line 48 of file superqComputation.h.
bool SuperqComputation::computeSuperq | ( | ) |
Compute the superquadric modeling the object.
Definition at line 742 of file superqComputation.cpp.
References acceptable_iter, bounds_automatic, SuperQuadric_NLP::init(), max_cpu_time, max_iter, mu_strategy, nlp_scaling_method, ob_class, optimizer_points, points, savePoints(), tag_file, tol, and x.
Referenced by run().
Property SuperqComputation::getIpoptPar | ( | ) |
Get options used for solving the optimization problem with Ipopt.
Definition at line 418 of file superqComputation.cpp.
References acceptable_iter, max_cpu_time, max_iter, mu_strategy, nlp_scaling_method, optimizer_points, and tol.
Property SuperqComputation::getPointsFilterPar | ( | ) |
Get options used for filtering the point cloud.
Definition at line 120 of file superqComputation.cpp.
References nnThreshold, and radius.
Vector SuperqComputation::getSolution | ( | bool | filtered_or_not | ) |
Return the computed superquadric.
filtered_or_not | can be "on" or "off" |
Definition at line 867 of file superqComputation.cpp.
References x, and x_filtered.
Property SuperqComputation::getSuperqFilterPar | ( | ) |
Get options used for filtering the superquadric.
Definition at line 259 of file superqComputation.cpp.
References fixed_window, max_median_order, min_median_order, min_norm_vel, std_median_order, and threshold_median.
double SuperqComputation::getTime | ( | ) |
Return the computation time for estimating the superquadric.
Definition at line 451 of file superqComputation.cpp.
References t_superq.
void SuperqComputation::savePoints | ( | const std::string & | namefile, |
const yarp::sig::Vector & | colors | ||
) |
Save point cloud used for reconstructing the superquadric.
namefile | is the name of the file where to save the superquadric |
colors | is a Vector with the color to be used for saving the point cloud |
Definition at line 622 of file superqComputation.cpp.
References homeContextPath, points, and save_points.
Referenced by computeSuperq(), and filter().
void SuperqComputation::sendPoints | ( | const std::deque< yarp::sig::Vector > & | p | ) |
Get the point cloud for computing the superquadric.
p | is the object point cloud |
Definition at line 878 of file superqComputation.cpp.
References points.
void SuperqComputation::setIpoptPar | ( | const yarp::os::Property & | newOptions, |
bool | first_time | ||
) |
Set options for the optimization problem solved by Ipopt.
newOptions | is a Property with the new options to set |
first_time | takes into account if the options have already been set or not |
Definition at line 277 of file superqComputation.cpp.
References acceptable_iter, max_cpu_time, max_iter, mu_strategy, nlp_scaling_method, optimizer_points, points, and tol.
Referenced by threadInit().
void SuperqComputation::setPar | ( | const std::string & | par_name, |
const std::string & | value | ||
) |
Set a parameter equal to a value.
par_name | is the name of the variable we want to change |
value | is the new balue |
Definition at line 434 of file superqComputation.cpp.
References filter_points, filter_superq, ob_class, save_points, and tag_file.
void SuperqComputation::setPointsFilterPar | ( | const yarp::os::Property & | newOptions, |
bool | first_time | ||
) |
Set options for filtering the point cloud.
newOptions | is a Property with the new options to set |
first_time | takes into account if the options have already been set or not |
Definition at line 76 of file superqComputation.cpp.
References nnThreshold, and radius.
Referenced by threadInit().
void SuperqComputation::setSuperqFilterPar | ( | const yarp::os::Property & | newOptions, |
bool | first_time | ||
) |
Set options for filtering the superquadric.
newOptions | is a Property with the new options to set |
first_time | takes into account if the options have already been set or not |
Definition at line 131 of file superqComputation.cpp.
References fixed_window, max_median_order, min_median_order, min_norm_vel, std_median_order, and threshold_median.
Referenced by threadInit().