Gazebo

World.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: The world; all models are collected here
00022  * Author: Andrew Howard and Nate Koenig
00023  * Date: 3 Apr 2007
00024  * SVN: $Id: World.hh 123 2007-09-19 20:36:14Z natepak $
00025  */
00026 
00027 #ifndef WORLD_HH
00028 #define WORLD_HH
00029 
00030 #include <vector>
00031 #include "SingletonT.hh"
00032 #include "Vector3.hh"
00033 #include "Pose3d.hh"
00034 
00035 namespace gazebo
00036 {
00040 
00041 // Forward declarations
00042   class Server;
00043   class SimulationIface;
00044   class Model;
00045   class PhysicsEngine;
00046   class XMLConfigNode;
00047   class XMLConfig;
00048 
00050 /*
00051  * The world class keps a list of all models, handles loading and saving,
00052  * object dynamics and collision detection for contact joints
00053  */
00054 class World : public SingletonT<World>
00055 {
00057   private: World();
00058 
00060   private: ~World();
00061 
00065   public: void Load(XMLConfig *node, int serverId);
00066 
00069   public: int Init();
00070 
00073   public: int Update();
00074 
00077   public: int Fini();
00078 
00081   public: Server *GetGzServer() const;
00082 
00085   public: PhysicsEngine *GetPhysicsEngine() const;
00086 
00089   public: double GetSimTime() const;
00090 
00093   public: double GetPauseTime() const;
00094 
00097   public: double GetStartTime() const;
00098 
00101   public: double GetRealTime() const;
00102 
00105   public: double GetWallTime() const;
00106 
00111   public: int LoadEntities(XMLConfigNode *node, Model *parent);
00112 
00115   public: void DeleteEntity(const char *name);
00116 
00118   public: Model *GetModelByName(std::string modelName);
00119 
00124   private: Model *LoadModel(XMLConfigNode *node, Model *parent);
00125 
00129   private: void SetModelPose(Model *model , Pose3d pose);
00130 
00132   private: void UpdateSimulationIface();
00133 
00135   private: PhysicsEngine *physicsEngine;
00136 
00138   private: std::vector< Model* > models;
00139 
00141   private: std::vector< Model* > toAddModels;
00142 
00144   private: std::vector< Model* > toDeleteModels;
00145 
00147   private: Server *server;
00148 
00150   private: SimulationIface *simIface;
00151 
00153   private: bool pause;
00154 
00156   private: double simTime, pauseTime, startTime;
00157 
00158   private: friend class DestroyerT<World>;
00159   private: friend class SingletonT<World>;
00160 };
00161 
00162 
00164 }
00165 
00166 #endif

Last updated Aug 04 2007