Gazebo

Joint.hh

00001 /*
00002  *  Gazebo - Outdoor Multi-Robot Simulator
00003  *  Copyright (C) 2003  
00004  *     Nate Koenig & Andrew Howard
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 /* Desc: The base joint class
00022  * Author: Nate Keonig, Andrew Howard
00023  * Date: 21 May 2003
00024  * CVS: $Id: Joint.hh 156 2007-11-26 20:26:57Z natepak $
00025  */
00026 
00027 #ifndef JOINT_HH
00028 #define JOINT_HH
00029 
00030 #include <ode/ode.h>
00031 
00032 #include "Vector3.hh"
00033 
00034 
00035 namespace gazebo
00036 {
00040   
00041   class Body;
00042   class XMLConfigNode;
00043 
00045   class Joint
00046   {
00048     public: enum Type {SLIDER, HINGE, HINGE2, BALL, UNIVERSAL};
00049 
00051     public: Joint();
00052 
00054     public: virtual ~Joint();
00055 
00057     public: void Load(XMLConfigNode *node);
00058 
00060     protected: virtual void LoadChild(XMLConfigNode *node) {};
00061 
00063     public: Joint::Type GetType() const;
00064 
00066     public: Body *GetJointBody( int index ) const;
00067 
00069     public: bool AreConnected( Body *one, Body *two ) const;
00070 
00072     public: virtual double GetParam(int parameter) const;
00073 
00076     public: void SetFixed();
00077 
00079     public: void Attach( Body *one, Body *two );
00080 
00082     public: void Detach();
00083 
00085     public: virtual void SetAnchor( const gazebo::Vector3 & /*anchor*/ ) {}
00086 
00088     public: virtual gazebo::Vector3 GetAnchor() const
00089             {return gazebo::Vector3(0,0,0);}
00090 
00091 
00093     public: virtual void SetParam( int parameter, double value );
00094 
00096     public: std::string GetName() const;
00097 
00099     public: void SetName(const std::string &name);
00100 
00102     protected: dJointID jointId;
00103 
00105     protected: Type type;
00106 
00108     private: Body *body1;
00109 
00111     private: Body *body2;
00112 
00114     private: std::string name;
00115 
00116   };
00117 
00119 }
00120 #endif
00121 

Last updated Aug 04 2007