Gazebo

Global.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: Generic Typedefs, macros, functions, etc
00022  * Author: Nate Koenig
00023  * Date: 16 June 2003
00024  * CVS: $Id: Global.hh 156 2007-11-26 20:26:57Z natepak $
00025  */
00026 
00027 #ifndef GZGLOBAL_HH
00028 #define GZGLOBAL_HH
00029 
00031 // Typedefs
00033 
00034 #include <stdint.h>
00035 #include <list>
00036 //#include <boost/thread/thread.hpp>
00037 #include <boost/thread/recursive_mutex.hpp>
00038 
00039 #include "Pose3d.hh"
00040 
00042 // Defines
00044 #ifndef NULL
00045 #define NULL 0
00046 #endif
00047 
00048 #ifndef GZ_COLLIDE_BITS
00049 
00050 #define GZ_ALL_COLLIDE 0xFFFFFFFF
00051 #define GZ_NONE_COLLIDE 0x00000000
00052 #define GZ_FIXED_COLLIDE 0x00000001
00053 #define GZ_LASER_COLLIDE 0x00000002
00054 
00055 #endif
00056 
00057 #ifndef GZ_CAMERA_BITS
00058 
00059 #define GZ_ALL_CAMERA 0xFFFFFFFF
00060 #define GZ_LASER_CAMERA 0x00000001
00061 #define GZ_GUIDATA_CAMERA 0x00000002
00062 
00063 #endif
00064 
00066 // Macros
00068 
00069 // Convert radians to degrees
00070 #define RTOD(r) ((r) * 180 / M_PI)
00071 
00072 // Convert degrees to radians
00073 #define DTOR(d) ((d) * M_PI / 180)
00074 
00075 // Normalize an angle in the range -Pi to Pi
00076 #define NORMALIZE(a) (atan2(sin(a), cos(a)))
00077 
00078 // Odd and even macros
00079 #define ISEVEN(x) ( ((x) % 2) == 0)
00080 #define ISODD(x) ( ((x) % 2) != 0)
00081 
00082 // Min and Max macros
00083 #define MAX(x,y) ( (x) > (y) ? (x) : (y) )
00084 #define MIN(x,y) ( (x) < (y) ? (x) : (y) )
00085 
00086 #define ROUND(x) ( (int)( floor((x)+0.5) ) )
00087 
00088 #endif
00089 
00090 namespace gazebo
00091 {
00092   class Gui;
00093 
00097 
00099 
00114   class Global
00115   {
00117     public: static boost::recursive_mutex mutex;
00118 
00120     private: static bool userQuit;
00121 
00123     public: static bool GetUserQuit();
00124 
00126     public: static void SetUserQuit(bool quit);
00127 
00129     private: static bool userPause;
00130 
00132     public: static bool GetUserPause();
00133 
00135     public: static void SetUserPause(bool pause);
00136 
00138     private: static bool userStep;
00139 
00141     public: static bool GetUserStep();
00142 
00144     public: static void SetUserStep( bool step );
00145 
00148     private: static bool userStepInc;
00149 
00151     public: static bool GetUserStepInc();
00152 
00154     public: static void SetUserStepInc(bool step);
00155 
00157     private: static bool showBoundingBoxes;
00158 
00160     public: static bool GetShowBoundingBoxes();
00161 
00163     public: static void SetShowBoundingBoxes(bool show);
00164 
00166     private: static unsigned long iterations;
00167 
00169     public: static unsigned long GetIterations();
00170 
00172     public: static void SetIterations(unsigned long count);
00173 
00175     public: static void IncIterations();
00176 
00178     public: static Gui *gui;
00179 
00181     public: static std::list<std::string> gazeboPaths;
00182 
00184     public: static std::list<std::string> ogrePaths;
00185 
00187     public: static Pose3d poseOffset;
00188 
00189     private: Global();
00190     private: ~Global();
00191   };
00192 
00194 }

Last updated Aug 04 2007