Robotsystem from Robot Group Leipzig: raysensor.h Source File

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# raysensor.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: raysensor.h,v $
    00023  *   Revision 1.3.4.3  2006/01/31 15:46:16  martius
    00024  *   virtual destructor
    00025  *
    00026  *   Revision 1.3.4.2  2005/12/13 18:11:53  martius
    00027  *   sensors ported, but not yet finished
    00028  *
    00029  *   Revision 1.3.4.1  2005/11/14 17:37:21  martius
    00030  *   moved to selforg
    00031  *
    00032  *   Revision 1.3  2005/09/27 13:59:26  martius
    00033  *   ir sensors are working now
    00034  *
    00035  *   Revision 1.2  2005/09/27 11:03:34  fhesse
    00036  *   sensorbank added
    00037  *
    00038  *   Revision 1.1  2005/09/22 12:56:47  martius
    00039  *   ray based sensors
    00040  *
    00041  *                                                                         *
    00042  ***************************************************************************/
    00043 #ifndef __RAYSENSOR_H
    00044 #define __RAYSENSOR_H
    00045
    00046 #include <ode/common.h>
    00047 #include "osgforwarddecl.h"
    00048 #include "odehandle.h"
    00049 #include "osghandle.h"
    00050
    00051
    00052 namespace lpzrobots {
    00053   class Primitive;
    00054
    00055 /** Abstract class for Ray-based sensors.
    00056     This are sensors which are based on distance measurements using the ODE geom class Ray.
    00057     The sensor value is obtained by collisions.
    00058     However of no collision is detected the sensor needs to ajust its output as well.
    00059     Therefore a reset function is provided.
    00060  */
    00061 class RaySensor {
    00062 public:
    00063   enum rayDrawMode { drawNothing, drawRay, drawSensor, drawAll};
    00064
    00065   RaySensor() {}
    00066   virtual ~RaySensor(){}
    00067
    00068   /** providing essential information
    00069    */
    00070   virtual void init(const OdeHandle& odeHandle,
    00071                     const OsgHandle& osgHandle, Primitive* body,
    00072                     const osg::Matrix pose, double range,
    00073                     rayDrawMode drawMode = drawSensor) = 0;
    00074
    00075   /** used for reseting the sensor value to a value of maximal distance.
    00076    */
    00077   virtual void reset() = 0;
    00078
    00079   /** performs sense action by checking collision with the given object
    00080       @return true for collision handled (sensed) and false for no interaction
    00081    */
    00082   virtual bool sense(dGeomID object) = 0;
    00083
    00084   /** returns the sensor value (usually in the range [-1,1] )
    00085    */
    00086   virtual double get() = 0;
    00087
    00088   /** updates the position of the osg nodes
    00089    */
    00090   virtual void update() = 0;
    00091
    00092   /** returns the geomID of the ray geom (used for optimisation)
    00093    */
    00094   virtual dGeomID getGeomID() =0;
    00095
    00096 };
    00097
    00098 }
    00099
    00100 #endif