Gazebo logo

World.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: The world; all models are collected here
00022  * Author: Nate Koenig, Andrew Howard
00023  * Date: 8 May 2003
00024  * CVS: $Id: World.hh,v 1.48 2006/02/14 03:00:25 natepak Exp $
00025  */
00026 
00027 #ifndef WORLD_HH
00028 #define WORLD_HH
00029 
00030 #include "Geom.hh"
00031 #include "Model.hh"
00032 #include "Sensor.hh"
00033 
00034 // Forward declarations
00035 class WorldFile;
00036 class WorldFileNode;
00037 
00038 typedef struct gz_server gz_server_t;
00039 typedef struct gz_sim gz_sim_t;
00040 
00041 
00047 class World
00048 {
00049   // Constructor
00050   public: World(int serverId, bool serverForce);
00051 
00052   // Destructor
00053   public: virtual ~World();
00054 
00058   public: int Load( WorldFile *worldFile );
00059 
00060   // Load models (recursive)
00061   public: int LoadModel( WorldFileNode *node, Model *parent );
00062 
00063   // Try to load a given plugin, using a particular search algorithm.
00064   private: int LoadPlugin(const char* pluginname, const char *worldfilepath);
00065   
00069   public: void SetModelPose( Model *model, GzPose pose );
00070 
00076   public: void ResetModelPoses();
00077   
00081   public: int Save();
00082 
00083   // Initialize the world
00084   public: int Initialize();
00085 
00086   // Finalize the world
00087   public: int Finalize();
00088 
00089   // Move the world forward in time
00090   public: void Step();
00091 
00092   // Do collision detection
00093   private: static void CollisionCallback( void *data, dGeomID o1, dGeomID o2 );
00094   
00096   public: double GetSimTime();
00097 
00102   public: double GetPauseTime();
00103 
00105   public: double GetRealTime();
00106 
00108   public: double GetWallTime();
00109 
00111   public: double GetDayTime();
00112 
00114   public: int GetNumModels() const;
00115 
00117   public: Model **GetModels() const;
00118 
00120   private: void AddModel( Model *model );
00121 
00122   // Get the world space id
00123   public: dSpaceID GetSpaceId() {return this->spaceId;}
00124 
00125   // World file
00126   private: WorldFile *worldFile;
00127   
00128   // Server id
00129   public: int server_id;
00130   private: bool server_force;
00131   
00132   // Simulator control interface
00133   public: gz_server_t *gz_server;
00134   private: gz_sim_t *gz_sim;
00135 
00136   // Top-level world for all bodies
00137   public: dWorldID worldId;
00138 
00139   // Top-level space for all sub-spaces/geoms
00140   private: dSpaceID spaceId;
00141 
00142   // List of dynamic models in the world
00143   private: int modelCount, modelMaxCount;
00144   private: Model **models;
00145 
00146   // Collision attributes
00147   private: dJointGroupID contactGroup;
00148 
00150   public: double simSpeed;
00151   
00153   private: double stepTime;
00154 
00156   private: bool pause;
00157 
00159   private: double simTime, pauseTime, startTime;
00160   
00161   // The gravity vector
00162   private: GzVector gravity;
00163 
00164   // The time offset
00165   private: double dayTime;
00166 
00168   public: double utcOffset;
00169   
00172   public: GzVector utmZone;
00173   
00175   public: GzVector utmOffset;
00176 
00177   // The color of the sky (default color)
00178   public: GzColor skyColor;
00179 
00180   // Fog settings
00181   public: bool fogEnable;
00182   public: double fogDensity;
00183   public: GzColor fogColor;
00184 
00185 
00186   // Warts
00187   friend class Model;
00188 };
00189 
00190 #endif
00191 

Last updated 12 September 2005 21:38:45