shape_tools.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 *
00003 *  Copyright (c) 2011, Willow Garage, Inc.
00004 *  All rights reserved.
00005 *
00006 *  Redistribution and use in source and binary forms, with or without
00007 *  modification, are permitted provided that the following conditions
00008 *  are met:
00009 *
00010 *   * Redistributions of source code must retain the above copyright
00011 *     notice, this list of conditions and the following disclaimer.
00012 *   * Redistributions in binary form must reproduce the above
00013 *     copyright notice, this list of conditions and the following
00014 *     disclaimer in the documentation and/or other materials provided
00015 *     with the distribution.
00016 *   * Neither the name of the Willow Garage nor the names of its
00017 *     contributors may be used to endorse or promote products derived
00018 *     from this software without specific prior written permission.
00019 *
00020 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00021 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00023 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00024 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00025 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00026 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00027 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00028 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00029 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00030 *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00031 *  POSSIBILITY OF SUCH DAMAGE.
00032 *********************************************************************/
00033 
00034 #ifndef _SHAPE_TOOLS_H_
00035 #define _SHAPE_TOOLS_H_
00036 
00037 #include <ros/ros.h>
00038 #include <tf/tf.h>
00039 
00040 #include "object_manipulator/tools/msg_helpers.h"
00041 
00042 
00043 namespace object_manipulator
00044 {
00045 
00046 namespace shapes
00047 {
00048 
00055   class Box
00056   {
00057     public:
00058       Box(){   }
00059 
00060       Box(const tf::Pose &frame_in, const tf::Vector3 &dims_in) : frame(frame_in), dims(dims_in) {}
00061 
00062       Box(const tf::Vector3 &dims_in) : frame(tf::Pose(tf::Quaternion(0,0,0,1), tf::Vector3(0,0,0))), dims(dims_in) {}
00063 
00064       inline void transform(const tf::Transform &T)   { frame = T * frame;  }
00065 
00066       std_msgs::Header header;
00067       tf::Pose frame;
00068       tf::Vector3 dims;
00069   };
00070 
00077   class Cylinder
00078   {
00079     public:
00080       Cylinder(){   }
00081 
00082       Cylinder(const tf::Pose &frame_in, const tf::Vector3 &dims_in) : frame(frame_in), dims(dims_in) {}
00083 
00084       Cylinder(const tf::Vector3 &dims_in) : frame(tf::Pose(tf::Quaternion(0,0,0,1), tf::Vector3(0,0,0))), dims(dims_in) {}
00085 
00086       inline void transform(const tf::Transform &T)   { frame = T * frame;  }
00087 
00088       std_msgs::Header header;
00089       tf::Pose frame;
00090       tf::Vector3 dims;
00091   };
00092 
00099   class Sphere
00100   {
00101   public:
00102       Sphere(){   }
00103 
00104       Sphere(const tf::Pose &frame_in, const tf::Vector3 &dims_in) : frame(frame_in), dims(dims_in) {}
00105 
00106       Sphere(const tf::Vector3 &dims_in) : frame(tf::Pose(tf::Quaternion(0,0,0,1), tf::Vector3(0,0,0))), dims(dims_in) {}
00107 
00108       inline void transform(const tf::Transform &T)   { frame = T * frame;  }
00109 
00110       std_msgs::Header header;
00111       tf::Pose frame;
00112       tf::Vector3 dims;
00113   };
00114 
00121   class Mesh
00122   {
00123   public:
00124       Mesh(){   }
00125 
00126       Mesh(const char * mesh_source, const tf::Pose &frame_in, const tf::Vector3 &dims_in) : mesh_resource(mesh_source), frame(frame_in), dims(dims_in) {}
00127 
00128       Mesh(const char * mesh_source, const tf::Vector3 &dims_in) : mesh_resource(mesh_source), frame(tf::Pose(tf::Quaternion(0,0,0,1), tf::Vector3(0,0,0))), dims(dims_in) {}
00129 
00130       inline void transform(const tf::Transform &T)   { frame = T * frame;  }
00131 
00132       std_msgs::Header header;
00133       std::string mesh_resource;
00134       bool use_embedded_materials;
00135       tf::Pose frame;
00136       tf::Vector3 dims;
00137 
00138   };
00139 
00140 } // namespace shapes
00141 
00142 
00143 void drawCylinder(ros::Publisher &pub, const shapes::Cylinder &shape, const char *ns = "cylinder",
00144              int id = 0, const ros::Duration lifetime = ros::Duration(),
00145              const std_msgs::ColorRGBA color = msg::createColorMsg(0.5, 0.5, 0.5, 0.5),
00146              bool destroy = false, bool frame_locked = false);
00147 
00148 void drawBox(ros::Publisher &pub, const shapes::Box &shape, const char *ns = "box",
00149              int id = 0, const ros::Duration lifetime = ros::Duration(),
00150              const std_msgs::ColorRGBA color = msg::createColorMsg(0.5, 0.5, 0.5, 0.5),
00151              bool destroy = false, bool frame_locked = false);
00152 
00153 void drawSphere(ros::Publisher &pub, const shapes::Sphere &shape, const char *ns = "sphere",
00154              int id = 0, const ros::Duration lifetime = ros::Duration(),
00155              const std_msgs::ColorRGBA color = msg::createColorMsg(0.5, 0.5, 0.5, 0.5),
00156              bool destroy = false, bool frame_locked = false);
00157 
00158 void drawMesh (ros::Publisher &pub, const shapes::Mesh &shape, const char *ns = "mesh",
00159                int id = 0, const ros::Duration lifetime = ros::Duration(),
00160                const std_msgs::ColorRGBA color = msg::createColorMsg(0.5, 0.5, 0.5, 0.5),
00161                bool destroy = false, bool frame_locked = false);
00162 
00163 } // namespace object_manipulator
00164 
00165 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


katana_object_manipulator
Author(s): Henning Deeken
autogenerated on Thu Jan 3 2013 14:44:43