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
terrainground.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 __TERRAINGROUND_H
25 #define __TERRAINGROUND_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 provides an terrain based on HeightFields.
36  Can be loaded from image or from HeightFieldFiles
37  */
39  public:
40 
41 
42  /** Constructor
43  @param odeHandle
44  @param osgHandle
45  @param filename name of the file to load.
46  If ending is .ppm then it is considered as a bitmap height file.
47  The coding mode is used to decode the heights.
48  Otherwise it is consider to be a OSG HeightFieldFile
49  @param texture image filename for the texture
50  @param x_size size in x direction in world coordinates
51  @param y_size size in y direction in world coordinates
52  @param height height in world coordinates
53  @param coding Coding mode, see OSGHeightField (this is an own class, not in OSG)
54  */
56  const std::string& filename, const std::string& texture,
57  double x_size, double y_size, double height,
59 
60  virtual ~TerrainGround(){}
61 
62  /**
63  * updates the position of the geoms ( not nessary for static objects)
64  */
65  virtual void update(){ };
66 
67  virtual void setPose(const osg::Matrix& pose);
68 
69 
70  virtual Primitive* getMainPrimitive() const { return 0; }
71 
72  protected:
73  virtual void create();
74  virtual void destroy();
75 
76  protected:
77  std::string filename;
78  std::string texture;
80  double x_size;
81  double y_size;
82  double height;
84  };
85 }
86 
87 #endif
TerrainGround(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: terrainground.cpp:41
Data structure for accessing the ODE.
Definition: odehandle.h:44
OsgHandle osgHandle
Definition: abstractobstacle.h:174
OSGHeightField::CodingMode coding
Definition: terrainground.h:83
double height
Definition: terrainground.h:82
Abstract class (interface) for obstacles.
Definition: abstractobstacle.h:46
std::string texture
Definition: terrainground.h:78
Matrixd Matrix
Definition: osgforwarddecl.h:47
virtual void update()
updates the position of the geoms ( not nessary for static objects)
Definition: terrainground.h:65
virtual Primitive * getMainPrimitive() const
return the "main" primitive of the obtactle. The meaning of "main" is arbitrary
Definition: terrainground.h:70
OdeHandle odeHandle
Definition: abstractobstacle.h:173
double y_size
Definition: terrainground.h:81
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
Definition: osgheightfield.h:44
virtual void create()
overload this function to create the obstactle. All primitives should go into the list "obst" ...
Definition: terrainground.cpp:60
Height field primitive.
Definition: heightfieldprimitive.h:35
Class provides an terrain based on HeightFields.
Definition: terrainground.h:38
Interface class for primitives represented in the physical and graphical world.
Definition: primitive.h:80
double x_size
Definition: terrainground.h:80
osg::Matrix pose
Definition: abstractobstacle.h:170
HeightField * heightfield
Definition: terrainground.h:79
virtual void setPose(const osg::Matrix &pose)
sets position of the obstacle and creates/recreates obstacle if necessary
Definition: terrainground.cpp:52
std::string filename
Definition: terrainground.h:77
virtual void destroy()
is called to destroy the object. The default implementation is to delete all primitives in "obst"...
Definition: terrainground.cpp:76
CodingMode
height coding using in the read in bitmap.
Definition: osgheightfield.h:44
virtual ~TerrainGround()
Definition: terrainground.h:60