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 4402 2008-03-09 14:39:27Z robotos $
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 
00035 #include "MovableText.hh"
00036 #include "UpdateParams.hh"
00037 #include "Pose3d.hh"
00038 #include "Joint.hh"
00039 #include "Entity.hh"
00040 #include "gazebo.h"
00041 
00042 
00043 namespace gazebo
00044 {
00045 
00046   // Forward declarations
00047   class XMLConfigNode;
00048   class Body;
00049   class Controller;
00050   class HingeJoint;
00051 
00055   
00057   class Model : public Entity
00058   {
00060     public: Model(Model *parent);
00061   
00063     public: virtual ~Model();
00064   
00066     public: int Load(XMLConfigNode *node);
00067   
00069     public: void Save();
00070     public: void Test();
00071 
00073     public: int Init();
00074   
00077     public: int Update(UpdateParams &params);
00078   
00080     public: int Fini();
00081 
00083     public: void Reset();
00084   
00086     protected: virtual int LoadChild(XMLConfigNode * /*node*/) {return 0;}
00087   
00089     protected: virtual int InitChild() {return 0;}
00090   
00092     protected: virtual int UpdateChild() {return 0;}
00093   
00095     protected: virtual int FiniChild() {return 0;}
00096     
00098     public: const std::string &GetType() const;
00099 
00101     public: void SetInitPose(const Pose3d &pose);
00102   
00104     public: const Pose3d &GetInitPose() const;
00105   
00107     public: void SetPose(const Pose3d &pose);
00108   
00110     public: const Pose3d &GetPose() const;
00111   
00114     public: Body *CreateBody();
00115   
00119     public: Joint *CreateJoint(Joint::Type type);
00120   
00124     public: Joint *GetJoint(std::string name);
00125   
00128     public: Body *GetBody();
00129 
00132     public: Body *GetBody(const std::string &name);
00133   
00135     public: void Attach(XMLConfigNode *node);
00136   
00139     public: Body *GetCanonicalBody();
00140 
00143     private: void LoadBody(XMLConfigNode *node);
00144   
00147     private: void LoadJoint(XMLConfigNode *node);
00148   
00151     private: void LoadController(XMLConfigNode *node);
00152   
00154     private: void LoadPhysical(XMLConfigNode *node);
00155   
00157     private: void LoadRenderable(XMLConfigNode *node);
00158   
00160     private: std::string type;
00161   
00163     private: XMLConfigNode *xmlNode;
00164   
00166     private: Pose3d initPose;
00167   
00169     private: Pose3d pose;
00170   
00172     protected: std::map<std::string, Body* > bodies;
00173   
00175     protected: std::map<std::string, Joint* > joints;
00176   
00178     protected: std::map<std::string, Controller* > controllers;
00179   
00181     private: std::string canonicalBodyName;
00182   
00184     private: HingeJoint *joint;
00185   
00187     private: static uint lightNumber;
00188 
00189     //private: MovableText *mtext;
00190 
00191   /*  private: PyObject *pName;
00192       private: PyObject *pModule;
00193       private: PyObject *pFuncUpdate;
00194     */
00195   };
00197 }
00198 
00199 #endif

Last updated Aug 04 2007