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 * cylinder like Robot inspired by Julius Popp's Adam. * 00025 * * 00026 * $Log: barrel2masses2nd.h,v $ 00027 * Revision 1.2 2007/02/06 10:56:42 martius 00028 * oneaxisjoint 00029 * 00030 * Revision 1.1 2007/01/18 14:43:35 robot3 00031 * special variant for master thesis 00032 * 00033 * Revision 1.2 2006/12/21 11:43:05 martius 00034 * commenting style for doxygen //< -> ///< 00035 * new sensors for spherical robots 00036 * 00037 * Revision 1.1 2006/12/01 16:21:15 martius 00038 * like sphere3masses, but with 2 masses and cylindric body 00039 * 00040 * 00041 * * 00042 ***************************************************************************/ 00043 00044 #ifndef __BARREL2MASSES2ND_H 00045 #define __BARREL2MASSES2ND_H 00046 00047 #include "primitive.h" 00048 #include "joint.h" 00049 #include "oneaxisservo.h" 00050 #include "oderobot.h" 00051 #include "raysensorbank.h" 00052 #include "sphererobot3masses.h" 00053 00054 namespace lpzrobots { 00055 00056 /* 00057 parameters for nice rolling modes: 00058 00059 Sphererobot3MassesConf conf = Sphererobot3Masses::getDefaultConf(); 00060 conf.pendularrange = 0.3; 00061 conf.motorsensor=false; 00062 conf.axisZsensor=true; 00063 conf.axisXYZsensor=false; 00064 conf.spheremass = 1; 00065 sphere1 = new Barrel2Masses ( odeHandle, osgHandle.changeColor(Color(0.0,0.0,1.0)), 00066 conf, "Barrel1", 0.2); 00067 sphere1->place ( osg::Matrix::rotate(M_PI/2, 1,0,0)); 00068 00069 controller = new InvertMotorNStep(); 00070 controller->setParam("steps", 2); 00071 controller->setParam("adaptrate", 0.0); 00072 controller->setParam("epsC", 0.03); 00073 controller->setParam("epsA", 0.05); 00074 controller->setParam("rootE", 3); 00075 controller->setParam("logaE", 0); 00076 00077 One2OneWiring* wiring = new One2OneWiring ( new ColorUniformNoise() ); 00078 00079 */ 00080 00081 /** 00082 A barrel-like robot with 2 internal masses, which can slide on their orthogonal axes. 00083 It is the small brother of the Sphererobot3Masses. 00084 This robot was inspired by Julius Popp (http://sphericalrobots.com) 00085 */ 00086 class Barrel2Masses2nd : public Sphererobot3Masses 00087 { 00088 public: 00089 00090 /** 00091 * Constructor. It is configured with the configuration object of Sphererobot3Masses. 00092 Just two of the 3 axis are used. The worldZaxissensor and irAxis3 has no meaning here. 00093 **/ 00094 Barrel2Masses2nd ( const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00095 const Sphererobot3MassesConf& conf, const std::string& name, double transparency=0.5 ); 00096 00097 virtual ~Barrel2Masses2nd(); 00098 00099 /** default configuration. It has no sensors. 00100 Use addSensor(new AxisOrientationSensor(ZProjectionXY) for example.*/ 00101 static Sphererobot3MassesConf getDefaultConf(){ 00102 Sphererobot3MassesConf c; 00103 c.diameter = 1; 00104 c.spheremass = .3;// 0.1 00105 c.pendularmass = 1.0; 00106 c.pendularrange = 0.25; // range of the slider from center in multiple of diameter [-range,range] 00107 c.motorsensor = false; 00108 c.irAxis1=false; 00109 c.irAxis2=false; 00110 c.irAxis3=false; 00111 c.drawIRs=true; 00112 c.irsensorscale=1.5; 00113 c.irCharacter=1; 00114 return c; 00115 } 00116 00117 virtual int getSensors ( sensor* sensors, int sensornumber ); 00118 00119 protected: 00120 00121 /// The cylinder (main body) lies on the ground, that it is rotating about the z-axis 00122 virtual void create(const osg::Matrix& pose); 00123 00124 }; 00125 00126 } 00127 00128 #endif