oderobot.h

Go to the documentation of this file.
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: oderobot.h,v $ 00023 * Revision 1.4 2006/08/08 17:04:46 martius 00024 * added new sensor model 00025 * 00026 * Revision 1.3 2006/07/20 17:19:44 martius 00027 * removed using namespace std from matrix.h 00028 * 00029 * Revision 1.2 2006/07/14 12:23:41 martius 00030 * selforg becomes HEAD 00031 * 00032 * Revision 1.1.2.17 2006/06/25 16:57:14 martius 00033 * abstractrobot is configureable 00034 * name and revision 00035 * 00036 * Revision 1.1.2.16 2006/06/12 12:59:07 robot8 00037 * -some corrections to component system (for example now connections are only pushed as pointers to the connection vector) 00038 * -created the evolution simulation for evolutionary evolution algorithms with atom like structures 00039 * 00040 * Revision 1.1.2.15 2006/03/30 12:34:56 martius 00041 * documentation updated 00042 * 00043 * Revision 1.1.2.14 2006/03/30 09:59:36 fhesse 00044 * getOsgHandle() removed 00045 * friend class OdeAgent added 00046 * 00047 * Revision 1.1.2.13 2006/03/30 09:37:05 fhesse 00048 * getOsgHandle added 00049 * 00050 * Revision 1.1.2.12 2006/03/29 15:08:42 martius 00051 * getMainPrimitive is public now 00052 * 00053 * Revision 1.1.2.11 2005/12/30 22:54:16 martius 00054 * collisioncallback must be implemented 00055 * 00056 * Revision 1.1.2.10 2005/12/14 15:37:09 martius 00057 * robots are working with osg 00058 * 00059 * Revision 1.1.2.9 2005/12/13 18:11:40 martius 00060 * still trying to port robots 00061 * 00062 * Revision 1.1.2.8 2005/12/13 12:31:46 martius 00063 * list version of isGeomInPrimitiveList 00064 * 00065 * Revision 1.1.2.7 2005/12/11 23:35:08 martius 00066 * *** empty log message *** 00067 * 00068 * Revision 1.1.2.6 2005/12/06 10:13:25 martius 00069 * openscenegraph integration started 00070 * 00071 * Revision 1.1.2.5 2005/11/24 16:20:54 fhesse 00072 * odeRto3x3RotationMatrix corrected 00073 * 00074 * Revision 1.1.2.4 2005/11/16 11:26:52 martius 00075 * moved to selforg 00076 * 00077 * Revision 1.1.2.3 2005/11/15 12:29:27 martius 00078 * new selforg structure and OdeAgent, OdeRobot ... 00079 * 00080 * Revision 1.1.2.2 2005/11/14 17:37:18 martius 00081 * moved to selforg 00082 * 00083 * Revision 1.1.2.1 2005/11/14 14:43:52 martius 00084 * moved from abstractrobot to oderobot 00085 * 00086 * Revision 1.11 2005/10/06 17:14:24 martius 00087 * switched to stl lists 00088 * 00089 * Revision 1.10 2005/09/22 12:24:36 martius 00090 * removed global variables 00091 * OdeHandle and GlobalData are used instead 00092 * sensor prepared 00093 * 00094 * Revision 1.9 2005/09/22 07:30:53 martius 00095 * moved color and position into extra modules 00096 * 00097 * Revision 1.8 2005/09/12 00:10:44 martius 00098 * position operators are const 00099 * 00100 * Revision 1.7 2005/08/30 16:53:53 martius 00101 * Position struct has toArray and operators 00102 * 00103 * Revision 1.6 2005/08/29 06:40:35 martius 00104 * added virtual destructor 00105 * 00106 * Revision 1.5 2005/08/22 20:32:45 martius 00107 * robot has a name 00108 * 00109 * Revision 1.4 2005/07/27 13:22:16 martius 00110 * position and color have constructors 00111 * ODEHandle 00112 * 00113 * Revision 1.3 2005/07/18 14:47:41 martius 00114 * world, space, contactgroup are not pointers anymore. 00115 * 00116 * Revision 1.2 2005/07/07 09:27:11 martius 00117 * isGeomInObjectList added 00118 * 00119 * Revision 1.1 2005/06/15 14:20:04 martius 00120 * moved into robots 00121 * * 00122 ***************************************************************************/ 00123 #ifndef __ODEROBOT_H 00124 #define __ODEROBOT_H 00125 00126 #include <vector> 00127 00128 #include <selforg/abstractrobot.h> 00129 #include "odehandle.h" 00130 #include "osghandle.h" 00131 #include "globaldata.h" 00132 #include "color.h" 00133 #include "pos.h" 00134 #include "osgforwarddecl.h" 00135 00136 namespace lpzrobots { 00137 00138 class Primitive; 00139 00140 /** 00141 * Abstract class for ODE robots 00142 * 00143 */ 00144 class OdeRobot : public AbstractRobot { 00145 public: 00146 00147 friend class OdeAgent; 00148 // friend class AtomOdeAgent; 00149 00150 /** 00151 * Constructor 00152 */ 00153 OdeRobot(const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00154 const std::string& name, const std::string& revision); 00155 00156 virtual ~OdeRobot(); 00157 00158 00159 /// update the OSG notes here 00160 virtual void update() = 0; 00161 00162 /** sets the vehicle to position pos 00163 @param pos desired position of the robot 00164 */ 00165 virtual void place(const Pos& pos); 00166 00167 /** sets the pose of the vehicle 00168 @param pose desired 4x4 pose matrix 00169 */ 00170 virtual void place(const osg::Matrix& pose) = 0; 00171 00172 /** checks for internal collisions and treats them. 00173 * In case of a treatment return true 00174 * (collision will be ignored by other objects and the default routine) 00175 * else false (collision is passed to other objects and (if not treated) to the default routine). 00176 */ 00177 virtual bool collisionCallback(void *data, dGeomID o1, dGeomID o2) = 0; 00178 00179 /** this function is called in each timestep. It should perform robot-internal checks, 00180 like space-internal collision detection, sensor resets/update etc. 00181 @param globalData structure that contains global data from the simulation environment 00182 */ 00183 virtual void doInternalStuff(const GlobalData& globalData) = 0; 00184 00185 /** sets color of the robot 00186 @param col Color struct with desired Color 00187 */ 00188 virtual void setColor(const Color& col); 00189 00190 /** returns position of the object 00191 @return vector of position (x,y,z) 00192 */ 00193 virtual Position getPosition() const; 00194 00195 /** returns linear speed vector of the object 00196 @return vector (vx,vy,vz) 00197 */ 00198 virtual Position getSpeed() const; 00199 /** returns the orientation of the object 00200 @return 3x3 rotation matrix 00201 */ 00202 virtual matrix::Matrix getOrientation() const ; 00203 00204 /** overload this in the robot implementation. 00205 If there is no object for some reason then return a null pointer 00206 @return main object of the robot (used for tracking) 00207 */ 00208 virtual Primitive* getMainPrimitive() const = 0; 00209 00210 protected: 00211 00212 static bool isGeomInPrimitiveList(Primitive** ps, int len, dGeomID geom); 00213 static bool isGeomInPrimitiveList(std::list<Primitive*> ps, dGeomID geom); 00214 00215 00216 protected: 00217 OdeHandle odeHandle; 00218 OsgHandle osgHandle; 00219 dSpaceID parentspace; 00220 }; 00221 00222 } 00223 00224 #endif 00225

Generated on Tue Jan 16 02:14:37 2007 for Robotsystem of the Robot Group Leipzig by doxygen 1.3.8