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

# terrainground.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 #ifndef __TERRAINGROUND_H
    00025 #define __TERRAINGROUND_H
    00026
    00027 #include <stdio.h>
    00028 #include <cmath>
    00029
    00030 #include "heightfieldprimitive.h"
    00031 #include "abstractobstacle.h"
    00032
    00033 namespace lpzrobots {
    00034
    00035   /** Class provides an terrain based on HeightFields.
    00036       Can be loaded from image or from HeightFieldFiles
    00037   */
    00038   class TerrainGround : public AbstractObstacle {
    00039   public:
    00040
    00041
    00042     /** Constructor
    00043         @param odeHandle
    00044         @param osgHandle
    00045         @param filename name of the file to load.
    00046         If ending is .ppm then it is considered as a bitmap height file.
    00047         The coding mode is used to decode the heights.
    00048         Otherwise it is consider to be a OSG HeightFieldFile
    00049         @param texture image filename for the texture
    00050         @param x_size size in x direction in world coordinates
    00051         @param y_size size in y direction in world coordinates
    00052         @param height height in world coordinates
    00053         @param coding Coding mode, see OSGHeightField (this is an own class, not in OSG)
    00054     */
    00055     TerrainGround(const OdeHandle& odeHandle, const OsgHandle& osgHandle,
    00056                const std::string& filename, const std::string& texture,
    00057                double x_size, double y_size, double height,
    00058                OSGHeightField::CodingMode coding = OSGHeightField::Red);
    00059
    00060     virtual ~TerrainGround(){}
    00061
    00062     /**
    00063      * updates the position of the geoms  ( not nessary for static objects)
    00064      */
    00065     virtual void update(){ };
    00066
    00067     virtual void setPose(const osg::Matrix& pose);
    00068
    00069
    00070     virtual Primitive* getMainPrimitive() const { return 0; }
    00071
    00072   protected:
    00073     virtual void create();
    00074     virtual void destroy();
    00075
    00076   protected:
    00077     std::string filename;
    00078     std::string texture;
    00079     HeightField* heightfield;
    00080     double x_size;
    00081     double y_size;
    00082     double height;
    00083     OSGHeightField::CodingMode coding;
    00084   };
    00085 }
    00086
    00087 #endif