Gazebo logo

BaseGeom.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: Base class for all geometries
00022  * Author: Nate Keonig, Andrew Howard
00023  * Date: 8 May 2003
00024  * CVS: $Id: BaseGeom.hh,v 1.13 2005/05/06 17:18:55 natepak Exp $
00025  */
00026 
00027 #ifndef BASEGEOM_HH
00028 #define BASEGEOM_HH
00029 
00030 #include <ode/ode.h>
00031 #include "Vector.hh"
00032 
00033 class Body;
00034 class ContactParams;
00035 
00036 
00042 class BaseGeom
00043 {
00044   // Constructor
00045   public: BaseGeom( dSpaceID spaceId );
00046 
00047   // Destructor
00048   public: virtual ~BaseGeom();
00049 
00051   public: void SetGeom( Body *body, dGeomID geomId, dMass *mass, bool placeable);
00052 
00053   // Set the extra rotation of the encapsulated object (called in constructor)
00054   protected: void SetExtraRotation( GzQuatern rot );
00055   
00056   // Get the geometry id
00057   public: dGeomID GetTransId() const;
00058   public: dGeomID GetGeomId() const;
00059 
00060   // Set the geometry category bitfield
00061   public: void SetCategoryBits( uint bits );
00062 
00063   // Set the geometry collision bitfield
00064   public: void SetCollideBits( uint bits );
00065   
00067   public: virtual void SetRelativePose( GzPose pose, bool updateCoM = true );
00068 
00070   public: virtual GzPose GetRelativePose() const;
00071   
00073   public: GzPose GetPose() const;
00074 
00076   public: void SetRelativePosition( GzVector pos );
00077 
00079   public: void SetRelativeRotation( GzQuatern rot );
00080 
00084   public: void SetHardness( double kp, double kd );
00085 
00089   public: void SetFriction( double mu1, double mu2 );
00090   
00091   // Set Contact params
00092   public: void SetBounce( double bounce );
00093   public: void SetSlip1( double slip );
00094   public: void SetSlip2( double slip );
00095 
00096   // Get Contact params
00097   public: double GetBounce() const;
00098   public: double GetSlip1() const;
00099   public: double GetSlip2() const;
00100 
00101   // Set the mass of the object
00102   public: void SetMass( double m );
00103 
00104   // Get the mass matrix (body-centered coords)
00105   public: const dMass *GetBodyMassMatrix();
00106 
00107   // The body we are attached to
00108   public: Body *body;
00109 
00110   // ODE space this geom belongs go
00111   protected: dSpaceID spaceId;
00112 
00113   // Id for the geometry and the transform
00114   protected: dGeomID transId, geomId;
00115 
00116   // Mass matrix relative to geometry and relative to body
00117   protected: dMass geomMass, bodyMass;
00118 
00119   // Is this geom placable?
00120   public: bool placeableGeom;
00121 
00122   // Global pose if the geom is not placeable
00123   private: GzPose dummyPose;
00124 
00125   // Hacky extra rotation to make ODE and Gazebo primitives have
00126   // matching orientations
00127   private: GzQuatern extraRotation;
00128 
00129   // Contact joint parameters
00130   protected: ContactParams *contact;
00131 
00132   // Wart
00133   friend class World;
00134 };
00135 
00136 #endif
00137 

Last updated 12 September 2005 21:38:45