Gazebo

Body.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: Body class
00022  * Author: Nate Koenig
00023  * Date: 13 Feb 2006
00024  * SVN: $Id: Body.hh 283 2008-03-07 04:05:07Z natepak $
00025  */
00026 
00027 #ifndef BODY_HH
00028 #define BODY_HH
00029 
00030 #include <ode/ode.h>
00031 #include <list>
00032 #include <vector>
00033 
00034 #include "UpdateParams.hh"
00035 #include "XMLConfig.hh"
00036 #include "Entity.hh"
00037 #include "Pose3d.hh"
00038 
00039 namespace gazebo
00040 {
00041   class Geom;
00042   class Sensor;
00043 
00047 
00049 class Body : public Entity
00050 {
00052   public: Body(Entity *parent, dWorldID worldId);
00053 
00055   public: virtual ~Body();
00056 
00059   public: virtual void Load(XMLConfigNode *node);
00060 
00062   public: virtual void Save();
00063   
00065   public: virtual void Init();
00066 
00068   public: void Fini();
00069 
00071   public: virtual void Update(UpdateParams &params);
00072 
00075   public: void AttachGeom( Geom *geom );
00076 
00079   public: void SetPose(const Pose3d &pose);
00080 
00083   public: Pose3d GetPose() const;
00084 
00087   public: void SetPosition(const Vector3 &pos);
00088 
00091   public: void SetRotation(const Quatern &rot);
00092 
00095   public: Vector3 GetPosition() const;
00096 
00099   public: Quatern GetRotation() const;
00100 
00103   public: dBodyID GetId() const;
00104 
00106   public: void SetEnabled(bool enable) const;
00107 
00109   public: void UpdateCoM();
00110 
00112   public: const Pose3d &GetCoMPose() const;
00113 
00115   public: void SetGravityMode(bool mode);
00116 
00118   public: void SetLinearVel(const Vector3 &vel);
00119 
00121   public: Vector3 GetLinearVel() const;
00122 
00124   public: void SetAngularVel(const Vector3 &vel);
00125 
00127   public: Vector3 GetAngularVel() const;
00128 
00130   public: void SetForce(const Vector3 &force);
00131 
00133   public: Vector3 GetForce() const;
00134 
00136   public: void SetTorque(const Vector3 &force);
00137 
00139   public: Vector3 GetTorque() const;
00140 
00143   private: void LoadGeom(XMLConfigNode *node);
00144 
00147   private: void LoadSensor(XMLConfigNode *node);
00148 
00150   private: void LoadVisual(XMLConfigNode *node);
00151 
00153   private: std::vector< Geom* > geoms;
00154 
00156   private: std::vector< Sensor* > sensors;
00157   
00159   private: XMLConfigNode *xmlNode;
00160   
00162   private: dBodyID bodyId;
00163 
00165   private: dMass mass;
00166 
00167   private: bool isStatic;
00168 
00169   private: Pose3d comPose;
00170   private: Pose3d staticPose;
00171 };
00172 
00174 }
00175 #endif

Last updated Aug 04 2007