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

ArRangeBuffer.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 ARRANGEBUFFER_H
00027 #define ARRANGEBUFFER_H
00028 
00029 #include "ariaUtil.h"
00030 #include "ariaTypedefs.h"
00031 #include "ArTransform.h"
00032 #include <list>
00033 #include <vector>
00034 
00036 class ArRangeBuffer
00037 {
00038 public:
00040   AREXPORT ArRangeBuffer(int size);
00042   AREXPORT virtual ~ArRangeBuffer();
00044   AREXPORT size_t getSize(void) const;
00046   AREXPORT void setSize(size_t size);
00048   AREXPORT ArPose getPoseTaken() const;
00050   AREXPORT void setPoseTaken(ArPose p);
00052   AREXPORT ArPose getEncoderPoseTaken() const;
00054   AREXPORT void setEncoderPoseTaken(ArPose p);
00056   AREXPORT void addReading(double x, double y);  
00058   AREXPORT void beginInvalidationSweep(void);
00060   AREXPORT void invalidateReading(std::list<ArPoseWithTime*>::iterator readingIt);
00062   AREXPORT void endInvalidationSweep(void);
00063 #ifndef SWIG
00064 
00067   AREXPORT const std::list<ArPoseWithTime *> *getBuffer(void) const;
00068 #endif
00069 
00070   AREXPORT std::list<ArPoseWithTime *> *getBuffer(void);
00071 
00073   AREXPORT double getClosestPolar(double startAngle, double endAngle, 
00074                   ArPose position, unsigned int maxRange,
00075                   double *angle = NULL) const;
00077   AREXPORT double getClosestBox(double x1, double y1, double x2, double y2,
00078                 ArPose position, unsigned int maxRange, 
00079                 ArPose *readingPos = NULL,
00080                 ArPose targetPose = ArPose(0, 0, 0)) const;
00082   AREXPORT void applyTransform(ArTransform trans);
00084   AREXPORT void clear(void);
00086   AREXPORT void clearOlderThan(int milliSeconds);
00088   AREXPORT void clearOlderThanSeconds(int seconds);
00090   AREXPORT void reset(void);
00092   AREXPORT void beginRedoBuffer(void);
00094   AREXPORT void redoReading(double x, double y);   
00096   AREXPORT void endRedoBuffer(void);
00098   AREXPORT std::vector<ArPoseWithTime> *getBufferAsVector(void);
00100   AREXPORT static double getClosestPolarInList(
00101       double startAngle, double endAngle, ArPose position, 
00102       unsigned int maxRange, double *angle, 
00103       const std::list<ArPoseWithTime *> *buffer);
00105   AREXPORT static double getClosestBoxInList(
00106       double x1, double y1, double x2, double y2, ArPose position, 
00107       unsigned int maxRange, ArPose *readingPos, 
00108       ArPose targetPose, const std::list<ArPoseWithTime *> *buffer);
00109 protected:
00110   std::vector<ArPoseWithTime> myVector;
00111   ArPose myBufferPose;      // where the robot was when readings were acquired
00112   ArPose myEncoderBufferPose;       // where the robot was when readings were acquired
00113 
00114   std::list<ArPoseWithTime *> myBuffer;
00115   std::list<ArPoseWithTime *> myInvalidBuffer;
00116   std::list<std::list<ArPoseWithTime *>::iterator > myInvalidSweepList;
00117   std::list<std::list<ArPoseWithTime *>::iterator >::iterator myInvalidIt;
00118   std::list<ArPoseWithTime *>::iterator myRedoIt;
00119   int myNumRedone;
00120   bool myHitEnd;
00121   
00122   size_t mySize;
00123   std::list<ArPoseWithTime *>::reverse_iterator myRevIterator;
00124   std::list<ArPoseWithTime *>::iterator myIterator;
00125   
00126   ArPoseWithTime * myReading;
00127 };
00128 
00129 #endif // ARRANGEBUFFER_H

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