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 281 2008-03-06 12:00:34Z robotos $
00025  */
00026 
00027 #ifndef JOINT_HH
00028 #define JOINT_HH
00029 
00030 #include <ode/ode.h>
00031 
00032 #include "Vector3.hh"
00033 
00034 namespace gazebo
00035 {
00039   
00040   class Body;
00041   class XMLConfigNode;
00042   class Model;
00043   class OgreDynamicLines;
00044   class OgreVisual; 
00045 
00047   class Joint
00048   {
00050     public: enum Type {SLIDER, HINGE, HINGE2, BALL, UNIVERSAL};
00051 
00053     public: Joint();
00054 
00056     public: virtual ~Joint();
00057 
00059     public: void Load(XMLConfigNode *node);
00060 
00062     protected: virtual void LoadChild(XMLConfigNode *node) {};
00063 
00065     public: void Update();
00066 
00068     public: void Reset();
00069 
00071     protected: virtual void ResetChild() {};
00072 
00074     public: void SetModel(Model *model);
00075 
00077     public: Joint::Type GetType() const;
00078 
00080     public: Body *GetJointBody( int index ) const;
00081 
00083     public: bool AreConnected( Body *one, Body *two ) const;
00084 
00086     public: virtual double GetParam(int parameter) const;
00087 
00090     public: void SetFixed();
00091 
00093     public: void Attach( Body *one, Body *two );
00094 
00096     public: void Detach();
00097 
00099     public: virtual void SetAnchor( const gazebo::Vector3 & /*anchor*/ ) {}
00100 
00102     public: virtual gazebo::Vector3 GetAnchor() const
00103             {return gazebo::Vector3(0,0,0);}
00104 
00105 
00107     public: virtual void SetParam( int parameter, double value );
00108 
00110     public: std::string GetName() const;
00111 
00113     public: void SetName(const std::string &name);
00114 
00116     public: void SetERP(double newERP);
00117 
00119     public: double GetERP();
00120 
00122     public: void SetCFM(double newERP);
00123 
00125     public: double GetCFM();
00126 
00128     public: double GetHighStop(int index=0);
00129 
00131     public: double GetLowStop(int index=0);
00132    
00134     protected: dJointID jointId;
00135 
00137     protected: Type type;
00138 
00140     private: Body *body1;
00141 
00143     private: Body *body2;
00144 
00146     private: std::string name;
00147 
00148     private: OgreVisual *visual;
00149 
00150     private: Model *model;
00151 
00152     private: OgreDynamicLines *line1;
00153     private: OgreDynamicLines *line2;
00154   };
00155 
00157 }
00158 #endif
00159 

Last updated Aug 04 2007