simplecomponent.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Robot Group Leipzig                             *
00003  *    martius@informatik.uni-leipzig.de                                    *
00004  *    fhesse@informatik.uni-leipzig.de                                     *
00005  *    der@informatik.uni-leipzig.de                                        *
00006  *    marcel@informatik.uni-leipzig.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 
00025 #include "component.h"
00026 
00027 #ifndef simplecomponent_h
00028 #define simplecomponent_h
00029 
00030 
00031 namespace lpzrobots
00032 {
00033 /**
00034  * A simple component is a special form of component. The pysical object that belongs to this component class is a Primitive object.
00035  */
00036 class SimpleComponent : public Component
00037 {
00038 
00039  private:
00040     //only one of this two should reference to an object
00041     Primitive* simplePrimitive;
00042 
00043  public:
00044 
00045     SimpleComponent ( const OdeHandle &odeHandle, const OsgHandle &osgHandle, const ComponentConf& conf);
00046     
00047     ~SimpleComponent ();
00048 
00049  public:
00050 
00051 
00052 virtual void    update ();//update the OSG notes here; update of the underlying robot or Primitive and recursive update of all Components in the Connection-vector
00053 
00054 virtual void    place (const Pos &pos);//sets the vehicle to position pos - desired position of the robot; the first component is seen as center of the robot, on which the position pos refers; also recursive place of all subComponents
00055 virtual void    place (const osg::Matrix &pose);//sets the pose of the vehicle; also recursive place of all subComponents; does nothing at the moment
00056 
00057 virtual bool    collisionCallback (void *data, dGeomID o1, dGeomID o2);// checks for internal collisions and treats them.; should do nothing, because there should not be any ode-objects belonging to the component, which are not handled elsewhere....and what is with Primitives? are they automaticaly handled?
00058 
00059 virtual void    doInternalStuff (GlobalData &globalData);// this function is called in each timestep.; maybee usefull
00060 
00061 // virtual void         setColor (const Color &col);    sets color of the robot; not nessecary
00062 
00063 virtual Position getPosition () const; //returns position of the object; relates to the robot or Primitive belonging to the component
00064 
00065 //virtual Position getSpeed () const;//returns linear speed vector of the object; must be computed from all sub-robots
00066 
00067 //virtual matrix::Matrix        getOrientation () const;//returns the orientation of the object;
00068 
00069 
00070 /**
00071  *This is only a simple function, calculating the coordinates of the point exactly between two directly connected components.
00072  *@return Vector containing the Position
00073  **/
00074 virtual osg::Vec3 getPositionbetweenComponents ( Component* component );
00075 
00076 /**
00077  *Sets the reference to the Primitive for the component, but only if there is no robot assigned to the component.
00078  *Overwriting an existing Primitive reference is possible, also to set it NULL, and then set a reference to a Primitive with setSimplePrimitive ( .. ).
00079  *But first the Primitive reference should be saved elsewhere or it won't be updated graficaly
00080  *@return true if the reference could be set; false else
00081  **/
00082 virtual bool setSimplePrimitive ( Primitive* newprimitive );
00083 
00084 /**
00085  *return reference to the simple Primitive, or to the main Primitive of the robot assigend to the component. If nothimng is assigned, NULL is returned.
00086  **/
00087 virtual Primitive* getMainPrimitive () const;
00088 
00089      
00090 };
00091 
00092 
00093 }
00094 #endif

Generated on Fri Oct 30 16:29:01 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7