Joint.hh
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
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 &  ) {}
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