relativepositionsensor.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  *                                                                         *
00023  *  DESCRIPTION                                                            *
00024  *                                                                         *
00025  *   $Log: relativepositionsensor.h,v $
00026  *   Revision 1.2  2006/12/21 11:42:10  martius
00027  *   sensors have dimension to sense
00028  *   axissensors have finer settings
00029  *
00030  *   Revision 1.1  2006/08/08 17:03:27  martius
00031  *   new sensors model
00032  *
00033  *                                                                 *
00034  ***************************************************************************/
00035 #ifndef __RELATIVEPOSITIONSENSOR_H
00036 #define __RELATIVEPOSITIONSENSOR_H
00037 
00038 #include "sensor.h"
00039 
00040 namespace lpzrobots {
00041 
00042   /** Class for relative position sensing. 
00043       The sensor values are the normalised relative position to some given object ( setReference() )
00044   */
00045   class RelativePositionSensor : public Sensor {
00046   public:  
00047     /**
00048        @param maxDistance maximal distance that is expected used for normalisation of sensor value
00049        @param exponent exponent of the sensor characteritic (default: 1 (linear))
00050        @param dimensions bit mask for the dimensions to sense. Default: X | Y | Z (all dimensions)
00051        @see Dimensions
00052      */
00053     RelativePositionSensor(double maxDistance, double exponent, short dimensions = X | Y | Z );
00054     virtual ~RelativePositionSensor() {}
00055   
00056     virtual void init(Primitive* own);  
00057     virtual int getSensorNumber() const;
00058   
00059     virtual bool sense(const GlobalData& globaldata);
00060     virtual std::list<sensor> get() const;
00061     virtual int get(sensor* sensors, int length) const;
00062 
00063     /**
00064        Sets the reference object we use for relative position measureing.
00065        This can be another robot an obstacle (light source) and such like
00066        This must be called before first sense() or get() call.
00067     */
00068     virtual void setReference(Primitive* ref);
00069 
00070   private:
00071     double maxDistance;
00072     double exponent;
00073     short dimensions;
00074     Primitive* own;
00075     Primitive* ref;    
00076   };
00077 
00078 
00079 }
00080 
00081 #endif

Generated on Fri Oct 30 16:29:01 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7