Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages | Examples

ArDataLogger.h

00001 /*
00002 MobileRobots Advanced Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004, 2005 ActivMedia Robotics LLC
00004 Copyright (C) 2006, 2007 MobileRobots Inc.
00005 
00006      This program is free software; you can redistribute it and/or modify
00007      it under the terms of the GNU General Public License as published by
00008      the Free Software Foundation; either version 2 of the License, or
00009      (at your option) any later version.
00010 
00011      This program is distributed in the hope that it will be useful,
00012      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014      GNU General Public License for more details.
00015 
00016      You should have received a copy of the GNU General Public License
00017      along with this program; if not, write to the Free Software
00018      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 If you wish to redistribute ARIA under different terms, contact 
00021 MobileRobots for information about a commercial version of ARIA at 
00022 robots@mobilerobots.com or 
00023 MobileRobots Inc, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 */
00025 
00026 #ifndef ARDATALOGGER_H
00027 #define ARDATALOGGER_H
00028 
00029 #include "ariaUtil.h"
00030 #include "ArMutex.h"
00031 #include "ArFunctor.h"
00032 #include <vector>
00033 
00034 class ArRobot;
00035 class ArConfig;
00036 
00037 
00039 
00046 class ArDataLogger
00047 {
00048 public:
00050   AREXPORT ArDataLogger(ArRobot *robot, const char *fileName = NULL);
00052   AREXPORT ~ArDataLogger();
00054   AREXPORT void addToConfig(ArConfig *config);
00056   AREXPORT void addString(const char *name, ArTypes::UByte2 maxLen, 
00057               ArFunctor2<char *, ArTypes::UByte2> *functor);
00058 
00060   ArFunctor3<const char *, ArTypes::UByte2,
00061                     ArFunctor2<char *, ArTypes::UByte2> *> *
00062                      getAddStringFunctor(void) { return &myAddStringFunctor; }
00063 
00064 protected:
00065   AREXPORT void connectCallback(void);
00066   AREXPORT bool processFile(char *errorBuffer, size_t errorBufferLen);
00067   AREXPORT void userTask(void);
00068   ArRobot *myRobot;
00069   ArTime myLastLogged;
00070   ArConfig *myConfig;
00071   bool myAddToConfigAtConnect;
00072   bool myAddedToConfig;
00073 
00074   FILE *myFile;
00075   bool myConfigLogging;
00076   int myConfigLogInterval;
00077   char myOpenedFileName[512];
00078   char myConfigFileName[512];
00079   std::string myPermanentFileName;
00080 
00081   // for what we're logging
00082   bool myLogVoltage;
00083   bool myLogLeftVel;
00084   bool myLogRightVel;
00085   bool myLogTransVel;
00086   bool myLogRotVel;
00087   bool myLogLeftStalled;
00088   bool myLogRightStalled;
00089   bool myLogStallBits;
00090   bool myLogFlags;
00091   int myAnalogCount;
00092   bool *myAnalogEnabled;
00093   int myAnalogVoltageCount;
00094   bool *myAnalogVoltageEnabled;
00095   int myDigInCount;
00096   bool *myDigInEnabled;
00097   int myDigOutCount;
00098   bool *myDigOutEnabled;
00099   bool myLogPose;
00100   bool myLogEncoderPose;
00101   bool myLogCorrectedEncoderPose;
00102   bool myLogEncoders;
00103   int myStringsCount;
00104   std::vector<bool *> myStringsEnabled;
00105   ArMutex myMutex;
00106 
00107   std::vector<ArStringInfoHolder *> myStrings;
00108   ArTypes::UByte2 myMaxMaxLength;
00109   ArFunctor3C<ArDataLogger, const char *, ArTypes::UByte2,
00110             ArFunctor2<char *, ArTypes::UByte2> *> myAddStringFunctor;
00111   
00112 
00113   ArFunctorC<ArDataLogger> myConnectCB;  
00114   ArRetFunctor2C<bool, ArDataLogger, char *, size_t> myProcessFileCB;
00115   ArFunctorC<ArDataLogger> myUserTaskCB;
00116 };
00117 
00118 #endif // ARDATALOGGER_H

Generated on Tue Feb 20 10:51:39 2007 for Aria by  doxygen 1.4.0