shortcircuit.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2011 LpzRobots development team                    *
00003  *    Georg Martius  <georg dot martius at web dot de>                     *
00004  *    Frank Guettler <guettler at informatik dot uni-leipzig dot de        *
00005  *    Frank Hesse    <frank at nld dot ds dot mpg dot de>                  *
00006  *    Ralf Der       <ralfder at mis dot mpg dot 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 #ifndef __SHORTCIRCUIT_H
00025 #define __SHORTCIRCUIT_H
00026 
00027 
00028 #include "oderobot.h"
00029 #include "primitive.h"
00030 
00031 namespace lpzrobots {
00032 
00033   /**
00034    * 
00035    */
00036   class ShortCircuit : public OdeRobot{
00037   public:
00038     ShortCircuit(const OdeHandle& odeHandle, const OsgHandle& osgHandle, int sensornumber, int motornumber);
00039 
00040     virtual ~ShortCircuit();
00041 
00042     virtual void update() {}
00043 
00044     /** sets the pose of the vehicle
00045         @param pose desired 4x4 pose matrix
00046     */
00047     virtual void place(const osg::Matrix& pose) {}
00048 
00049     /** returns actual sensorvalues
00050         @param sensors sensors scaled to [-1,1] 
00051         @param sensornumber length of the sensor array
00052         @return number of actually written sensors
00053     */
00054     virtual int getSensors(sensor* sensors, int sensornumber);
00055 
00056     /** sets actual motorcommands
00057         @param motors motors scaled to [-1,1] 
00058         @param motornumber length of the motor array
00059     */
00060     virtual void setMotors(const motor* motors, int motornumber);
00061 
00062     /** returns number of sensors
00063      */
00064     virtual int getSensorNumber() {return sensorno; }
00065 
00066     /** returns number of motors
00067      */
00068     virtual int getMotorNumber() {return motorno; }
00069 
00070     /** this function is called in each timestep. It should perform robot-internal checks, 
00071         like space-internal collision detection, sensor resets/update etc.
00072         @param globalData structure that contains global data from the simulation environment
00073     */
00074     virtual void doInternalStuff(GlobalData& globalData) {}
00075 
00076   protected:
00077     /** the main object of the robot, which is used for position and speed tracking */
00078     virtual Primitive* getMainPrimitive() const { return dummy; }
00079 
00080   protected:
00081     DummyPrimitive *dummy; 
00082     int sensorno;      //number of sensors
00083     int motorno;       // number of motors
00084     motor* motors;
00085   } ;
00086 
00087 }
00088 
00089 #endif
00090  
Generated on Thu Jun 28 14:45:37 2012 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.6.3