00001 /* 00002 * RecursiveEstimatorFilterInterface.h 00003 * 00004 * Author: roberto 00005 * 00006 * This is a modified implementation of the method for online estimation of kinematic structures described in our paper 00007 * "Online Interactive Perception of Articulated Objects with Multi-Level Recursive Estimation Based on Task-Specific Priors" 00008 * (Martín-Martín and Brock, 2014). 00009 * This implementation can be used to reproduce the results of the paper and to be applied to new research. 00010 * The implementation allows also to be extended to perceive different information/models or to use additional sources of information. 00011 * A detail explanation of the method and the system can be found in our paper. 00012 * 00013 * If you are using this implementation in your research, please consider citing our work: 00014 * 00015 @inproceedings{martinmartin_ip_iros_2014, 00016 Title = {Online Interactive Perception of Articulated Objects with Multi-Level Recursive Estimation Based on Task-Specific Priors}, 00017 Author = {Roberto {Mart\'in-Mart\'in} and Oliver Brock}, 00018 Booktitle = {Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems}, 00019 Pages = {2494-2501}, 00020 Year = {2014}, 00021 Location = {Chicago, Illinois, USA}, 00022 Note = {http://www.robotics.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martinmartin_ip_iros_2014.pdf}, 00023 Url = {http://www.robotics.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martinmartin_ip_iros_2014.pdf}, 00024 Projectname = {Interactive Perception} 00025 } 00026 * If you have questions or suggestions, contact us: 00027 * roberto.martinmartin@tu-berlin.de 00028 * 00029 * Enjoy! 00030 */ 00031 00032 #ifndef RECURSIVE_ESTIMATOR_INTERFACE_H_ 00033 #define RECURSIVE_ESTIMATOR_INTERFACE_H_ 00034 00035 #include <vector> 00036 #include <string> 00037 #include <iostream> 00038 00039 namespace omip 00040 { 00041 00049 template <class StateType, class MeasurementType> 00050 class RecursiveEstimatorFilterInterface 00051 { 00052 public: 00053 00058 RecursiveEstimatorFilterInterface(double loop_period_ns) : 00059 _loop_period_ns(loop_period_ns), 00060 _state(), 00061 _most_likely_predicted_state(), 00062 _measurement(), 00063 _predicted_measurement(), 00064 _measurement_timestamp_ns(0.0), 00065 _previous_measurement_timestamp_ns(0.0) 00066 { 00067 00068 } 00069 00074 virtual ~RecursiveEstimatorFilterInterface() 00075 { 00076 00077 } 00078 00083 virtual void predictState(double time_interval_ns) = 0; 00084 00089 virtual void predictMeasurement() = 0; 00090 00096 virtual void correctState() = 0; 00097 00103 virtual void setMeasurement(const MeasurementType& acquired_measurement, const double& measurement_timestamp) 00104 { 00105 this->_measurement = acquired_measurement; 00106 this->_previous_measurement_timestamp_ns = this->_measurement_timestamp_ns; 00107 this->_measurement_timestamp_ns = measurement_timestamp; 00108 } 00109 00116 virtual void addPredictedState(const StateType& predicted_state, const double& predicted_state_timestamp_ns) = 0; 00117 00123 virtual MeasurementType getPredictedMeasurement() const 00124 { 00125 return this->_predicted_measurement; 00126 } 00127 00133 virtual StateType getState() const 00134 { 00135 return this->_state; 00136 } 00137 00138 protected: 00139 00140 StateType _state; 00141 MeasurementType _measurement; 00142 00143 // Period of the recursive loop. It is also the period of the measurements. This time is used to predict the next state (and then the next measurement) 00144 // at the end of one processing loop, so that the prediction can: 00145 // 1> be passed to the lower level as alternative predicted next state 00146 // 2> as predicted measurement for this level, which we compare to the acquired measurement to correct the state 00147 // If we lose some ticks (computing time is longer than the loop period) we will have to predict again using the real interval between measurements 00148 double _loop_period_ns; 00149 00150 // Timestamp of the last measurement in nano seconds 00151 double _measurement_timestamp_ns; 00152 00153 // Timestamp of the previous acquired (and processed) measurement in nano seconds 00154 // We use the difference between timestamps of last and previous measurements to compute the "real" loop period in the last iteration and decide if it is 00155 // close enough to our expected loop period (valid predictions) or if we have lost some ticks (recompute predictions) 00156 double _previous_measurement_timestamp_ns; 00157 00158 std::string _filter_name; 00159 00160 //We use a vector because we can have more than one predicted state. Usually we will have two: the predicted state using the internal model 00161 //and the predicted state coming from the higher level (is the predicted next measurement of the next level) 00162 //The normal procedure is to test both and use the most likely one 00163 std::vector<StateType> _predicted_states; 00164 00165 //We find the most likely predicted state and store it here 00166 StateType _most_likely_predicted_state; 00167 00168 MeasurementType _predicted_measurement; 00169 00170 }; 00171 } 00172 00173 #endif /* RECURSIVE_ESTIMATOR_INTERFACE_H_ */