joint.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2011, Willow Garage, Inc.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of Willow Garage, Inc. nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  */
00034 
00037 #ifndef FCL_ARTICULATED_MODEL_JOINT_H
00038 #define FCL_ARTICULATED_MODEL_JOINT_H
00039 
00040 #include "fcl/math/transform.h"
00041 #include "fcl/data_types.h"
00042 
00043 #include <string>
00044 #include <vector>
00045 #include <map>
00046 #include <limits>
00047 #include <boost/shared_ptr.hpp>
00048 #include <boost/weak_ptr.hpp>
00049 
00050 namespace fcl
00051 {
00052 
00053 class JointConfig;
00054 class Link;
00055 
00056 enum JointType {JT_UNKNOWN, JT_PRISMATIC, JT_REVOLUTE, JT_BALLEULER};
00057 
00059 class Joint
00060 {
00061 public:
00062 
00063   Joint(const boost::shared_ptr<Link>& link_parent, const boost::shared_ptr<Link>& link_child,
00064         const Transform3f& transform_to_parent,
00065         const std::string& name);
00066 
00067   Joint(const std::string& name);
00068 
00069   virtual ~Joint() {}
00070 
00071   const std::string& getName() const;
00072   void setName(const std::string& name);
00073 
00074   virtual Transform3f getLocalTransform() const = 0;
00075 
00076   virtual std::size_t getNumDofs() const = 0;
00077 
00078   boost::shared_ptr<JointConfig> getJointConfig() const;
00079   void setJointConfig(const boost::shared_ptr<JointConfig>& joint_cfg);
00080 
00081   boost::shared_ptr<Link> getParentLink() const;
00082   boost::shared_ptr<Link> getChildLink() const;
00083 
00084   void setParentLink(const boost::shared_ptr<Link>& link);
00085   void setChildLink(const boost::shared_ptr<Link>& link);
00086 
00087   JointType getJointType() const;
00088 
00089   const Transform3f& getTransformToParent() const;
00090   void setTransformToParent(const Transform3f& t);
00091   
00092 protected:
00093 
00095   boost::weak_ptr<Link> link_parent_, link_child_;
00096 
00097   JointType type_;
00098 
00099   std::string name_;
00100   
00101   boost::shared_ptr<JointConfig> joint_cfg_;
00102 
00103   Transform3f transform_to_parent_;
00104 };
00105 
00106 
00107 class PrismaticJoint : public Joint
00108 {
00109 public:
00110   PrismaticJoint(const boost::shared_ptr<Link>& link_parent, const boost::shared_ptr<Link>& link_child,
00111                  const Transform3f& transform_to_parent,
00112                  const std::string& name,
00113                  const Vec3f& axis);
00114 
00115   virtual ~PrismaticJoint() {}
00116 
00117   Transform3f getLocalTransform() const;
00118 
00119   std::size_t getNumDofs() const;
00120 
00121   const Vec3f& getAxis() const;
00122 
00123 protected:
00124   Vec3f axis_;
00125 };
00126 
00127 class RevoluteJoint : public Joint
00128 {
00129 public:
00130   RevoluteJoint(const boost::shared_ptr<Link>& link_parent, const boost::shared_ptr<Link>& link_child,
00131                 const Transform3f& transform_to_parent,
00132                 const std::string& name,
00133                 const Vec3f& axis);
00134 
00135   virtual ~RevoluteJoint() {}
00136 
00137   Transform3f getLocalTransform() const;
00138 
00139   std::size_t getNumDofs() const;
00140 
00141   const Vec3f& getAxis() const;
00142 
00143 protected:
00144   Vec3f axis_;
00145 };
00146 
00147 
00148 
00149 class BallEulerJoint : public Joint
00150 {
00151 public:
00152   BallEulerJoint(const boost::shared_ptr<Link>& link_parent, const boost::shared_ptr<Link>& link_child,
00153                  const Transform3f& transform_to_parent,
00154                  const std::string& name);
00155 
00156   virtual ~BallEulerJoint() {}
00157 
00158   std::size_t getNumDofs() const;
00159 
00160   Transform3f getLocalTransform() const; 
00161 };
00162 
00163 
00164 }
00165 
00166 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


fcl
Author(s): Jia Pan
autogenerated on Tue Jan 15 2013 16:05:30