Robot Simulator of the Robotics Group for Self-Organization of Control: speedsensor.h Source File

# speedsensor.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  *   Copyright (C) 2005-2011 LpzRobots development team                    *
    00003  *    Georg Martius  <georg dot martius at web dot de>                     *
    00004  *    Frank Guettler <guettler at informatik dot uni-leipzig dot de        *
    00005  *    Frank Hesse    <frank at nld dot ds dot mpg dot de>                  *
    00006  *    Ralf Der       <ralfder at mis dot mpg dot 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  ***************************************************************************/
    00024 #ifndef __SPEEDSENSOR_H
    00025 #define __SPEEDSENSOR_H
    00026
    00027 #include "sensor.h"
    00028
    00029 namespace lpzrobots {
    00030
    00031   /** Class for speed sensing of robots.
    00032       The sensor values are normalised speeds, either translational or rotational
    00033   */
    00034   class SpeedSensor : public Sensor {
    00035   public:
    00036
    00037     /// Sensor mode
    00038     enum Mode { Translational,     ///< measures translational speed in world coordinates (Linear velocity)
    00039                 TranslationalRel,  ///< measures translational speed in body coordinates (Linear velocity)
    00040                 Rotational,        ///< measures roational velocity around the world axis
    00041                 RotationalRel      ///< measures roational velocity around the body axis
    00042     };
    00043
    00044     /**
    00045        @param maxSpeed maximal speed that is expected used for normalisation of sensor value
    00046        @param dimensions bit mask for the dimensions to sense. Default: X | Y | Z (all dimensions)
    00047        @see Dimensions
    00048      */
    00049     SpeedSensor(double maxSpeed, Mode mode = Translational, short dimensions = X | Y | Z );
    00050     virtual ~SpeedSensor() {}
    00051
    00052     virtual void init(Primitive* own);
    00053     virtual int getSensorNumber() const;
    00054
    00055     virtual bool sense(const GlobalData& globaldata);
    00056     virtual std::list<sensor> get() const;
    00057     virtual int get(sensor* sensors, int length) const;
    00058   protected:
    00059     matrix::Matrix getSenseMatrix() const;
    00060
    00061   protected:
    00062     double maxSpeed;
    00063     Mode mode;
    00064     short dimensions;
    00065     Primitive* own;
    00066   };
    00067
    00068
    00069 }
    00070
    00071 #endif