00001 /*************************************************************************** 00002 * Copyright (C) 2005-2011 LpzRobots development team * 00003 * Georg Martius <georg dot martius at web dot de> * 00004 * Frank Guettler <guettler at informatik dot uni-leipzig dot de * 00005 * Frank Hesse <frank at nld dot ds dot mpg dot de> * 00006 * Ralf Der <ralfder at mis dot mpg dot de> * 00007 * * 00008 * This program is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU General Public License as published by * 00010 * the Free Software Foundation; either version 2 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This program is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this program; if not, write to the * 00020 * Free Software Foundation, Inc., * 00021 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00022 * * 00023 ***************************************************************************/ 00024 00025 #ifndef __BARREL2MASSES2ND_H 00026 #define __BARREL2MASSES2ND_H 00027 00028 #include "primitive.h" 00029 #include "joint.h" 00030 #include "oneaxisservo.h" 00031 #include "oderobot.h" 00032 #include "raysensorbank.h" 00033 #include "sphererobot3masses.h" 00034 00035 namespace lpzrobots { 00036 00037 /* 00038 parameters for nice rolling modes: 00039 00040 Sphererobot3MassesConf conf = Sphererobot3Masses::getDefaultConf(); 00041 conf.pendularrange = 0.3; 00042 conf.motorsensor=false; 00043 conf.axisZsensor=true; 00044 conf.axisXYZsensor=false; 00045 conf.spheremass = 1; 00046 sphere1 = new Barrel2Masses ( odeHandle, osgHandle.changeColor(Color(0.0,0.0,1.0)), 00047 conf, "Barrel1", 0.2); 00048 sphere1->place ( osg::Matrix::rotate(M_PI/2, 1,0,0)); 00049 00050 controller = new InvertMotorNStep(); 00051 controller->setParam("steps", 2); 00052 controller->setParam("adaptrate", 0.0); 00053 controller->setParam("epsC", 0.03); 00054 controller->setParam("epsA", 0.05); 00055 controller->setParam("rootE", 3); 00056 controller->setParam("logaE", 0); 00057 00058 One2OneWiring* wiring = new One2OneWiring ( new ColorUniformNoise() ); 00059 00060 */ 00061 00062 /** 00063 A barrel-like robot with 2 internal masses, which can slide on their orthogonal axes. 00064 It is the small brother of the Sphererobot3Masses. 00065 This robot was inspired by Julius Popp (http://sphericalrobots.com) 00066 */ 00067 class Barrel2Masses2nd : public Sphererobot3Masses 00068 { 00069 public: 00070 00071 /** 00072 * Constructor. It is configured with the configuration object of Sphererobot3Masses. 00073 Just two of the 3 axis are used. The worldZaxissensor and irAxis3 has no meaning here. 00074 **/ 00075 Barrel2Masses2nd ( const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00076 const Sphererobot3MassesConf& conf, const std::string& name, double transparency=0.5 ); 00077 00078 virtual ~Barrel2Masses2nd(); 00079 00080 /** default configuration. It has no sensors. 00081 Use addSensor(new AxisOrientationSensor(ZProjectionXY) for example.*/ 00082 static Sphererobot3MassesConf getDefaultConf(){ 00083 Sphererobot3MassesConf c; 00084 c.diameter = 1; 00085 c.spheremass = .3;// 0.1 00086 c.pendularmass = 1.0; 00087 c.pendularrange = 0.25; // range of the slider from center in multiple of diameter [-range,range] 00088 c.motorsensor = false; 00089 c.irAxis1=false; 00090 c.irAxis2=false; 00091 c.irAxis3=false; 00092 c.drawIRs=RaySensor::drawAll; 00093 c.irsensorscale=1.5; 00094 c.irCharacter=1; 00095 return c; 00096 } 00097 00098 virtual int getSensors ( sensor* sensors, int sensornumber ); 00099 00100 protected: 00101 00102 /// The cylinder (main body) lies on the ground, that it is rotating about the z-axis 00103 virtual void create(const osg::Matrix& pose); 00104 00105 }; 00106 00107 } 00108 00109 #endif