ShapeTrackerNode.h
Go to the documentation of this file.
00001 /*
00002  * ShapeTrackerNode.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) and the extension to segment, reconstruct and track shapes introduced in our paper
00009  * "An Integrated Approach to Visual Perception of Articulated Objects" (Martín-Martín, Höfer and Brock, 2016)
00010  * This implementation can be used to reproduce the results of the paper and to be applied to new research.
00011  * The implementation allows also to be extended to perceive different information/models or to use additional sources of information.
00012  * A detail explanation of the method and the system can be found in our paper.
00013  *
00014  * If you are using this implementation in your research, please consider citing our work:
00015  *
00016 @inproceedings{martinmartin_ip_iros_2014,
00017 Title = {Online Interactive Perception of Articulated Objects with Multi-Level Recursive Estimation Based on Task-Specific Priors},
00018 Author = {Roberto {Mart\'in-Mart\'in} and Oliver Brock},
00019 Booktitle = {Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems},
00020 Pages = {2494-2501},
00021 Year = {2014},
00022 Location = {Chicago, Illinois, USA},
00023 Note = {http://www.robotics.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martinmartin_ip_iros_2014.pdf},
00024 Url = {http://www.robotics.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martinmartin_ip_iros_2014.pdf},
00025 Projectname = {Interactive Perception}
00026 }
00027 
00028 @inproceedings{martinmartin_hoefer_iros_2016,
00029 Title = {An Integrated Approach to Visual Perception of Articulated Objects},
00030 Author = {Roberto {Mart\'{i}n-Mart\'{i}n} and Sebastian H\"ofer and Oliver Brock},
00031 Booktitle = {Proceedings of the IEEE International Conference on Robotics and Automation},
00032 Pages = {5091 - 5097},
00033 Year = {2016},
00034 Doi = {10.1109/ICRA.2016.7487714},
00035 Location = {Stockholm, Sweden},
00036 Month = {05},
00037 Note = {http://www.redaktion.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martin_hoefer_15_iros_sr_opt.pdf},
00038 Url = {http://www.redaktion.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martin_hoefer_15_iros_sr_opt.pdf},
00039 Url2 = {http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&arnumber=7487714},
00040 Projectname = {Interactive Perception}
00041 }
00042  * If you have questions or suggestions, contact us:
00043  * roberto.martinmartin@tu-berlin.de
00044  *
00045  * Enjoy!
00046  */
00047 
00048 #ifndef SHAPE_TRACKER_NODE_H_
00049 #define SHAPE_TRACKER_NODE_H_
00050 
00051 #include <ros/ros.h>
00052 #include <ros/callback_queue.h>
00053 #include <ros/subscriber.h>
00054 #include <message_filters/subscriber.h>
00055 #include <message_filters/time_synchronizer.h>
00056 #include <message_filters/sync_policies/approximate_time.h>
00057 #include <sensor_msgs/PointCloud2.h>
00058 
00059 #include <rosbag/bag.h>
00060 #include <tf/tf.h>
00061 
00062 #include <boost/thread.hpp>
00063 
00064 #include <omip_common/OMIPTypeDefs.h>
00065 #include <omip_msgs/ShapeModels.h>
00066 
00067 // Dynamic reconfigure includes.
00068 #include <dynamic_reconfigure/server.h>
00069 
00070 #include <omip_common/OMIPTypeDefs.h>
00071 
00072 //ROS and OpenCV
00073 #include <opencv2/core/core.hpp>
00074 #include <camera_info_manager/camera_info_manager.h>
00075 
00076 #include <omip_common/OMIPUtils.h>
00077 
00078 #include <shape_tracker/ShapeTracker.h>
00079 
00080 #include <std_msgs/Empty.h>
00081 
00082 
00083 namespace omip
00084 {
00085 
00086 class ShapeTrackerNode
00087 {
00088     // Policies to synchorize point clouds, and the RBP from the RBT
00089     typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::PointCloud2, omip::rbt_state_t> STSyncPolicy;
00090 
00091     typedef std::map<omip::RB_id_t, omip::ShapeTrackerPtr > shape_trackers_map_t;
00092 
00093 public:
00094 
00098     ShapeTrackerNode();
00099 
00103     virtual ~ShapeTrackerNode();
00104 
00105     virtual void CameraInfoCallback(const sensor_msgs::CameraInfoConstPtr &ci_msg);
00106 
00107     virtual void ShapeModelsCallback(const omip_msgs::ShapeModelsConstPtr &models_msg);
00108 
00109     virtual void RigibBodyMotionsAndPCCallback(const sensor_msgs::PointCloud2ConstPtr &pc_msg, const boost::shared_ptr<omip::rbt_state_t const> &poses_and_vels);
00110 
00111     virtual void TrackerNodeQuitCallback(const std_msgs::EmptyConstPtr &msg);
00112 
00113     virtual bool getActive() const
00114     {
00115         return this->_active;
00116     }
00117 
00118 protected:
00119 
00120     shape_trackers_map_t                                                        _rb_trackers;
00121     ros::NodeHandle                                                             _node_handle;
00122     ros::Publisher                                                              _st_state_pub;
00123 
00124     message_filters::Subscriber<sensor_msgs::PointCloud2>                       _rgbd_pc_subscriber;
00125     message_filters::Subscriber<omip::rbt_state_t>                              _poses_and_vels_subscriber;
00126     message_filters::Synchronizer<STSyncPolicy>*                                _synchronizer;
00127 
00128     ros::Subscriber                      _shape_models_subscriber;
00129 
00130     ros::Subscriber                                                             _ci_sub;
00131     sensor_msgs::CameraInfo _ci;
00132 
00133     shape_model_selector_t _model_type_to_listen;
00134 
00135     ros::Subscriber _node_quit_subscriber;
00136 
00137     bool _active;
00138 
00139     template<class T>
00140     bool getROSParameter(std::string param_name, T & param_container)
00141     {
00142         if (!(this->_node_handle.getParam(param_name, param_container)))
00143         {
00144             ROS_ERROR_NAMED("ShapeTrackerNode.getROSParameter", "The parameter %s can not be found.", param_name.c_str());
00145             throw(std::string("[ShapeTrackerNode.getROSParameter] The parameter can not be found. Parameter name: ") + param_name);
00146             return false;
00147         }
00148         else
00149             return true;
00150     }
00151 };
00152 }
00153 
00154 #endif /* FEATURE_TRACKER_NODE_H_ */
00155 


shape_tracker
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:54:11