Joint.hh
Go to the documentation of this file.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,v 1.7 2005/08/31 23:06:00 natepak Exp $ 00025 */ 00026 00027 #ifndef JOINT_HH 00028 #define JOINT_HH 00029 00030 #include <ode/ode.h> 00031 #include "Vector.hh" 00032 00033 class Body; 00034 00035 class Joint 00036 { 00037 // Constructor 00038 protected: Joint(); 00039 00040 // Destructor 00041 protected: virtual ~Joint(); 00042 00043 // Get the type of the joint 00044 public: int GetType() const; 00045 00046 // Get the body to which the joint is attached according the _index 00047 public: Body *GetJointBody( int index ) const; 00048 00049 // Determines of the two bodies are connected by a joint 00050 public: bool AreConnected( Body *one, Body *two ) const; 00051 00052 // Get the _parameter 00053 public: virtual double GetParam(int parameter) const; 00054 00055 // Make this joint a fixed joint 00056 // Use this only when absolutely necessary 00057 public: void SetFixed(); 00058 00059 // Attach the two bodies with this joint 00060 public: void Attach( Body *one, Body *two ); 00061 00062 // Detach this joint from all bodies 00063 public: void Detach(); 00064 00065 // Set the anchor point 00066 public: virtual void SetAnchor( GzVector anchor ) {} 00067 00068 // Set the anchor point 00069 public: virtual GzVector GetAnchor() const 00070 {return GzVectorSet(0,0,0);} 00071 00072 00073 // Set the _parameter to _value 00074 public: virtual void SetParam( int parameter, double value ); 00075 00076 // This is our id 00077 protected: dJointID jointId; 00078 00079 // The first body this joint connects to 00080 private: Body* body1; 00081 00082 // The second body this joint connects to 00083 private: Body* body2; 00084 }; 00085 00086 #endif 00087