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 * $Log: abstractrobot.h,v $ 00023 * Revision 1.1.2.1 2005/11/14 17:37:56 martius 00024 * moved to selforg 00025 * 00026 * Revision 1.11 2005/10/06 17:14:24 martius 00027 * switched to stl lists 00028 * 00029 * Revision 1.10 2005/09/22 12:24:36 martius 00030 * removed global variables 00031 * OdeHandle and GlobalData are used instead 00032 * sensor prepared 00033 * 00034 * Revision 1.9 2005/09/22 07:30:53 martius 00035 * moved color and position into extra modules 00036 * 00037 * Revision 1.8 2005/09/12 00:10:44 martius 00038 * position operators are const 00039 * 00040 * Revision 1.7 2005/08/30 16:53:53 martius 00041 * Position struct has toArray and operators 00042 * 00043 * Revision 1.6 2005/08/29 06:40:35 martius 00044 * added virtual destructor 00045 * 00046 * Revision 1.5 2005/08/22 20:32:45 martius 00047 * robot has a name 00048 * 00049 * Revision 1.4 2005/07/27 13:22:16 martius 00050 * position and color have constructors 00051 * ODEHandle 00052 * 00053 * Revision 1.3 2005/07/18 14:47:41 martius 00054 * world, space, contactgroup are not pointers anymore. 00055 * 00056 * Revision 1.2 2005/07/07 09:27:11 martius 00057 * isGeomInObjectList added 00058 * 00059 * Revision 1.1 2005/06/15 14:20:04 martius 00060 * moved into robots 00061 * * 00062 ***************************************************************************/ 00063 #ifndef __ABSTRACTROBOT_H 00064 #define __ABSTRACTROBOT_H 00065 00066 #include <vector> 00067 using namespace std; 00068 00069 #include "trackable.h" 00070 #include "position.h" 00071 #include "types.h" 00072 00073 /** 00074 * Abstract class (interface) for robot in general 00075 * 00076 * 00077 */ 00078 class AbstractRobot : public Trackable { 00079 public: 00080 00081 /** 00082 * Constructor 00083 * @param name name of the robot 00084 */ 00085 AbstractRobot(const char* name="abstractRobot") 00086 : name(name) { 00087 }; 00088 00089 virtual ~AbstractRobot(){} 00090 00091 /// returns the name of the robot 00092 string getName() const { return name;} 00093 00094 /** returns actual sensorvalues 00095 @param sensors sensors scaled to [-1,1] 00096 @param sensornumber length of the sensor array 00097 @return number of actually written sensors 00098 */ 00099 virtual int getSensors(sensor* sensors, int sensornumber)=0; 00100 00101 /** sets actual motorcommands 00102 @param motors motors scaled to [-1,1] 00103 @param motornumber length of the motor array 00104 */ 00105 virtual void setMotors(const motor* motors, int motornumber)=0; 00106 00107 /** returns number of sensors 00108 */ 00109 virtual int getSensorNumber()=0; 00110 00111 /** returns number of motors 00112 */ 00113 virtual int getMotorNumber()=0; 00114 00115 00116 protected: 00117 /// sets the name of the robot (only for child classes) 00118 void setName(const char* name) { this->name = name; } 00119 00120 protected: 00121 string name; 00122 }; 00123 00124 #endif 00125