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

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