Gazebo

Model.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: Base class for all models
00022  * Author: Nathan Koenig and Andrew Howard
00023  * Date: 8 May 2003
00024  * SVN: $Id: Model.hh 123 2007-09-19 20:36:14Z natepak $
00025  */
00026 
00027 #ifndef MODEL_HH
00028 #define MODEL_HH
00029 
00030 //#include <python2.4/Python.h>
00031 #include <map>
00032 #include <string>
00033 #include <vector>
00034 #include <map>
00035 
00036 #include "MovableText.hh"
00037 #include "UpdateParams.hh"
00038 #include "Pose3d.hh"
00039 #include "Joint.hh"
00040 #include "Entity.hh"
00041 #include "gazebo.h"
00042 
00043 // Forward declarations
00044 namespace Ogre
00045 {
00046   class SceneNode;
00047 }
00048 
00049 namespace gazebo
00050 {
00051 
00052   class XMLConfigNode;
00053   class Body;
00054   class Controller;
00055   class HingeJoint;
00056 
00060   
00062   class Model : public Entity
00063   {
00065     public: Model();
00066   
00068     public: virtual ~Model();
00069   
00071     public: int Load(XMLConfigNode *node);
00072   
00074     public: int Init();
00075   
00078     public: int Update(UpdateParams &params);
00079   
00081     public: int Fini();
00082 
00084     public: void Reset();
00085   
00087     protected: virtual int LoadChild(XMLConfigNode * /*node*/) {return 0;}
00088   
00090     protected: virtual int InitChild() {return 0;}
00091   
00093     protected: virtual int UpdateChild() {return 0;}
00094   
00096     protected: virtual int FiniChild() {return 0;}
00097   
00099     public: void SetType(const std::string &type);
00100   
00102     public: const std::string &GetType() const;
00103   
00105     public: void SetXMLConfigNode( XMLConfigNode *node );
00106   
00108     public: XMLConfigNode *GetXMLConfigNode() const;
00109   
00111     public: void SetInitPose(const Pose3d &pose);
00112   
00114     public: const Pose3d &GetInitPose() const;
00115   
00117     public: void SetPose(const Pose3d &pose);
00118   
00120     public: const Pose3d &GetPose() const;
00121   
00124     public: Body *CreateBody();
00125   
00129     public: Joint *CreateJoint(Joint::Type type);
00130   
00134     public: Joint *GetJoint(std::string name);
00135   
00138     public: Body *GetBody();
00139   
00141     public: void Attach();
00142   
00145     public: Body *GetCanonicalBody();
00146   
00150     private: int LoadBody(XMLConfigNode *node);
00151   
00155     private: int LoadJoint(XMLConfigNode *node);
00156   
00159     private: void LoadController(XMLConfigNode *node);
00160   
00162     private: void LoadPhysical(XMLConfigNode *node);
00163   
00165     private: void LoadRenderable(XMLConfigNode *node);
00166   
00168     private: std::string type;
00169   
00171     private: XMLConfigNode *node;
00172   
00174     private: Pose3d initPose;
00175   
00177     private: Pose3d pose;
00178   
00180     protected: std::map<std::string, Body* > bodies;
00181   
00183     protected: std::map<std::string, Joint* > joints;
00184   
00186     protected: std::map<std::string, Controller* > controllers;
00187   
00189     private: std::string canonicalBodyName;
00190   
00192     private: HingeJoint *joint;
00193   
00195     private: Model *parentModel;
00196 
00197     //private: MovableText *mtext;
00198 
00199   /*  private: PyObject *pName;
00200       private: PyObject *pModule;
00201       private: PyObject *pFuncUpdate;
00202     */
00203   };
00205 }
00206 
00207 #endif

Last updated Aug 04 2007