Gazebo

ODEPhysics.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 ODE physics engine wrapper
00022  * Author: Nate Koenig
00023  * Date: 11 June 2007
00024  * SVN: $Id: ODEPhysics.hh 206 2008-01-04 14:00:01Z robotos $
00025  */
00026 
00027 #ifndef ODEPHYSICS_HH
00028 #define ODEPHYSICS_HH
00029 
00030 #include <ode/ode.h>
00031 #include <map>
00032 
00033 #include "PhysicsEngine.hh"
00034 
00035 
00036 namespace gazebo
00037 {
00038   class SphereGeom;
00039   class PlaneGeom;
00040   class BoxGeom;
00041   class CylinderGeom;
00042   class Entity;
00043   class XMLConfigNode;
00044 
00047 
00072 
00073 class ODEPhysics : public PhysicsEngine
00074 {
00076   public: ODEPhysics();
00077 
00079   public: virtual ~ODEPhysics();
00080 
00082   public: virtual void Load(XMLConfigNode *node);
00083 
00085   public: void Save(XMLConfigNode *node);
00086 
00088   public: virtual void Init();
00089 
00091   public: virtual void Update();
00092 
00094   public: virtual void Fini();
00095 
00097   public: virtual void AddEntity(Entity *entity);
00098 
00100   public: virtual void RemoveEntity(Entity *entity);
00101 
00103   public: virtual Body *CreateBody(Entity *parent);
00104 
00106   public: virtual Joint *CreateJoint(Joint::Type type);
00107 
00109   public: dSpaceID GetSpaceId() const;
00110 
00112   private: static void CollisionCallback( void *data, dGeomID o1, dGeomID o2);
00113 
00115   private: dWorldID worldId;
00116 
00118   private: dSpaceID spaceId;
00119 
00121   private: dJointGroupID contactGroup;
00122           
00124   protected: std::map<int, Entity* > entities;
00125 
00126   private: double globalCFM;
00127   private: double globalERP; 
00128 };
00129 
00131 
00132 }
00133 
00134 #endif

Last updated Aug 04 2007