trackrobots.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: trackrobots.h,v $
00023  *   Revision 1.1.2.3  2006/03/31 16:18:32  fhesse
00024  *   tracing in oderagent via trackrobots
00025  *
00026  *   Revision 1.1.2.2  2006/03/30 12:33:15  fhesse
00027  *   trace via trackrobot
00028  *
00029  *   Revision 1.1.2.1  2005/11/16 11:24:27  martius
00030  *   moved to selforg
00031  *
00032  *   Revision 1.4  2005/11/10 09:08:26  martius
00033  *   trace has a name
00034  *
00035  *   Revision 1.3  2005/11/09 13:31:51  martius
00036  *   GPL'ised
00037  *
00038  ***************************************************************************/
00039 #ifndef __TRACKROBOTS_H
00040 #define __TRACKROBOTS_H
00041 
00042 #include <stdio.h>
00043 #include <string.h>
00044 
00045 class AbstractRobot;
00046 class Agent;
00047 
00048 class TrackRobot {
00049 public:
00050 
00051   friend class Agent;
00052   //friend class OdeAgent;
00053 
00054   TrackRobot(){
00055     trackPos = false;
00056     trackSpeed = false;
00057     trackOrientation = false;
00058     tracePos = false;
00059     interval = 1;
00060     file=0;
00061     cnt=0;
00062     scene=0;
00063   }
00064   /** Set the tracking mode of the simulation environment. 
00065       If one of the trackparameters is true the tracking is enabled.
00066       The tracking is written into a file with the current date and time as name.
00067       If tracePos is ture (at least in ode simulations) the trace of the robot is shown
00068    */ 
00069   TrackRobot(bool trackPos, bool trackSpeed, bool trackOrientation, bool tracePos, 
00070              const char* scene, int interval = 1){
00071     this->trackPos     = trackPos;
00072     this->trackSpeed   = trackSpeed;
00073     this->trackOrientation = trackOrientation;
00074     this->tracePos     = tracePos;
00075     this->interval = interval;
00076     this->scene = strdup(scene);
00077     file=0;
00078     cnt=0;
00079   }
00080 
00081   ~TrackRobot(){
00082     if(scene) free(scene);
00083   }
00084 
00085   bool open(const AbstractRobot* robot);
00086   void track(AbstractRobot* robot);
00087   void close();
00088 
00089   //todo: do this with friend class OdeAgent or the like
00090   bool trace() const {return tracePos;};
00091 
00092  private:
00093   bool trackPos;
00094   bool trackSpeed;
00095   bool trackOrientation;
00096   bool tracePos;
00097 
00098   int interval;
00099   FILE* file;
00100   char* scene;
00101   long cnt;
00102 };
00103 
00104 
00105 
00106 #endif

Generated on Tue Apr 4 19:05:04 2006 for Robotsystem from Robot Group Leipzig by  doxygen 1.4.5