playground.h

Go to the documentation of this file.
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: playground.h,v $ 00024 * Revision 1.13 2006/09/21 22:09:12 martius 00025 * *** empty log message *** 00026 * 00027 * Revision 1.12 2006/08/11 15:41:04 martius 00028 * playgrounds handle non-quadratic ground planes 00029 * 00030 * Revision 1.11 2006/07/14 12:23:33 martius 00031 * selforg becomes HEAD 00032 * 00033 * Revision 1.10.4.16 2006/07/14 11:11:53 martius 00034 * revert to 1.10.4.12 00035 * 00036 * Revision 1.10.4.12 2006/06/29 16:39:55 robot3 00037 * -you can now see bounding shapes if you type ./start -drawboundings 00038 * -includes cleared up 00039 * -abstractobstacle and abstractground have now .cpp-files 00040 * 00041 * Revision 1.10.4.11 2006/05/23 13:37:34 robot3 00042 * -fixed some creating bugs 00043 * -setColor,setTexture and createGround must be 00044 * called before setPosition now 00045 * 00046 * Revision 1.10.4.10 2006/05/19 08:42:54 robot3 00047 * -some code moved to abstractground.h 00048 * -it's now possible creating a playground without a groundplane 00049 * 00050 * Revision 1.10.4.9 2006/05/18 14:32:12 robot3 00051 * walls are now textured with a wood texture 00052 * 00053 * Revision 1.10.4.8 2006/05/18 12:54:24 robot3 00054 * -fixed not being able to change the color after positioning 00055 * the obstacle 00056 * -cleared the files up 00057 * 00058 * Revision 1.10.4.7 2006/05/18 09:43:24 robot3 00059 * using existing texture image in cvs for the groundplane now 00060 * 00061 * Revision 1.10.4.6 2006/05/18 07:42:36 robot3 00062 * Grounds have now a groundPlane for shadowing issues 00063 * osgprimitive.cpp contains a bug that repeating textures (wrapping) 00064 * don't work, needs to be fixed 00065 * 00066 * Revision 1.10.4.5 2006/05/11 08:59:15 robot3 00067 * -fixed a positioning bug (e.g. for passivesphere) 00068 * -some methods moved to abstractobstacle.h for avoiding inconsistencies 00069 * 00070 * Revision 1.10.4.4 2006/03/29 15:04:39 martius 00071 * have pose now 00072 * 00073 * Revision 1.10.4.3 2006/01/10 20:27:15 martius 00074 * protected members 00075 * 00076 * Revision 1.10.4.2 2006/01/10 17:17:33 martius 00077 * new mode for primitives 00078 * 00079 * Revision 1.10.4.1 2005/12/06 10:13:23 martius 00080 * openscenegraph integration started 00081 * 00082 * Revision 1.10 2005/09/22 12:24:36 martius 00083 * removed global variables 00084 * OdeHandle and GlobalData are used instead 00085 * sensor prepared 00086 * 00087 * Revision 1.9 2005/09/13 13:19:57 martius 00088 * no texture 00089 * 00090 * Revision 1.8 2005/08/02 14:09:06 fhesse 00091 * factor between length in x and y direction 00092 * added to constructor 00093 * 00094 * Revision 1.7 2005/07/29 14:27:59 martius 00095 * color set to some red 00096 * 00097 * Revision 1.6 2005/07/18 14:52:33 martius 00098 * world and space are not pointers anymore. 00099 * 00100 * Revision 1.5 2005/07/07 10:24:23 martius 00101 * avoid internal collisions 00102 * 00103 * Revision 1.4 2005/06/15 14:22:11 martius 00104 * GPL included 00105 * * 00106 ***************************************************************************/ 00107 #ifndef __PLAYGROUND_H 00108 #define __PLAYGROUND_H 00109 00110 #include "mathutils.h" 00111 #include "abstractground.h" 00112 00113 namespace lpzrobots { 00114 00115 class Playground : public AbstractGround { 00116 00117 protected: 00118 00119 double length, width, height; 00120 double factorlength2; 00121 00122 public: 00123 00124 Playground(const OdeHandle& odeHandle, const OsgHandle& osgHandle , 00125 const osg::Vec3& dimension = osg::Vec3(7.0, 0.2, 0.5) , 00126 double factorxy = 1, bool createGround=true) 00127 : AbstractGround(odeHandle, osgHandle, createGround, dimension.x(), dimension.x()*factorxy) { 00128 00129 length=dimension.x(); 00130 width=dimension.y(); 00131 height=dimension.z(); 00132 factorlength2=factorxy; 00133 }; 00134 00135 protected: 00136 virtual void create(){ 00137 Box* box; 00138 osg::Vec3 offset(- (length/2 + width/2), 00139 0, 00140 height/2+0.01f/*reduces graphic errors and ode collisions*/); 00141 box = new Box( width , (length * factorlength2) + 2 * width , height); 00142 box->init(odeHandle, 0, osgHandle, Primitive::Geom | Primitive::Draw); 00143 box->setPose(osg::Matrix::translate(offset) * pose); 00144 box->getOSGPrimitive()->setTexture(wallTextureFileName); 00145 obst.push_back(box); 00146 00147 offset.x() = length/2 + width/2; 00148 box = new Box( width , (length * factorlength2) + 2 * width , height); 00149 box->init(odeHandle, 0, osgHandle, Primitive::Geom | Primitive::Draw); 00150 box->setPose(osg::Matrix::translate(offset) * pose); 00151 box->getOSGPrimitive()->setTexture(wallTextureFileName); 00152 obst.push_back(box); 00153 00154 offset.x() = 0; 00155 offset.y() = -( (length*factorlength2)/2 +width/2); 00156 box = new Box( length, width, height); 00157 box->init(odeHandle, 0, osgHandle, Primitive::Geom | Primitive::Draw); 00158 box->setPose(osg::Matrix::translate(offset) * pose); 00159 box->getOSGPrimitive()->setTexture(wallTextureFileName); 00160 obst.push_back(box); 00161 00162 offset.y() = (length*factorlength2)/2 +width/2; 00163 box = new Box( length, width, height); 00164 box->init(odeHandle, 0, osgHandle, Primitive::Geom | Primitive::Draw); 00165 box->setPose(osg::Matrix::translate(offset) * pose); 00166 box->getOSGPrimitive()->setTexture(wallTextureFileName); 00167 obst.push_back(box); 00168 00169 obstacle_exists=true; 00170 }; 00171 00172 }; 00173 00174 } 00175 00176 #endif

Generated on Tue Jan 16 02:14:37 2007 for Robotsystem of the Robot Group Leipzig by doxygen 1.3.8