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
uwo.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 #ifndef __UWO_H
25 #define __UWO_H
26 
27 #include "oderobot.h"
28 #include "oneaxisservo.h"
29 #include "twoaxisservo.h"
30 
31 namespace lpzrobots {
32 
33  class Primitive;
34  class Joint;
35 
36  typedef struct {
37  public:
38  double size; ///< scaling factor for robot (diameter of body)
39  double legLength; ///< length of the legs in units of size
40  int legNumber; ///< number of snake elements
41  bool radialLegs; ///< joint orientation is radial instead of cartesian
42  bool useSliders; ///< use sliders at legs
43  double mass; ///< chassis mass
44  double relLegmass; ///< relative overall leg mass
45  double jointLimit; ///< angle range for legs
46  double motorPower; ///< maximal force for motors
47  } UwoConf;
48 
49 
50  /** UWO: Unknown Walk Object :-), looks like a plate with a lot of legs
51  */
52  class Uwo : public OdeRobot {
53  public:
54 
55  /**
56  * constructor of uwo robot
57  * @param odeHandle data structure for accessing ODE
58  * @param osgHandle ata structure for accessing OSG
59  * @param size scaling of robot
60  * @param force maximal used force to realize motorcommand
61  * @param radialLegs switches between cartensian and radial leg joints
62  */
63  Uwo(const OdeHandle& odeHandle, const OsgHandle& osgHandle, const UwoConf& conf,
64  const std::string& name);
65 
66  virtual ~Uwo(){ destroy(); };
67 
69  UwoConf c;
70  c.size = 1;
71  c.legNumber = 8;
72  c.legLength = 0.3;
73  c.mass = 1;
74  c.useSliders = true;
75  c.relLegmass = 1;
76  c.motorPower = 0.5;
77  c.jointLimit = M_PI/12; // +- 15 degree
78  c.radialLegs = true;
79  return c;
80  }
81 
82  /** sets the pose of the vehicle
83  @param pose desired pose matrix
84  */
85  virtual void placeIntern(const osg::Matrix& pose);
86 
87  /** returns actual sensorvalues
88  @param sensors sensors scaled to [-1,1]
89  @param sensornumber length of the sensor array
90  @return number of actually written sensors
91  */
92  virtual int getSensorsIntern(sensor* sensors, int sensornumber);
93 
94  /** sets actual motorcommands
95  @param motors motors scaled to [-1,1]
96  @param motornumber length of the motor array
97  */
98  virtual void setMotorsIntern(const double* motors, int motornumber);
99 
100  /** returns number of sensors
101  */
102  virtual int getSensorNumberIntern();
103 
104  /** returns number of motors
105  */
106  virtual int getMotorNumberIntern();
107 
108 
109  /******** CONFIGURABLE ***********/
110  virtual void notifyOnChange(const paramkey& key);
111 
112  protected:
113  /** the main object of the robot, which is used for position and speed tracking */
114  virtual Primitive* getMainPrimitive() const { return objects[0]; }
115 
116  /** creates vehicle at desired pose
117  @param pose 4x4 pose matrix
118  */
119  virtual void create(const osg::Matrix& pose);
120 
121  /** destroys vehicle and space
122  */
123  virtual void destroy();
124 
126  double legmass; // leg mass
127 
128  bool created; // true if robot was created
129 
130 
131  std::vector <TwoAxisServo*> servos; // motors
132  std::vector <OneAxisServo*> sliderservos; // motors
133 
134  };
135 
136 }
137 
138 #endif
virtual Primitive * getMainPrimitive() const
the main object of the robot, which is used for position and speed tracking
Definition: uwo.h:114
UwoConf conf
Definition: uwo.h:125
Data structure for accessing the ODE.
Definition: odehandle.h:44
double legLength
length of the legs in units of size
Definition: uwo.h:39
virtual void destroy()
destroys vehicle and space
Definition: uwo.cpp:186
Matrixd Matrix
Definition: osgforwarddecl.h:47
bool created
Definition: uwo.h:128
charArray paramkey
Definition: avrtypes.h:36
virtual void placeIntern(const osg::Matrix &pose)
sets the pose of the vehicle
Definition: uwo.cpp:105
double sensor
Definition: types.h:29
virtual int getMotorNumberIntern()
returns number of motors
Definition: uwo.cpp:60
double relLegmass
relative overall leg mass
Definition: uwo.h:44
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
int legNumber
number of snake elements
Definition: uwo.h:40
bool useSliders
use sliders at legs
Definition: uwo.h:42
virtual int getSensorNumberIntern()
returns number of sensors
Definition: uwo.cpp:64
std::vector< TwoAxisServo * > servos
Definition: uwo.h:131
double size
scaling factor for robot (diameter of body)
Definition: uwo.h:38
static UwoConf getDefaultConf()
Definition: uwo.h:68
std::vector< OneAxisServo * > sliderservos
Definition: uwo.h:132
double mass
chassis mass
Definition: uwo.h:43
Interface class for primitives represented in the physical and graphical world.
Definition: primitive.h:80
virtual ~Uwo()
Definition: uwo.h:66
Definition: uwo.h:36
std::list< SensorAttachment > sensors
Definition: oderobot.h:269
double jointLimit
angle range for legs
Definition: uwo.h:45
Uwo(const OdeHandle &odeHandle, const OsgHandle &osgHandle, const UwoConf &conf, const std::string &name)
constructor of uwo robot
Definition: uwo.cpp:44
double motorPower
maximal force for motors
Definition: uwo.h:46
OsgHandle osgHandle
Definition: oderobot.h:278
OdeHandle odeHandle
Definition: oderobot.h:277
double legmass
Definition: uwo.h:126
virtual int getSensorsIntern(sensor *sensors, int sensornumber)
returns actual sensorvalues
Definition: uwo.cpp:91
Abstract class for ODE robots.
Definition: oderobot.h:64
virtual void notifyOnChange(const paramkey &key)
Is called when a parameter was changes via setParam().
Definition: uwo.cpp:204
UWO: Unknown Walk Object :-), looks like a plate with a lot of legs.
Definition: uwo.h:52
Primitives objects
list of objects (should be populated by subclasses)
Definition: oderobot.h:265
bool radialLegs
joint orientation is radial instead of cartesian
Definition: uwo.h:41
virtual void setMotorsIntern(const double *motors, int motornumber)
sets actual motorcommands
Definition: uwo.cpp:72
virtual void create(const osg::Matrix &pose)
creates vehicle at desired pose
Definition: uwo.cpp:114
std::list< MotorAttachment > motors
Definition: oderobot.h:270
int c
Definition: hexapod.cpp:56