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: axisorientationsensor.h,v $ 00026 * Revision 1.5 2009/01/20 17:29:52 martius 00027 * cvs commit 00028 * 00029 * Revision 1.4 2006/12/21 11:42:10 martius 00030 * sensors have dimension to sense 00031 * axissensors have finer settings 00032 * 00033 * Revision 1.3 2006/12/11 18:25:08 martius 00034 * memory freed 00035 * 00036 * Revision 1.2 2006/08/11 15:45:38 martius 00037 * *** empty log message *** 00038 * 00039 * Revision 1.1 2006/08/08 17:03:27 martius 00040 * new sensors model 00041 * 00042 * * 00043 ***************************************************************************/ 00044 #ifndef __AXISORIENTATIONSENSOR_H 00045 #define __AXISORIENTATIONSENSOR_H 00046 00047 #include "sensor.h" 00048 00049 namespace lpzrobots { 00050 00051 /** Class for sensing the axis orienation of a primitive (robot) 00052 */ 00053 class AxisOrientationSensor : public Sensor { 00054 public: 00055 /// Sensor mode 00056 enum Mode { /** Z axis (of robot) in word coordinates (relative to body center) 00057 (Dimensions select components of this vector) */ 00058 OnlyZAxis, 00059 ZProjection, ///< z-component of each axis (Dimension select components of this vector) 00060 Axis ///< for each dimension one orienation vector, i.e. for X | Y | Z it is a 3x3 rotation matrix 00061 }; 00062 00063 /** 00064 @param mode how to measure the axis orientation 00065 @param dimensions bit mask for the dimensions to sense. Default: X | Y | Z (all dimensions) 00066 @see Sensor::Dimensions 00067 @see Mode 00068 */ 00069 AxisOrientationSensor(Mode mode, short dimensions = X | Y | Z ); 00070 virtual ~AxisOrientationSensor() {} 00071 00072 virtual void init(Primitive* own); 00073 virtual int getSensorNumber() const; 00074 00075 virtual bool sense(const GlobalData& globaldata); 00076 virtual std::list<sensor> get() const; 00077 virtual int get(sensor* sensors, int length) const; 00078 00079 private: 00080 Mode mode; 00081 short dimensions; 00082 Primitive* own; 00083 }; 00084 00085 00086 } 00087 00088 #endif