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 * frankguettler@gmx.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 * $Log: wheelie.h,v $ 00024 * Revision 1.4 2007/01/26 12:05:05 martius 00025 * servos combinied into OneAxisServo 00026 * 00027 * Revision 1.3 2006/07/20 17:19:45 martius 00028 * removed using namespace std from matrix.h 00029 * 00030 * Revision 1.2 2006/07/14 12:23:43 martius 00031 * selforg becomes HEAD 00032 * 00033 * Revision 1.1.2.3 2006/06/25 16:57:17 martius 00034 * abstractrobot is configureable 00035 * name and revision 00036 * 00037 * Revision 1.1.2.2 2006/06/20 07:18:29 robot3 00038 * -added cvs log 00039 * -changed some behaviour of wheelie 00040 * 00041 * * 00042 ***************************************************************************/ 00043 #ifndef __WHEELIE_H 00044 #define __WHEELIE_H 00045 00046 #include "defaultWheelie.h" 00047 #include "oneaxisservo.h" 00048 00049 namespace lpzrobots { 00050 00051 /** 00052 * This is a class, which models an annular robot. 00053 * It consists of a number of equal elements, each linked 00054 * by a joint powered by 1 servo 00055 **/ 00056 class Wheelie : public DefaultWheelie 00057 { 00058 private: 00059 std::vector <HingeServo*> hingeServos; 00060 00061 public: 00062 Wheelie(const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00063 const WheelieConf& conf, const std::string& name); 00064 00065 virtual ~Wheelie(); 00066 00067 /** 00068 *Reads the actual motor commands from an array, 00069 *an sets all motors of the snake to this values. 00070 *It is an linear allocation. 00071 *@param motors pointer to the array, motor values are scaled to [-1,1] 00072 *@param motornumber length of the motor array 00073 **/ 00074 virtual void setMotors ( const motor* motors, int motornumber ); 00075 00076 /** 00077 *Writes the sensor values to an array in the memory. 00078 *@param sensors pointer to the array 00079 *@param sensornumber length of the sensor array 00080 *@return number of actually written sensors 00081 **/ 00082 virtual int getSensors ( sensor* sensors, int sensornumber ); 00083 00084 /** returns number of sensors 00085 */ 00086 virtual int getSensorNumber() { assert(created); return hingeServos.size(); } 00087 00088 /** returns number of motors 00089 */ 00090 virtual int getMotorNumber(){ assert(created); return hingeServos.size(); } 00091 00092 virtual bool setParam(const paramkey& key, paramval val); 00093 00094 private: 00095 virtual void create(const osg::Matrix& pose); 00096 virtual void destroy(); 00097 }; 00098 00099 } 00100 00101 #endif