interactive_point_cloud.h
Go to the documentation of this file.
00001 #ifndef INTERACTIVE_POINT_CLOUD
00002 #define INTERACTIVE_POINT_CLOUD
00003 
00004 #include <ros/ros.h>
00005 
00006 #include <interactive_markers/interactive_marker_server.h>
00007 #include <interactive_markers/menu_handler.h>
00008 #include <sensor_msgs/PointCloud2.h>
00009 #include <jsk_recognition_msgs/BoundingBoxArray.h>
00010 #include <jsk_recognition_msgs/BoundingBoxMovement.h>
00011 #include <jsk_recognition_msgs/Int32Stamped.h>
00012 #include <geometry_msgs/PoseArray.h>
00013 
00014 #include <actionlib/client/simple_action_client.h>
00015 //#include <point_cloud_server/StoreCloudAction.h>
00016 #include <pcl/search/kdtree.h>
00017 #include <tf/tf.h>
00018 #include <tf/transform_listener.h>
00019 
00020 //#include <object_manipulator/tools/mechanism_interface.h>
00021 #include "jsk_interactive_marker/InteractivePointCloudConfig.h"
00022 #include <jsk_interactive_marker/parent_and_child_interactive_marker_server.h>
00023 #include <dynamic_reconfigure/server.h>
00024 
00025 #include <message_filters/subscriber.h>
00026 #include <message_filters/time_synchronizer.h>
00027 #include <message_filters/synchronizer.h>
00028 #include <message_filters/sync_policies/approximate_time.h>
00029 
00030 typedef pcl::PointXYZRGB PointT;
00031 
00032 
00033 class InteractivePointCloud
00034 {
00035 public:
00036 
00037   InteractivePointCloud(
00038                 std::string marker_name,
00039                 std::string topic_name, std::string server_name);
00040 
00041   ~InteractivePointCloud();
00042 
00044   void hide(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback);
00045   void handlePoseCallback(const geometry_msgs::PoseStampedConstPtr &ps);
00046   void pointCloudAndBoundingBoxCallback(const sensor_msgs::PointCloud2ConstPtr &cloud, const jsk_recognition_msgs::BoundingBoxArrayConstPtr &box, const geometry_msgs::PoseStampedConstPtr &handle);
00047   void pointCloudCallback(const sensor_msgs::PointCloud2ConstPtr &cloud);
00048   //  void handlePoseAndBoundingBoxCallback(const geometry_msgs::PoseStampedConstPtr &ps, const jsk_recognition_msgs::BoundingBoxArrayConstPtr &box);
00049   void setHandlePoseCallback(const geometry_msgs::PoseStampedConstPtr &ps);
00050   void handlePoseAndBoundingBoxCallback(const jsk_recognition_msgs::Int32StampedConstPtr &index, const geometry_msgs::PoseArrayConstPtr &pa, const jsk_recognition_msgs::BoundingBoxArrayConstPtr &box);
00051 private:
00052 
00053   typedef jsk_interactive_marker::InteractivePointCloudConfig Config;
00054   std::shared_ptr <dynamic_reconfigure::Server<Config> > srv_;
00055   boost::mutex mutex_;
00056   virtual void configCallback (Config &config, uint32_t level);
00057 
00058   typedef interactive_markers::MenuHandler MenuHandler;
00059   typedef message_filters::sync_policies::ExactTime<sensor_msgs::PointCloud2, jsk_recognition_msgs::BoundingBoxArray, geometry_msgs::PoseStamped> SyncPolicy;
00060   //typedef message_filters::sync_policies::ExactTime<geometry_msgs::PoseStamped, jsk_recognition_msgs::BoundingBoxArray> SyncHandlePose;
00061 
00062   typedef message_filters::sync_policies::ExactTime<jsk_recognition_msgs::Int32Stamped, geometry_msgs::PoseArray, jsk_recognition_msgs::BoundingBoxArray> SyncHandlePose;
00063   
00064 
00065   void makeMenu();
00066 
00067   void pickup( const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback );
00068 
00069   void makeMarker(const sensor_msgs::PointCloud2ConstPtr cloud, float size);
00070   void makeMarker(const sensor_msgs::PointCloud2ConstPtr cloud, const jsk_recognition_msgs::BoundingBoxArrayConstPtr box, const geometry_msgs::PoseStampedConstPtr handle, float size);
00071 
00072   void menuPoint( const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback );
00073   void move( const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback );
00074 
00075   void leftClickPoint( const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback );
00076 
00077   void markerFeedback( const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback);
00078 
00079   void publishGraspPose();
00080   void publishHandPose( geometry_msgs::PoseStamped box_pose);
00081   
00082   void setMarkerPoseCallback( const geometry_msgs::PoseStampedConstPtr &pose_stamped_msg);
00083 
00084   std::string marker_name_, topic_;
00085   ros::NodeHandle nh_;
00086   ros::NodeHandle pnh_;
00087   ros::Publisher pub_marker_pose_, pub_click_point_, pub_left_click_, pub_left_click_relative_, pub_handle_pose_, pub_handle_pose_array_, pub_box_movement_, pub_grasp_pose_;
00088   ros::Subscriber sub_handle_pose_;
00089   ros::Subscriber sub_marker_pose_;
00090   //ros::Subscriber sub_point_cloud_, sub_bounding_box_;
00091   message_filters::Subscriber<sensor_msgs::PointCloud2> sub_point_cloud_;
00092   message_filters::Subscriber<jsk_recognition_msgs::BoundingBoxArray> sub_bounding_box_;
00093   message_filters::Subscriber<geometry_msgs::PoseStamped> sub_initial_handle_pose_;
00094   //message_filters::Subscriber<geometry_msgs::PoseStamped> sub_handle_pose_;
00095   message_filters::Subscriber<jsk_recognition_msgs::Int32Stamped> sub_selected_index_;
00096   message_filters::Subscriber<geometry_msgs::PoseArray> sub_handle_array_;
00097   tf::TransformListener tfl_;
00098   std::shared_ptr<message_filters::Synchronizer<SyncPolicy> >sync_;
00099   std::shared_ptr<message_filters::Synchronizer<SyncHandlePose> > sync_handle_;
00100   
00101   jsk_interactive_marker::ParentAndChildInteractiveMarkerServer marker_server_;
00102   interactive_markers::MenuHandler menu_handler_;
00103 
00104   sensor_msgs::PointCloud2 msg_cloud_;
00105   double point_size_;
00106   bool use_bounding_box_;
00107 
00108   geometry_msgs::PoseStamped marker_pose_;
00109   std::string input_pointcloud_, input_bounding_box_, initial_handle_pose_;
00110 
00111   sensor_msgs::PointCloud2 current_croud_;
00112   jsk_recognition_msgs::BoundingBoxArray current_box_;
00113   geometry_msgs::PoseStamped handle_pose_;
00114   tf::Transform handle_tf_;
00115   bool exist_handle_tf_;
00116   bool display_interactive_manipulator_;
00117 
00118   jsk_recognition_msgs::BoundingBoxMovement box_movement_;
00119 };
00120 
00121 #endif


jsk_interactive_marker
Author(s): furuta
autogenerated on Wed May 1 2019 02:40:31