barrel2masses.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  * cylinder like Robot inspired by Julius Popp's Adam.                     *
00025  *                                                                         *
00026  *   $Log: barrel2masses.h,v $
00027  *   Revision 1.5  2010/02/22 15:28:22  martius
00028  *   config is first fetched from sphererobot3masses to avoid uninitialized fields
00029  *
00030  *   Revision 1.4  2007/07/03 13:05:23  martius
00031  *   new servo constants
00032  *
00033  *   Revision 1.3  2007/01/26 12:05:04  martius
00034  *   servos combinied into OneAxisServo
00035  *
00036  *   Revision 1.2  2006/12/21 11:43:05  martius
00037  *   commenting style for doxygen //< -> ///<
00038  *   new sensors for spherical robots
00039  *
00040  *   Revision 1.1  2006/12/01 16:21:15  martius
00041  *   like sphere3masses, but with 2 masses and cylindric body
00042  *
00043  *
00044  *                                                                 *
00045  ***************************************************************************/
00046 
00047 #ifndef __BARREL2MASSES_H
00048 #define __BARREL2MASSES_H
00049 
00050 #include "primitive.h"
00051 #include "joint.h"
00052 #include "oneaxisservo.h"
00053 #include "oderobot.h"
00054 #include "raysensorbank.h"
00055 #include "sphererobot3masses.h"
00056 
00057 namespace lpzrobots {
00058 
00059 /*
00060   parameters for nice rolling modes:
00061 
00062     Sphererobot3MassesConf conf = Sphererobot3Masses::getDefaultConf();  
00063     conf.pendularrange  = 0.3; 
00064     conf.motorsensor=false;
00065     conf.axisZsensor=true;
00066     conf.axisXYZsensor=false;
00067     conf.spheremass   = 1;
00068     sphere1 = new Barrel2Masses ( odeHandle, osgHandle.changeColor(Color(0.0,0.0,1.0)), 
00069                                   conf, "Barrel1", 0.2); 
00070     sphere1->place ( osg::Matrix::rotate(M_PI/2, 1,0,0));
00071 
00072     controller = new InvertMotorNStep();    
00073     controller->setParam("steps", 2);    
00074     controller->setParam("adaptrate", 0.0);    
00075     controller->setParam("epsC", 0.03);    
00076     controller->setParam("epsA", 0.05);    
00077     controller->setParam("rootE", 3);    
00078     controller->setParam("logaE", 0);    
00079     
00080     One2OneWiring* wiring = new One2OneWiring ( new ColorUniformNoise() );
00081 
00082 */
00083 
00084 /**
00085    A barrel-like robot with 2 internal masses, which can slide on their orthogonal axes.
00086    It is the small brother of the Sphererobot3Masses.
00087    This robot was inspired by Julius Popp (http://sphericalrobots.com)
00088 */
00089 class Barrel2Masses : public Sphererobot3Masses
00090 {
00091 public:
00092 
00093   /**
00094    * Constructor. It is configured with the configuration object of Sphererobot3Masses. 
00095    Just two of the 3 axis are used. The worldZaxissensor  and irAxis3 has no meaning here.
00096    **/ 
00097   Barrel2Masses ( const OdeHandle& odeHandle, const OsgHandle& osgHandle,
00098                        const Sphererobot3MassesConf& conf, const std::string& name, double transparency=0.5 );
00099   
00100   virtual ~Barrel2Masses();
00101         
00102   /** default configuration. It has no sensors. 
00103       Use addSensor(new AxisOrientationSensor(ZProjectionXY) for example.*/
00104   static Sphererobot3MassesConf getDefaultConf(){
00105     Sphererobot3MassesConf c = Sphererobot3Masses::getDefaultConf();
00106     c.diameter     = 1;
00107     c.spheremass   = .3;// 0.1
00108     c.pendularmass  = 1.0;
00109     c.pendularrange  = 0.25; // range of the slider from center in multiple of diameter [-range,range]
00110     c.motorpowerfactor = 150;
00111     c.motorsensor = false;  
00112     c.irAxis1=false;
00113     c.irAxis2=false;
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
Generated on Fri Nov 4 10:59:38 2011 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.6.3