abstractobstacle.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: abstractobstacle.h,v $
00024  *   Revision 1.9  2006/07/14 12:23:32  martius
00025  *   selforg becomes HEAD
00026  *
00027  *   Revision 1.8.4.9  2006/06/29 16:39:55  robot3
00028  *   -you can now see bounding shapes if you type ./start -drawboundings
00029  *   -includes cleared up
00030  *   -abstractobstacle and abstractground have now .cpp-files
00031  *
00032  *   Revision 1.8.4.8  2006/06/16 22:27:26  martius
00033  *   getMainPrimtive
00034  *
00035  *   Revision 1.8.4.7  2006/05/23 13:38:02  robot3
00036  *   -fixed some creating bugs
00037  *   -setColor,setTexture and createGround must be
00038  *    called before setPosition now
00039  *
00040  *   Revision 1.8.4.6  2006/05/18 12:54:24  robot3
00041  *   -fixed not being able to change the color after positioning
00042  *    the obstacle
00043  *   -cleared the files up
00044  *
00045  *   Revision 1.8.4.5  2006/05/11 08:59:15  robot3
00046  *   -fixed a positioning bug (e.g. for passivesphere)
00047  *   -some methods moved to abstractobstacle.h for avoiding inconsistencies
00048  *
00049  *   Revision 1.8.4.4  2006/03/30 12:34:51  martius
00050  *   documentation updated
00051  *
00052  *   Revision 1.8.4.3  2006/03/29 15:04:38  martius
00053  *   have pose now
00054  *
00055  *   Revision 1.8.4.2  2005/12/06 10:13:23  martius
00056  *   openscenegraph integration started
00057  *
00058  *   Revision 1.8.4.1  2005/11/14 17:37:14  martius
00059  *   moved to selforg
00060  *
00061  *   Revision 1.8  2005/10/25 19:26:56  fhesse
00062  *   comments adjusted and in doxygen style
00063  *
00064  *   Revision 1.7  2005/09/22 12:24:36  martius
00065  *   removed global variables
00066  *   OdeHandle and GlobalData are used instead
00067  *   sensor prepared
00068  *
00069  *   Revision 1.6  2005/09/13 13:20:12  martius
00070  *   initialised color
00071  *
00072  *   Revision 1.5  2005/08/29 06:32:25  martius
00073  *   added virtual destructor
00074  *
00075  *   Revision 1.4  2005/07/18 14:52:33  martius
00076  *   world and space are not pointers anymore.
00077  *
00078  *   Revision 1.3  2005/06/15 14:22:11  martius
00079  *   GPL included
00080  *                                                                 *
00081  ***************************************************************************/
00082 #ifndef __ABSTRACTOBSTACLE_H
00083 #define __ABSTRACTOBSTACLE_H
00084 
00085 #include <ode/ode.h>
00086 
00087 #include "odehandle.h"
00088 #include "osghandle.h"
00089 #include <osg/Matrix>
00090 
00091 namespace lpzrobots {
00092 
00093   class Primitive;
00094 
00095 /**
00096  *  Abstract class (interface) for obstacles
00097  */
00098 class AbstractObstacle{
00099 
00100 
00101  public:
00102   /**
00103    * Constructor
00104    * @param odeHandle containing ODE stuff like world, space and jointgroup
00105    * @param osgHandle containing OSG stuff like scene, color...
00106    * be used for creation of obstacles
00107    */
00108   AbstractObstacle(const OdeHandle& odeHandle, const OsgHandle& osgHandle);
00109 
00110   virtual ~AbstractObstacle();
00111   
00112   /**
00113    * updates the position if the scenegraph nodes
00114    */
00115   virtual void update() = 0;
00116   
00117   /**
00118    * sets position of the obstacle and creates/recreates obstacle if necessary
00119    */
00120   virtual void setPosition(const osg::Vec3& pos);
00121 
00122   /**
00123    * gives actual position of the obstacle
00124    */
00125   virtual osg::Vec3 getPosition();
00126 
00127   /**
00128    * gives actual pose of the obstacle
00129    */
00130   virtual osg::Matrix getPose();
00131 
00132   /**
00133    * sets position of the obstacle and creates/recreates obstacle if necessary
00134    */
00135   virtual void setPose(const osg::Matrix& pose) = 0;
00136 
00137   /**
00138    * sets the obstacle color
00139    * @param color values in RGBA
00140    */
00141   virtual void setColor(const Color& color);
00142 
00143   virtual Primitive* getMainPrimitive() const = 0;
00144 
00145  protected:
00146   osg::Matrix pose;
00147   bool obstacle_exists;
00148 
00149   OdeHandle odeHandle;
00150   OsgHandle osgHandle; 
00151 
00152   virtual void destroy()=0;
00153 
00154   virtual void create()=0;
00155 
00156 };
00157 
00158 }
00159 
00160 #endif

Generated on Mon Aug 7 16:40:14 2006 for Robotsystem of the Robot Group Leipzig by  doxygen 1.4.7