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  * SimpleComponent
00035  *
00036  *
00037  */
00038 class SimpleComponent : public Component
00039 {
00040 
00041  private:
00042     //only one of this two should reference to an object
00043     Primitive* simplePrimitive;
00044 
00045  public:
00046 
00047     SimpleComponent ( const OdeHandle &odeHandle, const OsgHandle &osgHandle, const ComponentConf& conf);
00048     
00049     ~SimpleComponent ();
00050 
00051  public:
00052 
00053 
00054 //virtual int   getSensorNumber (); //returns number of sensors; recursivly adding of the number of sensors all subcomponents and the robots of all Subcomponents.
00055 
00056 //virtual int   getMotorNumber (); //returns number of motors; recursivly adding of the number of sensors all subcomponents; at the moment only counts Hinge-, Slider-, Hinge2 and Universal-Joints; The Motor-Numbers of the robots of the Components is not counted.
00057 
00058 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
00059 
00060 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
00061 virtual void    place (const osg::Matrix &pose);//sets the pose of the vehicle; also recursive place of all subComponents; does nothing at the moment
00062 
00063 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?
00064 
00065 virtual void    doInternalStuff (const GlobalData &globalData);// this function is called in each timestep.; maybee usefull
00066 
00067 // virtual void         setColor (const Color &col);    sets color of the robot; not nessecary
00068 
00069 virtual Position getPosition () const; //returns position of the object; relates to the robot or Primitive belonging to the component
00070 
00071 //virtual Position getSpeed () const;//returns linear speed vector of the object; must be computed from all sub-robots
00072 
00073 //virtual matrix::Matrix        getOrientation () const;//returns the orientation of the object;
00074 
00075 
00076 /**
00077  *This is only a simple function, calculating the coordinates of the point exactly between two directly connected components.
00078  *@return Vector containing the Position
00079  *@param index number of the position
00080  **/
00081 virtual osg::Vec3 getPositionbetweenComponents ( Component* component );
00082 
00083 /**
00084  *Sets the reference to the Primitive for the component, but only if there is no robot assigned to the component.
00085  *Overwriting an existing Primitive reference is possible, also to set it NULL, and then set a reference to a Primitive with setSimplePrimitive ( .. ).
00086  *But first the Primitive reference should be saved elsewhere or it won't be updated graficaly
00087  *@return true if the reference could be set; false else
00088  **/
00089 virtual bool setSimplePrimitive ( Primitive* newprimitive );
00090 
00091 /**
00092  *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.
00093  **/
00094 virtual Primitive* getMainPrimitive () const;
00095 
00096      
00097 };
00098 
00099 
00100 }
00101 #endif

Generated on Mon Aug 7 16:40:14 2006 for Robotsystem of the Robot Group Leipzig by  doxygen 1.4.7