Home
FAQ
Player
Utilities
Stage
Gazebo
Contrib
Documentation
Publications
Contributors
Users

Project
Download
Bugs/Feedback
Mailing lists

Radish

Old news
Old stuff

Body.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 bodies
00022  * Author: Nate Keonig, Andrew Howard
00023  * Date: 8 May 2003
00024  * CVS: $Id: Body.hh,v 1.27 2004/11/16 06:02:00 inspectorg Exp $
00025  */
00026 
00027 #ifndef BODY_HH
00028 #define BODY_HH
00029 
00030 #include <ode/ode.h>
00031 #include "Vector.hh"
00032 
00033 #include "GL/gl.h"
00034 
00035 // Forward declarations
00036 class World;
00037 class Geom;
00038 
00039 
00042 class Body
00043 {
00045   public: Body( const World *world, const char *bodyName = NULL, bool dummy = false );
00046 
00048   public: virtual ~Body();
00049   
00050   // Attach a geometry to this body
00051   private: void AttachGeom( Geom *geom );
00052 
00053   // Detach a geometry from this body
00054   private: void DetachGeom( Geom *geom );
00055 
00056   // Update the CoM and mass matrix
00057   public: void UpdateCoM();
00058 
00059   // Get the list of geometries
00060   public: int GetNumGeoms() {return this->geomCount;}
00061   public: Geom **GetGeoms() {return this->geoms;}
00062 
00063   // Enable/disable the body (so it doesnt fall, for example)
00064   public: void Enable(bool enable);
00065 
00067   public: GzPose GetPose( void ) const;
00068 
00070   public: GzVector GetPosition( void ) const;
00071 
00073   public: GzQuatern GetRotation( void ) const;
00074   
00076   public: void SetPose( GzPose pose );
00077 
00079   public: void SetPosition( GzVector pos );
00080 
00082   public: void SetRotation( GzQuatern rot );
00083 
00084   // Get the CoM body pose (global cs)
00085   public: GzPose GetCoMPose( void ) const;
00086 
00087   // Get the body linear velocity (global cs)
00088   public: GzVector GetLinearVel( void ) const;
00089 
00090   // Get the body angular velocity (global cs)
00091   public: GzQuatern GetAngularVel( void ) const;
00092 
00094   public: void SetLinearVel( GzVector vel );
00095 
00097   public: void SetAngularVel( GzVector vel );
00098 
00099   // Get the body id
00100   public: dBodyID GetBodyId() const;
00101   
00102   // Get the default space id
00103   public: dSpaceID GetSpaceId() const;
00104 
00106   public: void SetGravityMode(bool enabled);
00107   
00108   public: int GetGravityMode();
00109   
00110   // To correct the wheel rotation issues in ODE
00111   public: void SetFiniteRotationAxis(double x,double y,double z);
00112   public: void SetFiniteRotationMode(int mode);
00113 
00114   // Set pick id of all the geoms in this body
00115   public: void SetPickId( GLuint id );
00116 
00117   // TODO? // Force/Torque Setting Functions
00118   public: GzVector GetTorque(void);
00119 
00121   public: GzVector GetForce(void);
00122 
00124   public: void SetForce( GzVector f );
00125   
00126   public: void SetTorque( double x, double y, double z);
00127 
00128   public: void AddForce( double x, double y, double z);
00129   public: void AddTorque( double x, double y, double z);
00130   public: void AddRelForce( double x, double y, double z);
00131   public: void AddRelTorque( double x, double y, double z);
00132    
00133   public: void AddForceAtPos( double x, double y, double z, 
00134                               double pos_x,double pos_y,double pos_z); 
00135   public: void AddForceAtRelPos( double x, double y, double z,
00136                                  double pos_x,double pos_y,double pos_z);
00137 
00138   // A name to reference us by
00139   public: char *bodyName;
00140   
00141   // ODE world we belong to
00142   protected: dWorldID worldId;
00143 
00144   // ODE body handle
00145   protected: dBodyID bodyId;
00146 
00147   // Pose of CoM relative to body
00148   private: GzPose comPose;
00149 
00150   // Body pose (for dummy bodies)
00151   protected: GzPose dummyPose;
00152 
00153   // List of geometries attach to this body
00154   private: int geomCount, geomMaxCount;
00155   private: Geom **geoms;
00156 
00157   // Mass properties of the object
00158   protected: dMass mass;
00159 
00160   // Warts
00161   friend class Geom;
00162   friend class BaseGeom;
00163   friend class Camera;
00164 };
00165 
00166 
00167 
00168 #endif
00169 


Last updated $Date: 2004/12/21 01:49:15 $
Generated on Sun May 22 18:39:07 2005 for Gazebo by doxygen 1.4.2