MultiRBTracker.h
Go to the documentation of this file.
1 /*
2  * MultiRBTracker.h
3  *
4  * Author: roberto
5  *
6  * This is a modified implementation of the method for online estimation of kinematic structures described in our paper
7  * "Online Interactive Perception of Articulated Objects with Multi-Level Recursive Estimation Based on Task-Specific Priors"
8  * (Martín-Martín and Brock, 2014).
9  * This implementation can be used to reproduce the results of the paper and to be applied to new research.
10  * The implementation allows also to be extended to perceive different information/models or to use additional sources of information.
11  * A detail explanation of the method and the system can be found in our paper.
12  *
13  * If you are using this implementation in your research, please consider citing our work:
14  *
15 @inproceedings{martinmartin_ip_iros_2014,
16 Title = {Online Interactive Perception of Articulated Objects with Multi-Level Recursive Estimation Based on Task-Specific Priors},
17 Author = {Roberto {Mart\'in-Mart\'in} and Oliver Brock},
18 Booktitle = {Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems},
19 Pages = {2494-2501},
20 Year = {2014},
21 Location = {Chicago, Illinois, USA},
22 Note = {http://www.robotics.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martinmartin_ip_iros_2014.pdf},
23 Url = {http://www.robotics.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martinmartin_ip_iros_2014.pdf},
24 Projectname = {Interactive Perception}
25 }
26  * If you have questions or suggestions, contact us:
27  * roberto.martinmartin@tu-berlin.de
28  *
29  * Enjoy!
30  */
31 
32 #ifndef MULTI_RB_TRACKER_H_
33 #define MULTI_RB_TRACKER_H_
34 
35 #include <rb_tracker/RBTrackerDynReconfConfig.h>
36 
37 #include "rb_tracker/RBFilter.h"
38 
40 #include "omip_msgs/RigidBodyTwistWithCovMsg.h"
41 
43 
45 
46 #include "omip_msgs/ShapeTrackerStates.h"
47 
48 #include <tf/transform_listener.h>
49 
51 
52 #include <boost/thread/thread.hpp>
53 #include <boost/thread/mutex.hpp>
54 
55 #include <iostream>
56 #include <fstream>
57 
58 #define INTEGRATOR_VISION_CHANNEL 0
59 #define INTEGRATOR_PROPRIOCEPTION_CHANNEL 1
60 
61 namespace omip
62 {
63 
72 class MultiRBTracker : public RecursiveEstimatorFilterInterface<rbt_state_t, rbt_measurement_t>
73 {
74 public:
75 
91  MultiRBTracker(int max_num_rb,
92  double loop_period_ns,
93  int ransac_iterations,
94  double estimation_error_threshold,
95  double static_motion_threshold,
96  double new_rbm_error_threshold,
97  double max_error_to_reassign_feats,
98  int supporting_features_threshold,
99  int min_num_feats_for_new_rb,
100  int min_num_frames_for_new_rb,
101  int initial_cam_motion_constraint,
102  static_environment_tracker_t static_environment_tracker_type);
103 
104  virtual void Init();
105 
109  virtual ~MultiRBTracker();
110 
116  virtual void setMeasurement(rbt_measurement_t acquired_measurement, const double& measurement_timestamp);
117 
123  virtual void predictState(double time_interval_ns);
124 
129  virtual void predictMeasurement();
130 
131 
138 
148  virtual void correctState();
149 
155  virtual rbt_state_t getState() const;
156 
160  void ReflectState();
161 
167  virtual void setDynamicReconfigureValues(rb_tracker::RBTrackerDynReconfConfig &config);
168 
174  virtual void processMeasurementFromShapeTracker(const omip_msgs::ShapeTrackerStates &meas_from_st);
175 
176 
181  std::vector<Eigen::Matrix4d> getPoses() const;
182 
187  std::vector<geometry_msgs::PoseWithCovariancePtr> getPosesWithCovariance() const;
188 
193  std::vector<geometry_msgs::TwistWithCovariancePtr> getPosesECWithCovariance() const;
194 
199  std::vector<geometry_msgs::TwistWithCovariancePtr> getVelocitiesWithCovariance() const;
200 
207 
213  RB_id_t getRBId(int n) const;
214 
220  int getNumberSupportingFeatures(int n) const;
221 
228 
230 
232 
234 
235 
242  std::vector<Eigen::Vector3d> getCentroids() const;
243 
252 
258  virtual void addPredictedState(const rbt_state_t& predicted_state, const double& predicted_state_timestamp_ns);
259 
265  FeatureCloudPCL::Ptr CollectLocationPredictions();
266 
272  std::vector<Feature::Id> estimateBestPredictionsAndSupportingFeatures();
273 
280  std::vector<Feature::Id> EstimateFreeFeatures(const std::vector<Feature::Id>& supporting_features);
281 
288  std::vector<Feature::Id> ReassignFreeFeatures(const std::vector<Feature::Id>& free_feat_ids);
289 
306  void TryToCreateNewFilter(const std::vector<Feature::Id>& really_free_feat_ids);
307 
314  void CreateNewFilter(const std::vector<Eigen::Matrix4d> &initial_trajectory,
315  const Eigen::Twistd& initial_velocity,
316  const std::vector<Feature::Id> &initial_supporting_feats);
317 
318 
319  virtual void setPriorCovariancePose(double v)
320  {
321  this->_prior_cov_pose = v;
322  }
323 
324  virtual void setPriorCovarianceVelocity(double v)
325  {
326  this->_prior_cov_vel = v;
327  }
328 
329  virtual void setMinCovarianceMeasurementX(double v)
330  {
331  this->_min_cov_meas_x = v;
332  }
333 
334  virtual void setMinCovarianceMeasurementY(double v)
335  {
336  this->_min_cov_meas_y = v;
337  }
338 
339  virtual void setMinCovarianceMeasurementZ(double v)
340  {
341  this->_min_cov_meas_z = v;
342  }
343 
344  virtual void setMeasurementDepthFactor(double v)
345  {
346  this->_meas_depth_factor = v;
347  }
348 
349  virtual void setCovarianceSystemAccelerationTx(double v)
350  {
351  this->_cov_sys_acc_tx = v;
352  }
353 
354  virtual void setCovarianceSystemAccelerationTy(double v)
355  {
356  this->_cov_sys_acc_ty = v;
357  }
358 
359  virtual void setCovarianceSystemAccelerationTz(double v)
360  {
361  this->_cov_sys_acc_tz = v;
362  }
363 
364  virtual void setCovarianceSystemAccelerationRx(double v)
365  {
366  this->_cov_sys_acc_rx = v;
367  }
368 
369  virtual void setCovarianceSystemAccelerationRy(double v)
370  {
371  this->_cov_sys_acc_ry = v;
372  }
373 
374  virtual void setCovarianceSystemAccelerationRz(double v)
375  {
376  this->_cov_sys_acc_rz = v;
377  }
378 
379  virtual void setNumberOfTrackedFeatures(int v)
380  {
381  this->_num_tracked_feats = v;
382  }
383 
384  virtual void setMinNumPointsInSegment(int v)
385  {
386  this->_min_num_points_in_segment = v;
387  }
388 
389  virtual void setMinProbabilisticValue(double v)
390  {
391  this->_min_probabilistic_value = v;
392  }
393 
394  virtual void setMaxFitnessScore(double v)
395  {
396  this->_max_fitness_score = v;
397  }
398 
399  virtual void setMinAmountTranslationForNewRB(double v)
400  {
402  }
403 
404  virtual void setMinAmountRotationForNewRB(double v)
405  {
407  }
408 
410  {
412  }
413 
414 protected:
415 
429 
433 
436 
437 
438  std::vector<RBFilter::Ptr> _kalman_filters;
439 
441 
442  // Maximum number of iterations of RANSAC to find a good hypothesis for the free features
444 
445  // Maximum error allowed between predicted and measured feature position to consider it to STILL
446  // support a RBM
448 
449  // Minimum motion to consider that a feature moves
451 
452  // Maximum error allowed for the inliers of a new RBM hypothesis in RANSAC
454 
455  // Maximum error allowed between the predicted and the measured position of a feature to assign it to a RBM
457 
458  // Minimum number of features that have to support a RBM to not be deleted
460 
461  // Minimum number of free features to trigger the generation of a new RBM
463 
464  // Minimum number of frames that a features has to be present to be used to create new RBM
466 
468 
470 
472 
474 
477 
478  std::vector<Feature::Id> _free_feat_ids, _really_free_feat_ids;
479 
480  std::ofstream _really_free_feats_file;
481 
483  boost::mutex::scoped_lock _measurement_timestamp_ns_lock;
484 
485 };
486 }
487 
488 #endif /* MULTI_RB_TRACKER_H_ */
virtual void setCovarianceSystemAccelerationRy(double v)
StaticEnvironmentFilter::Ptr _static_environment_filter
boost::tuple< double, double, double > Location
virtual void correctState()
Third and final step when updating the filter. The predicted next state is corrected based on the dif...
int getNumberSupportingFeatures(int n) const
std::vector< Feature::Id > estimateBestPredictionsAndSupportingFeatures()
void ReflectState()
Prepare the corrected state to be published.
virtual void setMinAmountTranslationForNewRB(double v)
virtual void predictMeasurement()
Second step when updating the filter. The next measurement is predicted from the predicted next state...
boost::mutex::scoped_lock _measurement_timestamp_ns_lock
virtual void setMeasurementDepthFactor(double v)
virtual void setMinCovarianceMeasurementY(double v)
virtual void setNumberOfTrackedFeatures(int v)
virtual void setMaxFitnessScore(double v)
virtual void setMeasurement(rbt_measurement_t acquired_measurement, const double &measurement_timestamp)
Set the latest acquired measurement.
omip_msgs::RigidBodyPosesAndVelsMsg rbt_state_t
long int RB_id_t
rbt_state_t _last_predicted_state_kh
double _max_error_to_reassign_feats
std::vector< Eigen::Vector3d > getCentroids() const
virtual rbt_state_t getState() const
Get the currently belief state.
virtual void setDynamicReconfigureValues(rb_tracker::RBTrackerDynReconfConfig &config)
Dynamic configuration.
boost::mutex _measurement_timestamp_ns_mutex
virtual void setCovarianceSystemAccelerationRz(double v)
virtual void setMinProbabilisticValue(double v)
void addFeatureLocation(Feature::Id f_id, Feature::Location f_loc)
virtual void setPriorCovariancePose(double v)
std::vector< RBFilter::Ptr > _kalman_filters
FeatureCloudPCL getFreeFeatures()
std::ofstream _really_free_feats_file
virtual void processMeasurementFromShapeTracker(const omip_msgs::ShapeTrackerStates &meas_from_st)
Process the measurement coming from the ShapeTrackerNode that is a refinement/substitute of the featu...
double _estimation_error_threshold
void CreateNewFilter(const std::vector< Eigen::Matrix4d > &initial_trajectory, const Eigen::Twistd &initial_velocity, const std::vector< Feature::Id > &initial_supporting_feats)
FeatureCloudPCL getLabelledSupportingFeatures()
virtual rbt_measurement_t getPredictedMeasurement() const
Get the predicted next measurement.
double _min_amount_rotation_for_new_rb
int _min_num_supporting_feats_to_correct
FeatureCloudPCL getAtBirthFeatures()
virtual void setCovarianceSystemAccelerationTy(double v)
virtual void predictState(double time_interval_ns)
First step when updating the filter. The next state is predicted from current state and system model ...
virtual void setMinCovarianceMeasurementZ(double v)
FeaturesDataBase::Ptr _features_db
std::vector< geometry_msgs::TwistWithCovariancePtr > getPosesECWithCovariance() const
pcl::PointCloud< FeaturePCL > FeatureCloudPCL
virtual void setCovarianceSystemAccelerationTx(double v)
std::vector< Feature::Id > ReassignFreeFeatures(const std::vector< Feature::Id > &free_feat_ids)
std::vector< geometry_msgs::TwistWithCovariancePtr > getVelocitiesWithCovariance() const
RB_id_t getRBId(int n) const
virtual void setMinCovarianceMeasurementX(double v)
std::vector< Feature::Id > EstimateFreeFeatures(const std::vector< Feature::Id > &supporting_features)
virtual void setCovarianceSystemAccelerationTz(double v)
FeatureCloudPCL getPredictedFeatures()
static_environment_tracker_t
virtual void setMinNumberOfSupportingFeaturesToCorrectPredictedState(int v)
FeatureCloudPCLwc::Ptr rbt_measurement_t
std::vector< Feature::Id > _free_feat_ids
MultiRBTracker(int max_num_rb, double loop_period_ns, int ransac_iterations, double estimation_error_threshold, double static_motion_threshold, double new_rbm_error_threshold, double max_error_to_reassign_feats, int supporting_features_threshold, int min_num_feats_for_new_rb, int min_num_frames_for_new_rb, int initial_cam_motion_constraint, static_environment_tracker_t static_environment_tracker_type)
virtual void addPredictedState(const rbt_state_t &predicted_state, const double &predicted_state_timestamp_ns)
void TryToCreateNewFilter(const std::vector< Feature::Id > &really_free_feat_ids)
virtual void setPriorCovarianceVelocity(double v)
std::vector< Feature::Id > _really_free_feat_ids
virtual void setCovarianceSystemAccelerationRx(double v)
std::vector< Eigen::Matrix4d > getPoses() const
double _min_amount_translation_for_new_rb
FeaturesDataBase::Ptr getFeaturesDatabase()
virtual void setMinAmountRotationForNewRB(double v)
virtual void setMinNumPointsInSegment(int v)
std::vector< geometry_msgs::PoseWithCovariancePtr > getPosesWithCovariance() const
FeatureCloudPCL::Ptr CollectLocationPredictions()


rb_tracker
Author(s): Roberto Martín-Martín
autogenerated on Mon Jun 10 2019 14:06:11