sphererobot3masses.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 inspired by Julius Popp. * 00025 * * 00026 * $Log: sphererobot3masses.h,v $ 00027 * Revision 1.9 2006/12/21 11:43:05 martius 00028 * commenting style for doxygen //< -> ///< 00029 * new sensors for spherical robots 00030 * 00031 * Revision 1.8 2006/12/01 16:20:40 martius 00032 * *** empty log message *** 00033 * 00034 * Revision 1.7 2006/11/17 13:44:43 martius 00035 * corrected z-axes sensor problem 00036 * there are two sensors for this situation 00037 * 00038 * Revision 1.6 2006/09/21 22:09:58 martius 00039 * collision for mesh 00040 * 00041 * Revision 1.5 2006/09/21 16:17:18 der 00042 * *** empty log message *** 00043 * 00044 * Revision 1.4 2006/08/04 15:07:27 martius 00045 * documentation 00046 * 00047 * Revision 1.3 2006/07/20 17:19:45 martius 00048 * removed using namespace std from matrix.h 00049 * 00050 * Revision 1.2 2006/07/14 12:23:42 martius 00051 * selforg becomes HEAD 00052 * 00053 * Revision 1.1.2.4 2006/06/25 16:57:17 martius 00054 * abstractrobot is configureable 00055 * name and revision 00056 * 00057 * Revision 1.1.2.3 2006/03/30 12:34:57 martius 00058 * documentation updated 00059 * 00060 * Revision 1.1.2.2 2006/01/10 17:15:44 martius 00061 * removed wrong comment 00062 * 00063 * Revision 1.1.2.1 2006/01/10 17:15:16 martius 00064 * was sphererobotarms 00065 * moved to osg 00066 * 00067 * Revision 1.10.4.3 2005/11/16 11:26:53 martius 00068 * moved to selforg 00069 * 00070 * Revision 1.10.4.2 2005/11/15 12:29:27 martius 00071 * new selforg structure and OdeAgent, OdeRobot ... 00072 * 00073 * Revision 1.10.4.1 2005/11/14 17:37:18 martius 00074 * moved to selforg 00075 * 00076 * Revision 1.10 2005/11/09 13:27:07 martius 00077 * irsensorrange 00078 * 00079 * Revision 1.9 2005/11/07 17:04:56 martius 00080 * irsensorscale added 00081 * 00082 * Revision 1.8 2005/11/04 14:45:18 martius 00083 * GPL added 00084 * 00085 * * 00086 ***************************************************************************/ 00087 00088 #ifndef __SPHEREROBOT3MASSES_H 00089 #define __SPHEREROBOT3MASSES_H 00090 00091 #include "primitive.h" 00092 #include "joint.h" 00093 #include "sliderservo.h" 00094 #include "oderobot.h" 00095 #include "sensor.h" 00096 #include "raysensorbank.h" 00097 00098 namespace lpzrobots { 00099 00100 /// configuration object for the Sphererobot3Masses robot. 00101 typedef struct { 00102 public: 00103 double diameter; 00104 double spheremass; 00105 double pendulardiameter; ///< automatically set 00106 double pendularmass; 00107 double pendularrange; 00108 bool motorsensor; ///< motor values as sensors 00109 bool irAxis1; 00110 bool irAxis2; 00111 bool irAxis3; 00112 bool drawIRs; 00113 double irsensorscale; ///< range of the ir sensors in units of diameter 00114 double irCharacter; ///< characteristics of sensor (\f[ x^c \f] where x is the range-distance) 00115 00116 /// function that deletes sensors 00117 void destroy(); 00118 /// list of sensors that are mounted at the robot. (e.g.\ AxisOrientationSensor) 00119 std::list<Sensor*> sensors; 00120 /// adds a sensor to the list of sensors 00121 void addSensor(Sensor* s) { sensors.push_back(s); } 00122 } Sphererobot3MassesConf; 00123 00124 /** 00125 A spherical robot with 3 internal masses, which can slide on their orthogonal axes. 00126 This robot was inspired by Julius Popp (http://sphericalrobots.com) 00127 */ 00128 class Sphererobot3Masses : public OdeRobot 00129 { 00130 public: 00131 /// enum for the objects of the robot 00132 typedef enum objects { Base, Pendular1, Pendular2, Pendular3, Last } ; 00133 00134 protected: 00135 static const int servono=3; 00136 unsigned int numberaxis; 00137 00138 Primitive* object[Last]; 00139 SliderServo* servo[servono]; 00140 SliderJoint* joint[servono]; 00141 OSGPrimitive* axis[servono]; 00142 00143 Sphererobot3MassesConf conf; 00144 RaySensorBank irSensorBank; ///< a collection of ir sensors 00145 double transparency; 00146 bool created; 00147 00148 public: 00149 00150 /** 00151 *constructor 00152 **/ 00153 Sphererobot3Masses ( const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00154 const Sphererobot3MassesConf& conf, const std::string& name, double transparency=0.5 ); 00155 00156 protected: 00157 /** 00158 *constructor for children 00159 **/ 00160 Sphererobot3Masses ( const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00161 const Sphererobot3MassesConf& conf, 00162 const std::string& name, const std::string& revision, double transparency); 00163 /// initialises some internal variables 00164 void init(); 00165 public: 00166 virtual ~Sphererobot3Masses(); 00167 00168 00169 /// default configuration 00170 static Sphererobot3MassesConf getDefaultConf(){ 00171 Sphererobot3MassesConf c; 00172 c.diameter = 1; 00173 c.spheremass = .3;// 0.1 00174 c.pendularmass = 1.0; 00175 c.pendularrange = 0.25; // range of the slider from center in multiple of diameter [-range,range] 00176 c.motorsensor = false; 00177 c.irAxis1=false; 00178 c.irAxis2=false; 00179 c.irAxis3=false; 00180 c.drawIRs=true; 00181 c.irsensorscale=1.5; 00182 c.irCharacter=1; 00183 return c; 00184 } 00185 00186 virtual void update(); 00187 00188 virtual void place(const osg::Matrix& pose); 00189 00190 virtual bool collisionCallback(void *data, dGeomID o1, dGeomID o2); 00191 00192 virtual void doInternalStuff(const GlobalData& globalData); 00193 00194 virtual int getSensors ( sensor* sensors, int sensornumber ); 00195 00196 virtual void setMotors ( const motor* motors, int motornumber ); 00197 00198 virtual int getMotorNumber(); 00199 00200 virtual int getSensorNumber(); 00201 00202 00203 /** the main object of the robot, which is used for position and speed tracking */ 00204 virtual Primitive* getMainPrimitive() const { return object[Base]; } 00205 00206 protected: 00207 00208 virtual void create(const osg::Matrix& pose); 00209 virtual void destroy(); 00210 00211 00212 }; 00213 00214 } 00215 00216 #endif

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