Robot Simulator of the Robotics Group for Self-Organization of Control: barrel2masses.h Source File

# barrel2masses.h

Go to the documentation of this file.

    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 __BARREL2MASSES_H
    00026 #define __BARREL2MASSES_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 Barrel2Masses : 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   Barrel2Masses ( const OdeHandle& odeHandle, const OsgHandle& osgHandle,
    00076                        const Sphererobot3MassesConf& conf, const std::string& name, double transparency=0.5 );
    00077
    00078   virtual ~Barrel2Masses();
    00079
    00080   /** default configuration. It has no sensors.
    00081       Use addSensor(new AxisOrientationSensor(ZProjectionXY) for example.*/
    00082   static Sphererobot3MassesConf getDefaultConf(){
    00083     Sphererobot3MassesConf c = Sphererobot3Masses::getDefaultConf();
    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.motorpowerfactor = 150;
    00089     c.motorsensor = false;
    00090     c.irRing=true;
    00091     c.irSide=false;
    00092     c.irAxis1=false;
    00093     c.irAxis2=false;
    00094     c.irAxis3=false;
    00095     c.drawIRs=RaySensor::drawAll;
    00096     c.irsensorscale=1.5;
    00097     c.irCharacter=1;
    00098     c.irSensorTempl=0;
    00099     c.motor_ir_before_sensors=false;
    00100     c.brake=0;
    00101     c.axesShift=0;
    00102     return c;
    00103   }
    00104
    00105   virtual int getSensors ( sensor* sensors, int sensornumber );
    00106
    00107 protected:
    00108
    00109   /// The cylinder (main body) lies on the ground, that it is rotating about the z-axis
    00110   virtual void create(const osg::Matrix& pose);
    00111
    00112 };
    00113
    00114 }
    00115
    00116 #endif