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: speedsensor.h,v $ 00026 * Revision 1.2 2007/06/08 15:37:22 martius 00027 * random seed into OdeConfig -> logfiles 00028 * 00029 * Revision 1.1 2006/12/21 11:41:12 martius 00030 * sensor from measuring speed 00031 * 00032 * * 00033 ***************************************************************************/ 00034 #ifndef __SPEEDSENSOR_H 00035 #define __SPEEDSENSOR_H 00036 00037 #include "sensor.h" 00038 00039 namespace lpzrobots { 00040 00041 /** Class for speed sensing of robots. 00042 The sensor values are normalised speeds, either translational or rotational 00043 */ 00044 class SpeedSensor : public Sensor { 00045 public: 00046 00047 /// Sensor mode 00048 enum Mode { Translational, ///< measures translational speed in world coordinates (Linear velocity) 00049 TranslationalRel, ///< measures translational speed in body coordinates (Linear velocity) 00050 Rotational, ///< measures roational velocity around the world axis 00051 RotationalRel ///< measures roational velocity around the body axis 00052 }; 00053 00054 /** 00055 @param maxSpeed maximal speed that is expected used for normalisation of sensor value 00056 @param dimensions bit mask for the dimensions to sense. Default: X | Y | Z (all dimensions) 00057 @see Dimensions 00058 */ 00059 SpeedSensor(double maxSpeed, Mode mode = Translational, short dimensions = X | Y | Z ); 00060 virtual ~SpeedSensor() {} 00061 00062 virtual void init(Primitive* own); 00063 virtual int getSensorNumber() const; 00064 00065 virtual bool sense(const GlobalData& globaldata); 00066 virtual std::list<sensor> get() const; 00067 virtual int get(sensor* sensors, int length) const; 00068 protected: 00069 matrix::Matrix getSenseMatrix() const; 00070 00071 protected: 00072 double maxSpeed; 00073 Mode mode; 00074 short dimensions; 00075 Primitive* own; 00076 }; 00077 00078 00079 } 00080 00081 #endif