Robotsystem from Robot Group Leipzig: shortcircuit.h Source File

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

- File List
- File Members

# shortcircuit.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  *                                                                         *
    00007  *   This program is free software; you can redistribute it and/or modify  *
    00008  *   it under the terms of the GNU General Public License as published by  *
    00009  *   the Free Software Foundation; either version 2 of the License, or     *
    00010  *   (at your option) any later version.                                   *
    00011  *                                                                         *
    00012  *   This program is distributed in the hope that it will be useful,       *
    00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
    00015  *   GNU General Public License for more details.                          *
    00016  *                                                                         *
    00017  *   You should have received a copy of the GNU General Public License     *
    00018  *   along with this program; if not, write to the                         *
    00019  *   Free Software Foundation, Inc.,                                       *
    00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
    00021  *                                                                         *
    00022  *   $Log: shortcircuit.h,v $
    00023  *   Revision 1.3.4.6  2006/03/30 12:34:57  martius
    00024  *   documentation updated
    00025  *
    00026  *   Revision 1.3.4.5  2006/01/10 21:46:34  martius
    00027  *   collcallbak
    00028  *
    00029  *   Revision 1.3.4.4  2006/01/10 20:32:58  martius
    00030  *   moved to osg
    00031  *
    00032  *   Revision 1.3.4.3  2005/11/16 11:26:53  martius
    00033  *   moved to selforg
    00034  *
    00035  *   Revision 1.3.4.2  2005/11/15 12:29:27  martius
    00036  *   new selforg structure and OdeAgent, OdeRobot ...
    00037  *
    00038  *   Revision 1.3.4.1  2005/11/14 17:37:18  martius
    00039  *   moved to selforg
    00040  *
    00041  *   Revision 1.3  2005/09/22 12:24:37  martius
    00042  *   removed global variables
    00043  *   OdeHandle and GlobalData are used instead
    00044  *   sensor prepared
    00045  *
    00046  *   Revision 1.2  2005/07/18 14:47:41  martius
    00047  *   world, space, contactgroup are not pointers anymore.
    00048  *
    00049  *   Revision 1.1  2005/07/06 16:03:37  martius
    00050  *   dummy robot that connects motors with sensors
    00051  *
    00052  ***************************************************************************/
    00053 #ifndef __SHORTCIRCUIT_H
    00054 #define __SHORTCIRCUIT_H
    00055
    00056
    00057 #include "oderobot.h"
    00058
    00059 namespace lpzrobots {
    00060
    00061   /**
    00062    *
    00063    */
    00064   class ShortCircuit : public OdeRobot{
    00065   public:
    00066     ShortCircuit(const OdeHandle& odeHandle, const OsgHandle& osgHandle, int sensornumber, int motornumber);
    00067
    00068     virtual void update() {}
    00069
    00070     /** sets the pose of the vehicle
    00071         @param pose desired 4x4 pose matrix
    00072     */
    00073     virtual void place(const osg::Matrix& pose) {}
    00074
    00075     /** returns actual sensorvalues
    00076         @param sensors sensors scaled to [-1,1]
    00077         @param sensornumber length of the sensor array
    00078         @return number of actually written sensors
    00079     */
    00080     virtual int getSensors(sensor* sensors, int sensornumber);
    00081
    00082     /** sets actual motorcommands
    00083         @param motors motors scaled to [-1,1]
    00084         @param motornumber length of the motor array
    00085     */
    00086     virtual void setMotors(const motor* motors, int motornumber);
    00087
    00088     /** returns number of sensors
    00089      */
    00090     virtual int getSensorNumber() {return sensorno; }
    00091
    00092     /** returns number of motors
    00093      */
    00094     virtual int getMotorNumber() {return motorno; }
    00095
    00096     /** this function is called in each timestep. It should perform robot-internal checks,
    00097         like space-internal collision detection, sensor resets/update etc.
    00098         @param globalData structure that contains global data from the simulation environment
    00099     */
    00100     virtual void doInternalStuff(const GlobalData& globalData) {}
    00101
    00102     virtual bool collisionCallback(void *data, dGeomID o1, dGeomID o2) { return false;}
    00103
    00104   protected:
    00105     /** the main object of the robot, which is used for position and speed tracking */
    00106     virtual Primitive* getMainPrimitive() const { return 0; }
    00107
    00108   protected:
    00109     int sensorno;      //number of sensors
    00110     int motorno;       // number of motors
    00111     motor* motors;
    00112   } ;
    00113
    00114 }
    00115
    00116 #endif
    00117