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  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  *                                                                         *
00022  *   $Log: abstractobstacle.h,v $
00023  *   Revision 1.8.4.4  2006/03/30 12:34:51  martius
00024  *   documentation updated
00025  *
00026  *   Revision 1.8.4.3  2006/03/29 15:04:38  martius
00027  *   have pose now
00028  *
00029  *   Revision 1.8.4.2  2005/12/06 10:13:23  martius
00030  *   openscenegraph integration started
00031  *
00032  *   Revision 1.8.4.1  2005/11/14 17:37:14  martius
00033  *   moved to selforg
00034  *
00035  *   Revision 1.8  2005/10/25 19:26:56  fhesse
00036  *   comments adjusted and in doxygen style
00037  *
00038  *   Revision 1.7  2005/09/22 12:24:36  martius
00039  *   removed global variables
00040  *   OdeHandle and GlobalData are used instead
00041  *   sensor prepared
00042  *
00043  *   Revision 1.6  2005/09/13 13:20:12  martius
00044  *   initialised color
00045  *
00046  *   Revision 1.5  2005/08/29 06:32:25  martius
00047  *   added virtual destructor
00048  *
00049  *   Revision 1.4  2005/07/18 14:52:33  martius
00050  *   world and space are not pointers anymore.
00051  *
00052  *   Revision 1.3  2005/06/15 14:22:11  martius
00053  *   GPL included
00054  *                                                                 *
00055  ***************************************************************************/
00056 #ifndef __ABSTRACTOBSTACLE_H
00057 #define __ABSTRACTOBSTACLE_H
00058 
00059 #include <ode/ode.h>
00060 
00061 #include "odehandle.h"
00062 #include "osghandle.h"
00063 
00064 namespace lpzrobots {
00065 
00066 /**
00067  *  Abstract class (interface) for obstacles
00068  */
00069 class AbstractObstacle{
00070 
00071  public:
00072   /**
00073    * Constructor
00074    * @param odeHandle containing ODE stuff like world, space and jointgroup
00075    * @param osgHandle containing OSG stuff like scene, color...
00076    * be used for creation of obstacles
00077    */
00078   AbstractObstacle(const OdeHandle& odeHandle, const OsgHandle& osgHandle)
00079     : odeHandle(odeHandle), osgHandle(osgHandle) {
00080   };
00081 
00082   virtual ~AbstractObstacle(){}
00083   
00084   /**
00085    * updates the position if the scenegraph nodes
00086    */
00087   virtual void update() = 0;
00088   
00089   /**
00090    * sets position of the obstacle and creates/recreates obstacle if necessary
00091    */
00092   void setPosition(const osg::Vec3& pos){
00093     pose.setTrans(pos);
00094     setPose(pose);
00095   };
00096 
00097   /**
00098    * gives actual position of the obstacle
00099    */
00100   osg::Vec3 getPosition(){
00101     return pose.getTrans();
00102   }
00103 
00104   /**
00105    * sets position of the obstacle and creates/recreates obstacle if necessary
00106    */
00107   virtual void setPose(const osg::Matrix& pose) = 0;
00108 
00109   /**
00110    * gives actual pose of the obstacle
00111    */
00112   virtual osg::Matrix getPose() = 0;
00113     
00114   /**
00115    * sets the obstacle color
00116    * @param color values in RGBA
00117    */
00118   virtual void setColor(const Color& color) {
00119     osgHandle.color = color;
00120   };
00121 
00122  protected:
00123   osg::Matrix pose;
00124 
00125   OdeHandle odeHandle;
00126   OsgHandle osgHandle; 
00127 
00128 };
00129 
00130 }
00131 
00132 #endif

Generated on Tue Apr 4 19:05:03 2006 for Robotsystem from Robot Group Leipzig by  doxygen 1.4.5