00001 #ifndef _OBJECT_FILTER_H_ 00002 #define _OBJECT_FILTER_H_ 00003 00004 #include "ros/ros.h" 00005 #include "ros/callback_queue.h" 00006 #include "iri_wam_common_msgs/compute_obj_grasp_pose.h" 00007 00008 #include "tf/tf.h" 00009 #include <tf/transform_broadcaster.h> 00010 00011 // [PCL_ROS] 00012 #include "pcl_ros/point_cloud.h" 00013 #include "pcl/point_types.h" 00014 #include "pcl/ros/register_point_struct.h" 00015 00016 //pcl::toROSMsg 00017 #include <pcl/io/pcd_io.h> 00018 00019 00020 // [publisher subscriber headers] 00021 #include "sensor_msgs/PointCloud2.h" 00022 #include "sensor_msgs/Image.h" 00023 #include "std_msgs/Int32.h" 00024 #include "iri_clothes_grasping_point/GraspingPointList.h" 00025 #include "geometry_msgs/PoseStamped.h" 00026 #include "iri_wrinkled_map/heat_map.h" 00027 #include "normal_descriptor_node/wrinkle.h" 00028 00029 #include "termios.h" 00030 #include "thread.h" 00031 #include "socket.h" 00032 #include "socketclient.h" 00033 #include "mutex.h" 00034 #include "thread.h" 00035 #include "eventexceptions.h" 00036 00037 #define AZONE 1000 00038 #define BZONE 2000 00039 #define ANYZONE 0 00040 #define ALLFILTERS 0 00041 00042 typedef union { 00043 struct /*anonymous*/ 00044 { 00045 unsigned char Blue; 00046 unsigned char Green; 00047 unsigned char Red; 00048 unsigned char Alpha; 00049 }; 00050 float float_value; 00051 long long_value; 00052 } RGBValue; 00053 00054 class ObjectFilter { 00055 public: 00056 ObjectFilter(); 00057 void mainLoop(void); 00058 private: 00059 00060 int ncols; 00061 int nrows; 00062 int focused_obj; 00063 geometry_msgs::PoseStamped graspPose; 00064 sensor_msgs::PointCloud2ConstPtr* msg_; 00065 pcl::PointCloud<pcl::PointXYZRGB> pcl_xyzrgb; 00066 float* xi; // image x coordinates of pcl2 00067 float* yi; // image y coordinates of pcl2 00068 float* zi; // image z coordinates of pcl2 00069 float* ci; // image color coordinates of pcl2 00070 00071 tf::TransformBroadcaster tf_br; 00072 tf::Transform transform_grasping_point; 00073 00074 // ROS Handlers 00075 ros::NodeHandle nh; 00076 00077 // ROS Publishers 00078 ros::Publisher filtered_pcl2_publisher; 00079 00080 // ROS Subscribers 00081 ros::Subscriber pcl2_sub; 00082 ros::Subscriber segmented_img_sub; 00083 ros::Subscriber heat_map_sub; 00084 ros::Subscriber focused_object_sub; 00085 ros::Subscriber grasping_points_list_sub; 00086 00087 // ROS Services 00088 ros::ServiceClient wrinkle_client; 00089 ros::ServiceServer compute_grasp; 00090 normal_descriptor_node::wrinkle wrinkle_srv; 00091 00092 void pcl2_sub_callback(const sensor_msgs::PointCloud2ConstPtr& msg); 00093 void heat_map_sub_callback(const normal_descriptor_node::heat_map& msg); 00094 void focused_obj_sub_callback(const std_msgs::Int32& msg); 00095 void grasping_points_list_sub_callback(const iri_clothes_grasping_point::GraspingPointList& msg); 00096 void segmented_img_sub_callback(const sensor_msgs::ImageConstPtr& msg); 00097 00098 bool compute_grasp_pose_callback(iri_wam_common_msgs::compute_obj_grasp_pose::Request &req, iri_wam_common_msgs::compute_obj_grasp_pose::Response &res); 00099 }; 00100 #endif