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 __AXISORIENTATIONSENSOR_H 00025 #define __AXISORIENTATIONSENSOR_H 00026 00027 #include "sensor.h" 00028 00029 namespace lpzrobots { 00030 00031 /** Class for sensing the axis orienation of a primitive (robot) 00032 */ 00033 class AxisOrientationSensor : public Sensor { 00034 public: 00035 /// Sensor mode 00036 enum Mode { /** Z axis (of robot) in word coordinates (relative to body center) 00037 (Dimensions select components of this vector) */ 00038 OnlyZAxis, 00039 ZProjection, ///< z-component of each axis (Dimension select components of this vector) 00040 Axis ///< for each dimension one orienation vector, i.e. for X | Y | Z it is a 3x3 rotation matrix 00041 }; 00042 00043 /** 00044 @param mode how to measure the axis orientation 00045 @param dimensions bit mask for the dimensions to sense. Default: X | Y | Z (all dimensions) 00046 @see Sensor::Dimensions 00047 @see Mode 00048 */ 00049 AxisOrientationSensor(Mode mode, short dimensions = X | Y | Z ); 00050 virtual ~AxisOrientationSensor() {} 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 00059 private: 00060 Mode mode; 00061 short dimensions; 00062 Primitive* own; 00063 }; 00064 00065 00066 } 00067 00068 #endif