Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
barrel2masses.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 
25 #ifndef __BARREL2MASSES_H
26 #define __BARREL2MASSES_H
27 
28 #include "primitive.h"
29 #include "joint.h"
30 #include "oneaxisservo.h"
31 #include "oderobot.h"
32 #include "raysensorbank.h"
33 #include "sphererobot3masses.h"
34 
35 namespace lpzrobots {
36 
37 /*
38  parameters for nice rolling modes:
39 
40  Sphererobot3MassesConf conf = Sphererobot3Masses::getDefaultConf();
41  conf.pendularrange = 0.3;
42  conf.motorsensor=false;
43  conf.axisZsensor=true;
44  conf.axisXYZsensor=false;
45  conf.spheremass = 1;
46  sphere1 = new Barrel2Masses ( odeHandle, osgHandle.changeColor(Color(0.0,0.0,1.0)),
47  conf, "Barrel1", 0.2);
48  sphere1->placeIntern( osg::Matrix::rotate(M_PI/2, 1,0,0));
49 
50  controller = new InvertMotorNStep();
51  controller->setParam("steps", 2);
52  controller->setParam("adaptrate", 0.0);
53  controller->setParam("epsC", 0.03);
54  controller->setParam("epsA", 0.05);
55  controller->setParam("rootE", 3);
56  controller->setParam("logaE", 0);
57 
58  One2OneWiring* wiring = new One2OneWiring ( new ColorUniformNoise() );
59 
60 */
61 
62 /**
63  A barrel-like robot with 2 internal masses, which can slide on their orthogonal axes.
64  It is the small brother of the Sphererobot3Masses.
65  This robot was inspired by Julius Popp (http://sphericalrobots.com)
66 */
68 {
69 public:
70 
71  /**
72  * Constructor. It is configured with the configuration object of Sphererobot3Masses.
73  Just two of the 3 axis are used. The worldZaxissensor and irAxis3 has no meaning here.
74  **/
76  const Sphererobot3MassesConf& conf, const std::string& name, double transparency=0.5 );
77 
78  virtual ~Barrel2Masses();
79 
80  /** default configuration. It has no sensors.
81  Use addSensor(std::make_shared<Sensor>(AxisOrientationSensor(ZProjectionXY)) for example.*/
84  c.diameter = 1;
85  c.spheremass = .3;// 0.1
86  c.pendularmass = 1.0;
87  c.pendularrange = 0.25; // range of the slider from center in multiple of diameter [-range,range]
88  c.motorpowerfactor = 150;
89  c.motorsensor = false;
90  c.irRing=true;
91  c.irSide=false;
92  c.irAxis1=false;
93  c.irAxis2=false;
94  c.irAxis3=false;
96  c.irsensorscale=1.5;
97  c.irCharacter=1;
98  c.irSensorTempl=0;
100  c.brake=0;
101  c.axesShift=0;
102  return c;
103  }
104 
105  virtual int getSensorsIntern( sensor* sensors, int sensornumber );
106 
107 protected:
108 
109  /// The cylinder (main body) lies on the ground, that it is rotating about the z-axis
110  virtual void create(const osg::Matrix& pose);
111 
112 };
113 
114 }
115 
116 #endif
double irsensorscale
range of the ir sensors in units of diameter
Definition: sphererobot3masses.h:53
virtual ~Barrel2Masses()
Definition: barrel2masses.cpp:53
virtual int getSensorsIntern(sensor *sensors, int sensornumber)
Writes the sensor values to an array in the memory.
Definition: barrel2masses.cpp:57
Data structure for accessing the ODE.
Definition: odehandle.h:44
double brake
if nonzero the robot brakes (deaccelerates actively/magically)
Definition: sphererobot3masses.h:57
bool irAxis3
Definition: sphererobot3masses.h:49
bool motorsensor
motor values as sensors
Definition: sphererobot3masses.h:46
RaySensor::rayDrawMode drawIRs
Definition: sphererobot3masses.h:52
double spheremass
Definition: sphererobot3masses.h:41
Matrixd Matrix
Definition: osgforwarddecl.h:47
A barrel-like robot with 2 internal masses, which can slide on their orthogonal axes.
Definition: barrel2masses.h:67
Sphererobot3MassesConf conf
Definition: sphererobot3masses.h:85
double motor_ir_before_sensors
if true motor sensors and ir sensors are given before additional sensors
Definition: sphererobot3masses.h:56
Definition: raysensor.h:56
double sensor
Definition: types.h:29
static Sphererobot3MassesConf getDefaultConf()
default configuration.
Definition: barrel2masses.h:82
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
bool irAxis1
Definition: sphererobot3masses.h:47
double irCharacter
characteristics of sensor ( where x is the range-distance)
Definition: sphererobot3masses.h:54
bool irSide
4 IR senors to both side in y direction (collides with irAxis2)
Definition: sphererobot3masses.h:51
static Sphererobot3MassesConf getDefaultConf()
default configuration
Definition: sphererobot3masses.h:112
bool irRing
IR sensors in a ring in x,z plane (collides with irAxis1 and irAxis3)
Definition: sphererobot3masses.h:50
double pendularrange
fraction of the diameter the pendular masses can move to one side
Definition: sphererobot3masses.h:45
A spherical robot with 3 internal masses, which can slide on their orthogonal axes.
Definition: sphererobot3masses.h:72
std::list< SensorAttachment > sensors
Definition: oderobot.h:269
configuration object for the Sphererobot3Masses robot.
Definition: sphererobot3masses.h:38
bool irAxis2
Definition: sphererobot3masses.h:48
Barrel2Masses(const OdeHandle &odeHandle, const OsgHandle &osgHandle, const Sphererobot3MassesConf &conf, const std::string &name, double transparency=0.5)
Constructor.
Definition: barrel2masses.cpp:43
OsgHandle osgHandle
Definition: oderobot.h:278
double axesShift
defines how much the axes are shifted from the center
Definition: sphererobot3masses.h:58
OdeHandle odeHandle
Definition: oderobot.h:277
double diameter
Definition: sphererobot3masses.h:40
virtual void create(const osg::Matrix &pose)
The cylinder (main body) lies on the ground, that it is rotating about the z-axis.
Definition: barrel2masses.cpp:88
double motorpowerfactor
power factor for servos w.r.t. pendularmass
Definition: sphererobot3masses.h:44
double pendularmass
Definition: sphererobot3masses.h:43
double transparency
Definition: sphererobot3masses.h:87
RaySensor * irSensorTempl
template for creation of the other ir sensors (if 0 then IRSensor(irCharacter))
Definition: sphererobot3masses.h:55
int c
Definition: hexapod.cpp:56