00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Robot Group Leipzig * 00003 * martius@informatik.uni-leipzig.de * 00004 * fhesse@informatik.uni-leipzig.de * 00005 * der@informatik.uni-leipzig.de * 00006 * frankguettler@gmx.de * 00007 * * 00008 * This program is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU General Public License as published by * 00010 * the Free Software Foundation; either version 2 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This program is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this program; if not, write to the * 00020 * Free Software Foundation, Inc., * 00021 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00022 * * 00023 * $Log: abstractground.h,v $ 00024 * Revision 1.10 2008/04/17 15:59:00 martius 00025 * OSG2 port finished 00026 * 00027 * Revision 1.9.2.1 2008/04/15 16:21:52 martius 00028 * Profiling 00029 * Multithreading also for OSG and ODE but disables because of instabilities 00030 * 00031 * Revision 1.9 2007/12/06 10:02:49 der 00032 * abstractground: returns now cornerpoints 00033 * abstractobstacle: is now trackable 00034 * hudstatistics: supports now AbstractmMeasure 00035 * 00036 * Revision 1.8 2007/09/06 18:46:41 martius 00037 * printContours 00038 * 00039 * Revision 1.7 2007/08/24 11:53:10 martius 00040 * Change geometry 00041 * 00042 * Revision 1.6 2007/07/03 13:06:41 martius 00043 * groundplane thick 00044 * 00045 * Revision 1.5 2007/04/05 15:10:14 martius 00046 * extra ground substance 00047 * 00048 * Revision 1.4 2007/03/16 11:01:37 martius 00049 * abstractobstacle gets mor functionallity 00050 * setSubstance 00051 * 00052 * Revision 1.3 2006/08/11 15:41:04 martius 00053 * playgrounds handle non-quadratic ground planes 00054 * 00055 * Revision 1.2 2006/07/14 12:23:32 martius 00056 * selforg becomes HEAD 00057 * 00058 * Revision 1.1.2.9 2006/07/14 11:36:32 martius 00059 * revert to older revision of robot3 00060 * 00061 * Revision 1.1.2.8 2006/07/13 12:11:26 robot5 00062 * Using overhauled primitives Plane and Box. 00063 * Repeat texturing is supported by them now. 00064 * 00065 * Revision 1.1.2.7 2006/06/29 16:39:55 robot3 00066 * -you can now see bounding shapes if you type ./start -drawboundings 00067 * -includes cleared up 00068 * -abstractobstacle and abstractground have now .cpp-files 00069 * 00070 * Revision 1.1.2.6 2006/06/26 08:25:03 robot3 00071 * fixed ground texture bug 00072 * 00073 * Revision 1.1.2.5 2006/06/22 12:25:45 der 00074 * added setGroundTexture and setGroundColor 00075 * 00076 * Revision 1.1.2.4 2006/06/16 22:27:26 martius 00077 * getMainPrimtive 00078 * 00079 * Revision 1.1.2.3 2006/05/23 14:13:41 der 00080 * fixed initialization bug 00081 * 00082 * Revision 1.1.2.2 2006/05/23 13:37:45 robot3 00083 * -fixed some creating bugs 00084 * -setColor,setTexture and createGround must be 00085 * called before setPosition now 00086 * 00087 * Revision 1.1.2.1 2006/05/19 08:41:27 robot3 00088 * Class AbstractGround contains now basic routines like 00089 * creating the groundPlane, setPose and so on 00090 * 00091 * * 00092 * * 00093 ***************************************************************************/ 00094 #ifndef __ABSTRACTGROUND_H 00095 #define __ABSTRACTGROUND_H 00096 00097 #include <list> 00098 #include "abstractobstacle.h" 00099 #include <selforg/position.h> 00100 00101 namespace lpzrobots { 00102 00103 class Primitive; 00104 00105 // abstract class for any playground 00106 class AbstractGround : public AbstractObstacle { 00107 00108 public: 00109 00110 AbstractGround(const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00111 bool createGround, double groundLength, double groundWidth, double wallThickness); 00112 00113 virtual ~AbstractGround(); 00114 00115 00116 virtual void setPose(const osg::Matrix& pose); 00117 00118 virtual void createGround(bool create); 00119 00120 virtual void setTexture(const std::string& filename); 00121 00122 virtual Primitive* getMainPrimitive() const; 00123 00124 virtual void changeGeometry(double length, double width, double height, double factorxy); 00125 00126 /// prints the contour of the boxes into the file 00127 virtual void printContours(FILE* f); 00128 00129 /** 00130 * assigns the texture to the object 00131 */ 00132 virtual void setGroundTexture(const std::string& filename); 00133 00134 /** 00135 * sets the ground color 00136 * should be called before setPosition() 00137 * @param color values in RGBA 00138 */ 00139 virtual void setGroundColor(const Color& color); 00140 00141 /** 00142 * sets the substance of the ground. 00143 * @param substance description of the substance 00144 */ 00145 virtual void setGroundSubstance(const Substance& substance); 00146 00147 00148 /** 00149 * returns the corner points of the groundplane 00150 * @return list of the cornerpoints 00151 */ 00152 virtual std::list<Position> getCornerPointsXY(); 00153 00154 00155 00156 protected: 00157 00158 Primitive* groundPlane; // the groundplane 00159 bool creategroundPlane; 00160 double groundLength; 00161 double groundWidth; 00162 double wallThickness; 00163 std::string wallTextureFileName; 00164 Color groundColor; 00165 std::string groundTextureFileName; 00166 00167 virtual void createGround(); 00168 00169 }; 00170 00171 } 00172 00173 #endif