00001 /* 00002 * MultiRBTrackerNode.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 MULTI_RB_TRACKER_NODE_H 00033 #define MULTI_RB_TRACKER_NODE_H 00034 00035 #include <ros/ros.h> 00036 #include <tf/transform_broadcaster.h> 00037 00038 // Dynamic reconfigure includes. 00039 #include <dynamic_reconfigure/server.h> 00040 #include <rb_tracker/RBTrackerDynReconfConfig.h> 00041 00042 #include <sensor_msgs/PointCloud2.h> 00043 #include <geometry_msgs/Pose.h> 00044 00045 #include <visualization_msgs/MarkerArray.h> 00046 00047 #include <message_filters/subscriber.h> 00048 #include <message_filters/time_synchronizer.h> 00049 00050 #include <pcl_ros/publisher.h> 00051 #include <pcl/io/io.h> 00052 #include <pcl/point_types.h> 00053 00054 #include <Eigen/StdVector> 00055 #include <Eigen/Geometry> 00056 00057 #include "rb_tracker/RBFilter.h" 00058 #include "rb_tracker/MultiRBTracker.h" 00059 00060 #include "omip_msgs/RigidBodyPosesMsg.h" 00061 #include "omip_msgs/RigidBodyPoseMsg.h" 00062 00063 #include "omip_msgs/RigidBodyPosesAndVelsMsg.h" 00064 #include "omip_msgs/RigidBodyPoseAndVelMsg.h" 00065 00066 #include "omip_msgs/RigidBodyTwistsWithCovMsg.h" 00067 #include "omip_msgs/RigidBodyTwistWithCovMsg.h" 00068 00069 #include "omip_common/RecursiveEstimatorNodeInterface.h" 00070 #include "omip_common/OMIPTypeDefs.h" 00071 00072 #include <std_msgs/Float64.h> 00073 00074 #include "omip_msgs/ShapeTrackerStates.h" 00075 00076 namespace omip{ 00077 00078 class MultiRBTrackerNode : public RecursiveEstimatorNodeInterface<rbt_measurement_ros_t, rbt_state_ros_t, MultiRBTracker> 00079 { 00080 00081 public: 00082 00086 MultiRBTrackerNode(); 00087 00091 virtual ~MultiRBTrackerNode(); 00092 00098 virtual void measurementCallback(const boost::shared_ptr<rbt_measurement_ros_t const> &features_pc); 00099 00100 void MeasurementFromShapeTrackerCallback(const boost::shared_ptr<omip_msgs::ShapeTrackerStates const> &shape_tracker_states); 00101 00102 void MatthiasRefinementsCallback(const boost::shared_ptr<rbt_state_t const> &matthias_refinements); 00103 00104 void RGBDPCCallback(const sensor_msgs::PointCloud2ConstPtr &full_pc_msg); 00105 00111 virtual void statePredictionCallback(const boost::shared_ptr<rbt_state_t const> &predicted_next_state); 00112 00119 void DynamicReconfigureCallback(rb_tracker::RBTrackerDynReconfConfig &config, uint32_t level); 00120 00124 void ReadParameters(); 00125 00126 protected: 00127 00132 virtual void _publishState() const; 00133 00138 virtual void _publishPredictedMeasurement() const; 00139 00144 virtual void _PrintResults() const; 00145 00151 virtual void _PublishClusteredFeatures(); 00152 00156 virtual void _PublishPosesWithCovariance(); 00157 00162 virtual void _PublishTF(); 00163 00164 std::map<RB_id_t, ros::Publisher*> _est_body_publishers; 00165 ros::Publisher _rbposes_publisher; 00166 ros::Publisher _clustered_pc_publisher; 00167 00168 ros::Publisher _freefeats_pc_publisher; 00169 ros::Publisher _predictedfeats_pc_publisher; 00170 ros::Publisher _atbirthfeats_pc_publisher; 00171 00172 ros::Subscriber _meas_from_st_subscriber; 00173 ros::Subscriber _matthias_refinements_subscriber; 00174 00175 // Maximum number of iterations of RANSAC to find a good hypothesis for the free features 00176 int _ransac_iterations; 00177 00178 // Maximum error allowed between predicted and measured feature position to consider it to STILL 00179 // support a RBM 00180 double _estimation_error_threshold; 00181 00182 // Minimum motion to consider that a feature moves 00183 double _static_motion_threshold; 00184 00185 // Maximum error allowed for the inliers of a new RBM hypothesis in RANSAC 00186 double _new_rbm_error_threshold; 00187 00188 // Maximum error allowed between the predicted and the measured position of a feature to assign it to a RBM 00189 double _max_error_to_reassign_feats; 00190 00191 double _sensor_fps; 00192 int _processing_factor; 00193 double _loop_period_ns; 00194 00195 // Minimum number of features that have to support a RBM to not be deleted 00196 int _supporting_features_threshold; 00197 00198 // Total number of tracked features 00199 int _num_tracked_feats; 00200 00201 // Minimum number of free features to trigger the generation of a new RBM 00202 int _min_num_feats_for_new_rb; 00203 00204 // Minimum number of frames that a features has to be present to be used to create new RBM 00205 int _min_num_frames_for_new_rb; 00206 00207 // Flags 00208 bool _publishing_rbposes_with_cov; 00209 bool _publishing_tf; 00210 bool _publishing_clustered_pc; 00211 bool _printing_rb_poses; 00212 00213 static_environment_tracker_t _static_environment_tracker_type; 00214 00215 mutable bool _shape_tracker_received; 00216 omip_msgs::ShapeTrackerStates _shape_tracker_meas; 00217 00218 // Set up a dynamic reconfigure server. 00219 // This should be done before reading parameter server values. 00220 dynamic_reconfigure::Server<rb_tracker::RBTrackerDynReconfConfig> _dr_srv; 00221 dynamic_reconfigure::Server<rb_tracker::RBTrackerDynReconfConfig>::CallbackType _dr_callback; 00222 00223 ros::Publisher _state_publisher2; 00224 Eigen::Twistd _previous_twist; 00225 rbt_state_t _last_predictions_kh; 00226 00227 }; 00228 00229 } 00230 00231 #endif /* MULTI_RB_TRACKER_NODE_H */