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.6  2007/11/07 13:21:16  martius
00024  *   doInternal stuff changed signature
00025  *
00026  *   Revision 1.5  2006/12/11 18:24:37  martius
00027  *   memory freed
00028  *
00029  *   Revision 1.4  2006/07/14 12:23:42  martius
00030  *   selforg becomes HEAD
00031  *
00032  *   Revision 1.3.4.6  2006/03/30 12:34:57  martius
00033  *   documentation updated
00034  *
00035  *   Revision 1.3.4.5  2006/01/10 21:46:34  martius
00036  *   collcallbak
00037  *
00038  *   Revision 1.3.4.4  2006/01/10 20:32:58  martius
00039  *   moved to osg
00040  *
00041  *   Revision 1.3.4.3  2005/11/16 11:26:53  martius
00042  *   moved to selforg
00043  *
00044  *   Revision 1.3.4.2  2005/11/15 12:29:27  martius
00045  *   new selforg structure and OdeAgent, OdeRobot ...
00046  *
00047  *   Revision 1.3.4.1  2005/11/14 17:37:18  martius
00048  *   moved to selforg
00049  *
00050  *   Revision 1.3  2005/09/22 12:24:37  martius
00051  *   removed global variables
00052  *   OdeHandle and GlobalData are used instead
00053  *   sensor prepared
00054  *
00055  *   Revision 1.2  2005/07/18 14:47:41  martius
00056  *   world, space, contactgroup are not pointers anymore.
00057  *
00058  *   Revision 1.1  2005/07/06 16:03:37  martius
00059  *   dummy robot that connects motors with sensors
00060  *
00061  ***************************************************************************/
00062 #ifndef __SHORTCIRCUIT_H
00063 #define __SHORTCIRCUIT_H
00064 
00065 
00066 #include "oderobot.h"
00067 
00068 namespace lpzrobots {
00069 
00070   /**
00071    * 
00072    */
00073   class ShortCircuit : public OdeRobot{
00074   public:
00075     ShortCircuit(const OdeHandle& odeHandle, const OsgHandle& osgHandle, int sensornumber, int motornumber);
00076 
00077     ~ShortCircuit();
00078 
00079     virtual void update() {}
00080 
00081     /** sets the pose of the vehicle
00082         @param pose desired 4x4 pose matrix
00083     */
00084     virtual void place(const osg::Matrix& pose) {}
00085 
00086     /** returns actual sensorvalues
00087         @param sensors sensors scaled to [-1,1] 
00088         @param sensornumber length of the sensor array
00089         @return number of actually written sensors
00090     */
00091     virtual int getSensors(sensor* sensors, int sensornumber);
00092 
00093     /** sets actual motorcommands
00094         @param motors motors scaled to [-1,1] 
00095         @param motornumber length of the motor array
00096     */
00097     virtual void setMotors(const motor* motors, int motornumber);
00098 
00099     /** returns number of sensors
00100      */
00101     virtual int getSensorNumber() {return sensorno; }
00102 
00103     /** returns number of motors
00104      */
00105     virtual int getMotorNumber() {return motorno; }
00106 
00107     /** this function is called in each timestep. It should perform robot-internal checks, 
00108         like space-internal collision detection, sensor resets/update etc.
00109         @param globalData structure that contains global data from the simulation environment
00110     */
00111     virtual void doInternalStuff(GlobalData& globalData) {}
00112 
00113     virtual bool collisionCallback(void *data, dGeomID o1, dGeomID o2) { return false;}
00114 
00115   protected:
00116     /** the main object of the robot, which is used for position and speed tracking */
00117     virtual Primitive* getMainPrimitive() const { return 0; }
00118 
00119   protected:
00120     int sensorno;      //number of sensors
00121     int motorno;       // number of motors
00122     motor* motors;
00123   } ;
00124 
00125 }
00126 
00127 #endif
00128  

Generated on Tue Sep 16 22:00:22 2008 for Robotsystem of the Robot Group Leipzig by  doxygen 1.4.7