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
meshground.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 __MESHGROUND_H
25 #define __MESHGROUND_H
26 
27 #include <stdio.h>
28 #include <cmath>
29 
30 #include "heightfieldprimitive.h"
31 #include "abstractobstacle.h"
32 
33 namespace lpzrobots {
34 
35  class MeshGround : public AbstractObstacle {
36  public:
37 
38 
39  /** Constructor
40  @param odeHandle
41  @param osgHandle
42  @param filename name of the file to load.
43  If ending is .ppm then it is considered as a bitmap height file.
44  The coding mode is used to decode the heights.
45  Otherwise it is consider to be a OSG HeightFieldFile
46  @param texture image filename for the texture
47  @param x_size size in x direction in world coordinates
48  @param y_size size in y direction in world coordinates
49  @param height height in world coordinates
50  @param coding Coding mode, see OSGHeightField (this an own class, not in OSG)
51  */
53  const std::string& filename, const std::string& texture,
54  double x_size, double y_size, double height,
56 
57  /**
58  * updates the position of the geoms ( not nessary for static objects)
59  */
60  virtual void update(){ };
61 
62  virtual void setPose(const osg::Matrix& pose);
63 
64 
65  protected:
66  virtual void create();
67  virtual void destroy();
68 
69  protected:
70  std::string filename;
71  std::string texture;
73  double x_size;
74  double y_size;
75  double height;
77  };
78 }
79 
80 #endif
Data structure for accessing the ODE.
Definition: odehandle.h:44
OsgHandle osgHandle
Definition: abstractobstacle.h:174
HeightField * heightfield
Definition: meshground.h:72
std::string filename
Definition: meshground.h:70
Abstract class (interface) for obstacles.
Definition: abstractobstacle.h:46
Matrixd Matrix
Definition: osgforwarddecl.h:47
virtual void update()
updates the position of the geoms ( not nessary for static objects)
Definition: meshground.h:60
OdeHandle odeHandle
Definition: abstractobstacle.h:173
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
virtual void setPose(const osg::Matrix &pose)
sets position of the obstacle and creates/recreates obstacle if necessary
Definition: meshground.cpp:58
Definition: osgheightfield.h:44
virtual void destroy()
is called to destroy the object. The default implementation is to delete all primitives in "obst"...
Definition: meshground.cpp:83
MeshGround(const OdeHandle &odeHandle, const OsgHandle &osgHandle, const std::string &filename, const std::string &texture, double x_size, double y_size, double height, OSGHeightField::CodingMode coding=OSGHeightField::Red)
Constructor.
Definition: meshground.cpp:46
double x_size
Definition: meshground.h:73
Height field primitive.
Definition: heightfieldprimitive.h:35
double y_size
Definition: meshground.h:74
double height
Definition: meshground.h:75
osg::Matrix pose
Definition: abstractobstacle.h:170
Definition: meshground.h:35
OSGHeightField::CodingMode coding
Definition: meshground.h:76
std::string texture
Definition: meshground.h:71
virtual void create()
overload this function to create the obstactle. All primitives should go into the list "obst" ...
Definition: meshground.cpp:66
CodingMode
height coding using in the read in bitmap.
Definition: osgheightfield.h:44