snapit.h
Go to the documentation of this file.
1 // -*- mode: C++ -*-
2 /*********************************************************************
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2013, JSK Lab
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/o2r other materials provided
17  * with the distribution.
18  * * Neither the name of the JSK Lab nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 
36 #ifndef JSK_PCL_ROS_SNAPIT_H_
37 #define JSK_PCL_ROS_SNAPIT_H_
38 
39 #include <ros/ros.h>
40 
41 #include <pcl/point_types.h>
42 #include <pcl_ros/pcl_nodelet.h>
43 #include <jsk_recognition_msgs/PolygonArray.h>
44 #include <geometry_msgs/PolygonStamped.h>
45 #include <geometry_msgs/PoseArray.h>
46 #include <jsk_recognition_msgs/ModelCoefficientsArray.h>
47 #include "jsk_recognition_msgs/CallSnapIt.h"
48 #include <tf/transform_listener.h>
54 #include <jsk_recognition_msgs/SnapFootstep.h>
56 namespace jsk_pcl_ros
57 {
59  {
60  public:
62  jsk_recognition_msgs::PolygonArray,
63  jsk_recognition_msgs::ModelCoefficientsArray> SyncPolygonPolicy;
64  SnapIt(): DiagnosticNodelet("SnapIt") {}
65 
66  protected:
68  // methods
70  virtual void onInit();
71  virtual void subscribe();
72  virtual void unsubscribe();
73  virtual void polygonCallback(
74  const jsk_recognition_msgs::PolygonArray::ConstPtr& polygon_msg,
75  const jsk_recognition_msgs::ModelCoefficientsArray::ConstPtr& coefficients_msg);
76  virtual void polygonAlignCallback(
77  const geometry_msgs::PoseStamped::ConstPtr& pose_msg);
78  virtual void convexAlignCallback(
79  const geometry_msgs::PoseStamped::ConstPtr& pose_msg);
80  virtual void convexAlignPolygonCallback(
81  const geometry_msgs::PolygonStamped::ConstPtr& poly_msg);
82  virtual std::vector<jsk_recognition_utils::ConvexPolygon::Ptr> createConvexes(
83  const std::string& frame_id, const ros::Time& stamp,
84  jsk_recognition_msgs::PolygonArray::ConstPtr polygons);
85  virtual int findNearestConvex(
86  const Eigen::Vector3f& pose_point,
87  const std::vector<jsk_recognition_utils::ConvexPolygon::Ptr>& convexes);
88  virtual geometry_msgs::PoseStamped alignPose(
89  Eigen::Affine3f& pose, jsk_recognition_utils::ConvexPolygon::Ptr convex);
90  virtual bool footstepAlignServiceCallback(
91  jsk_recognition_msgs::SnapFootstep::Request& req,
92  jsk_recognition_msgs::SnapFootstep::Response& res);
94  // ROS variables
109  jsk_recognition_msgs::PolygonArray::ConstPtr polygons_;
112  // parameters
114 
115  };
116 }
117 
118 #endif
message_filters::sync_policies::ExactTime< jsk_recognition_msgs::PolygonArray, jsk_recognition_msgs::ModelCoefficientsArray > SyncPolygonPolicy
Definition: snapit.h:63
ros::ServiceServer align_footstep_srv_
Definition: snapit.h:108
message_filters::Subscriber< jsk_recognition_msgs::PolygonArray > sub_polygons_
Definition: snapit.h:97
virtual void unsubscribe()
virtual void subscribe()
virtual geometry_msgs::PoseStamped alignPose(Eigen::Affine3f &pose, jsk_recognition_utils::ConvexPolygon::Ptr convex)
virtual void polygonCallback(const jsk_recognition_msgs::PolygonArray::ConstPtr &polygon_msg, const jsk_recognition_msgs::ModelCoefficientsArray::ConstPtr &coefficients_msg)
pose
tf::TransformListener * tf_listener_
Definition: snapit.h:96
DiagnosticNodelet(const std::string &name)
virtual void onInit()
virtual void convexAlignPolygonCallback(const geometry_msgs::PolygonStamped::ConstPtr &poly_msg)
jsk_recognition_msgs::PolygonArray::ConstPtr polygons_
Definition: snapit.h:109
ros::Publisher convex_aligned_pose_array_pub_
Definition: snapit.h:102
virtual void polygonAlignCallback(const geometry_msgs::PoseStamped::ConstPtr &pose_msg)
jsk_recognition_msgs::PolygonArray::ConstPtr polygon_msg
virtual bool footstepAlignServiceCallback(jsk_recognition_msgs::SnapFootstep::Request &req, jsk_recognition_msgs::SnapFootstep::Response &res)
ros::Publisher convex_aligned_pose_array_marker_pub_
Definition: snapit.h:103
ros::Subscriber polygon_align_sub_
Definition: snapit.h:104
virtual int findNearestConvex(const Eigen::Vector3f &pose_point, const std::vector< jsk_recognition_utils::ConvexPolygon::Ptr > &convexes)
boost::mutex mutex
global mutex.
ros::Publisher polygon_aligned_pub_
Definition: snapit.h:100
ros::Subscriber convex_align_sub_
Definition: snapit.h:105
ros::Subscriber convex_align_polygon_sub_
Definition: snapit.h:106
message_filters::Subscriber< jsk_recognition_msgs::ModelCoefficientsArray > sub_coefficients_
Definition: snapit.h:98
boost::mutex mutex_
Definition: snapit.h:110
virtual std::vector< jsk_recognition_utils::ConvexPolygon::Ptr > createConvexes(const std::string &frame_id, const ros::Time &stamp, jsk_recognition_msgs::PolygonArray::ConstPtr polygons)
virtual void convexAlignCallback(const geometry_msgs::PoseStamped::ConstPtr &pose_msg)
ros::Publisher convex_aligned_pub_
Definition: snapit.h:101
polygons
boost::shared_ptr< message_filters::Synchronizer< SyncPolygonPolicy > > sync_polygon_
Definition: snapit.h:99


jsk_pcl_ros
Author(s): Yohei Kakiuchi
autogenerated on Mon May 3 2021 03:03:47