Robotsystem of the Robot Group Leipzig: robotcomponent.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Examples

- Search for |

- File List
- File Members

# robotcomponent.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 robotcomponent_h
    00028 #define robotcomponent_h
    00029
    00030
    00031 namespace lpzrobots
    00032 {
    00033 /**
    00034  * RobotComponent
    00035  *
    00036  *
    00037  */
    00038 class RobotComponent : public Component
    00039 {
    00040
    00041  private:
    00042
    00043     OdeRobot* robot;
    00044
    00045  public:
    00046
    00047     RobotComponent ( const OdeHandle &odeHandle, const OsgHandle &osgHandle, const ComponentConf& conf);
    00048
    00049     ~RobotComponent ();
    00050
    00051  public:
    00052
    00053 /**
    00054  *Use this, to get all sensor values of all the joints of all subcomponents, and the sensors of all robots, belonging to all subcompionents.
    00055  *The sensor values have the following sequence:
    00056  *values of the component connecting joints, values of the robot of the component,
    00057  *values of component connecting joints of the first subcomponent, values of the robot of the first subcomponent, ...
    00058  *@robot sensor values of the connecting joints of this component and all subcomponents
    00059  **/
    00060 virtual int     getSensors (sensor *sensors, int sensornumber); //returns actual sensorvalues; only for the connecting joints
    00061
    00062 /**
    00063  *Sets the motor values for the joints connecting the component with its subcomponents, an recursivly the joints of all subComponents.
    00064  *The motors of all robots of the subcomponents is not set.
    00065  *@param
    00066  **/
    00067 virtual void    setMotors (const motor *motors, int motornumber); //sets actual motorcommands; only for the connecting joints
    00068
    00069 virtual int     getSensorNumber (); //returns number of sensors; recursivly adding of the number of sensors all subcomponents and the robots of all Subcomponents.
    00070
    00071 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.
    00072
    00073 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
    00074
    00075 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
    00076 virtual void    place (const osg::Matrix &pose);//sets the pose of the vehicle; also recursive place of all subComponents; does nothing at the moment
    00077
    00078 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?
    00079
    00080 virtual void    doInternalStuff (const GlobalData &globalData);// this function is called in each timestep.; maybee usefull
    00081
    00082 // virtual void         setColor (const Color &col);    sets color of the robot; not nessecary
    00083
    00084 virtual Position getPosition () const; //returns position of the object; relates to the robot or Primitive belonging to the component
    00085
    00086 //virtual Position getSpeed () const;//returns linear speed vector of the object; must be computed from all sub-robots
    00087
    00088 //virtual matrix::Matrix        getOrientation () const;//returns the orientation of the object;
    00089
    00090
    00091 /**
    00092  *This is only a simple function, calculating the coordinates of the point exactly between two directly connected components.
    00093  *@return Vector containing the Position
    00094  *@param index number of the position
    00095  **/
    00096 virtual osg::Vec3 getPositionbetweenComponents ( Component* component );
    00097
    00098 /**
    00099  *Sets the reference to the robot for the component, but only if there is no Primitive assigned to the component.
    00100  *Overwriting an existing robot reference is possible, also to set it NULL, and then set a reference to a Primitive with setSimplePrimitive ( .. ).
    00101  *But first the robot reference should be saved elsewhere or it won't be updated graficaly
    00102  *return true if the reference could be set; false else
    00103  **/
    00104 virtual bool setRobot ( OdeRobot* newrobot );
    00105
    00106 /**
    00107  *returns a reference to the robot belonging to the component, if there is no robot it is an NULL pointer, then try getMeinPrimitive, because there is only a solid Primitive not a complex robot for this component
    00108  *@return the robot asigned to the component
    00109  **/
    00110 virtual OdeRobot* getRobot (); //
    00111
    00112 /**
    00113  *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.
    00114  **/
    00115 virtual Primitive* getMainPrimitive () const;
    00116
    00117 };
    00118
    00119
    00120 }
    00121 #endif