forcedsphere.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 *************************************************************************** 00023 * * 00024 * Spherical Robot magically driven * 00025 * * 00026 * $Log: forcedsphere.h,v $ 00027 * Revision 1.6 2006/12/21 11:43:05 martius 00028 * commenting style for doxygen //< -> ///< 00029 * new sensors for spherical robots 00030 * 00031 * Revision 1.5 2006/08/11 15:44:35 martius 00032 * has conf now and arbitrary sensors 00033 * 00034 * Revision 1.4 2006/08/08 17:04:46 martius 00035 * added new sensor model 00036 * 00037 * Revision 1.3 2006/07/14 12:23:40 martius 00038 * selforg becomes HEAD 00039 * 00040 * Revision 1.2.4.5 2006/03/30 12:34:56 martius 00041 * documentation updated 00042 * 00043 * Revision 1.2.4.4 2006/01/10 22:25:09 martius 00044 * moved to osg 00045 * 00046 * 00047 * * 00048 ***************************************************************************/ 00049 00050 #ifndef __FORCESSPHERE_H 00051 #define __FORCESSPHERE_H 00052 00053 #include "oderobot.h" 00054 #include "sensor.h" 00055 00056 namespace lpzrobots { 00057 00058 class Primitive; 00059 00060 class ForcedSphereConf { 00061 public: 00062 ForcedSphereConf(); 00063 ~ForcedSphereConf(); 00064 /// deletes sensors 00065 void destroy(); 00066 00067 double radius; //< radius of the sphere 00068 double max_force; ///< maximal force applied to the sphere 00069 /// bit mask for selecting the dimensions for the forces (see ForcedSphere::Dimensions) 00070 short drivenDimensions; 00071 /// list of sensors that are mounted at the robot. (e.g.\ AxisOrientationSensor) 00072 std::list<Sensor*> sensors; 00073 /// adds a sensor to the list of sensors 00074 void addSensor(Sensor* s) { sensors.push_back(s); } 00075 }; 00076 00077 class ForcedSphere : public OdeRobot 00078 { 00079 protected: 00080 Primitive* object[1]; 00081 bool created; 00082 ForcedSphereConf conf; 00083 00084 public: 00085 00086 enum Dimensions { X = 1, Y = 2, Z = 4 }; 00087 00088 /** 00089 * constructor 00090 * 00091 * use getDefaultConf() to obtain a configuration with default values, which can be altered 00092 * to personal needs. 00093 **/ 00094 ForcedSphere ( const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00095 const ForcedSphereConf& ForcedSphereConf, const std::string& name); 00096 00097 virtual ~ForcedSphere(); 00098 00099 static ForcedSphereConf getDefaultConf(){ 00100 ForcedSphereConf c; 00101 c.radius = 1; 00102 c.max_force = 1; 00103 c.drivenDimensions = X | Y; 00104 return c; 00105 } 00106 00107 virtual void update(); 00108 00109 virtual void place(const osg::Matrix& pose); 00110 00111 virtual bool collisionCallback(void *data, dGeomID o1, dGeomID o2); 00112 virtual void doInternalStuff(const GlobalData& globalData); 00113 00114 virtual int getSensors ( sensor* sensors, int sensornumber ); 00115 virtual void setMotors ( const motor* motors, int motornumber ); 00116 virtual int getMotorNumber(); 00117 virtual int getSensorNumber(); 00118 00119 virtual Primitive* getMainPrimitive() const { return object[0]; } 00120 00121 protected: 00122 00123 virtual void create(const osg::Matrix& pose); 00124 virtual void destroy(); 00125 00126 00127 }; 00128 00129 } 00130 00131 #endif

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