Robotsystem of the Robot Group Leipzig: raysensor.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

- 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.9  2007/09/06 18:48:29  martius
    00024  *   clone function (a bit like a factory)
    00025  *
    00026  *   Revision 1.8  2007/08/23 15:39:05  martius
    00027  *   new IR sensor schema which uses substances and callbacks, very nice
    00028  *
    00029  *   Revision 1.7  2006/09/20 12:56:28  martius
    00030  *   setRange
    00031  *
    00032  *   Revision 1.6  2006/08/28 12:18:31  martius
    00033  *   documentation
    00034  *
    00035  *   Revision 1.5  2006/08/08 17:03:27  martius
    00036  *   new sensors model
    00037  *
    00038  *   Revision 1.4  2006/07/14 12:23:43  martius
    00039  *   selforg becomes HEAD
    00040  *
    00041  *   Revision 1.3.4.3  2006/01/31 15:46:16  martius
    00042  *   virtual destructor
    00043  *
    00044  *   Revision 1.3.4.2  2005/12/13 18:11:53  martius
    00045  *   sensors ported, but not yet finished
    00046  *
    00047  *   Revision 1.3.4.1  2005/11/14 17:37:21  martius
    00048  *   moved to selforg
    00049  *
    00050  *   Revision 1.3  2005/09/27 13:59:26  martius
    00051  *   ir sensors are working now
    00052  *
    00053  *   Revision 1.2  2005/09/27 11:03:34  fhesse
    00054  *   sensorbank added
    00055  *
    00056  *   Revision 1.1  2005/09/22 12:56:47  martius
    00057  *   ray based sensors
    00058  *
    00059  *                                                                         *
    00060  ***************************************************************************/
    00061 #ifndef __RAYSENSOR_H
    00062 #define __RAYSENSOR_H
    00063
    00064 #include <ode/common.h>
    00065 #include "osgforwarddecl.h"
    00066 #include "odehandle.h"
    00067 #include "osghandle.h"
    00068
    00069
    00070 namespace lpzrobots {
    00071   class Primitive;
    00072
    00073 /** Abstract class for Ray-based sensors.
    00074     This are sensors which are based on distance measurements using the ODE geom class Ray.
    00075     The sensor value is obtained by collisions.
    00076     However of no collision is detected the sensor needs to ajust its output as well.
    00077     Therefore a reset function is provided.
    00078     See also RaySensorBank, which is an object for managing multiple ray sensors.
    00079  */
    00080 class RaySensor {
    00081 public:
    00082   enum rayDrawMode { drawNothing, drawRay, drawSensor, drawAll};
    00083
    00084   RaySensor() {}
    00085   virtual ~RaySensor(){}
    00086
    00087   // should create a copy if this, without initialisation
    00088   virtual RaySensor* clone() const = 0;
    00089
    00090   /** providing essential information
    00091       @param odeHandle OdeHandle
    00092       @param osgHandle OsgHandle
    00093       @param body primitive to which the sensor will be attached
    00094       @param pose relative pose in respect to body in which the sensor will be placed
    00095       @param range length of the sensor
    00096       @param drawMode whether to draw nothing, sensor body, ray, or both
    00097    */
    00098   virtual void init(const OdeHandle& odeHandle,
    00099                     const OsgHandle& osgHandle, Primitive* body,
    00100                     const osg::Matrix pose, float range,
    00101                     rayDrawMode drawMode = drawSensor) = 0;
    00102
    00103   /** used for reseting the sensor value to a value of maximal distance.
    00104    */
    00105   virtual void reset() = 0;
    00106
    00107   /** returns the sensor value (usually in the range [-1,1] )
    00108    */
    00109   virtual double get() = 0;
    00110
    00111   /** set the range of the sensor
    00112       @param range new length of the sensor
    00113   */
    00114   virtual void setRange(float range) = 0;
    00115
    00116   /** updates the position of the osg nodes
    00117    */
    00118   virtual void update() = 0;
    00119
    00120 };
    00121
    00122 }
    00123
    00124 #endif