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