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

ArRangeBuffer.h

00001 /*
00002 ActivMedia Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004,2005 ActivMedia Robotics, LLC
00004 
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 ActivMedia Robotics for information about a commercial version of ARIA at 
00022 robots@activmedia.com or 
00023 ActivMedia Robotics, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 
00025 */
00026 
00027 #ifndef ARRANGEBUFFER_H
00028 #define ARRANGEBUFFER_H
00029 
00030 #include "ariaUtil.h"
00031 #include "ariaTypedefs.h"
00032 #include "ArTransform.h"
00033 #include <list>
00034 #include <vector>
00035 
00037 class ArRangeBuffer
00038 {
00039 public:
00041   ArRangeBuffer(int size);
00043   virtual ~ArRangeBuffer();
00045   size_t getSize(void) const;
00047   void setSize(size_t size);
00049   ArPose getPoseTaken() const;
00051   void setPoseTaken(ArPose p);
00053   ArPose getEncoderPoseTaken() const;
00055   void setEncoderPoseTaken(ArPose p);
00057   void addReading(double x, double y);  
00059   void beginInvalidationSweep(void);
00061   void invalidateReading(std::list<ArPoseWithTime*>::iterator readingIt);
00063   void endInvalidationSweep(void);
00064 #ifndef SWIG
00065 
00066   const std::list<ArPoseWithTime *> *getBuffer(void) const;
00067 #endif
00068 
00069   std::list<ArPoseWithTime *> *getBuffer(void);
00070 
00072   double getClosestPolar(double startAngle, double endAngle, 
00073                                   ArPose position, unsigned int maxRange,
00074                                   double *angle = NULL) const;
00076   double getClosestBox(double x1, double y1, double x2, double y2,
00077                                 ArPose position, unsigned int maxRange, 
00078                                 ArPose *readingPos = NULL,
00079                                 ArPose targetPose = ArPose(0, 0, 0)) const;
00081   void applyTransform(ArTransform trans);
00083   void clear(void);
00085   void clearOlderThan(int milliSeconds);
00087   void clearOlderThanSeconds(int seconds);
00089   void reset(void);
00091   void beginRedoBuffer(void);
00093   void redoReading(double x, double y);   
00095   void endRedoBuffer(void);
00097   std::vector<ArPoseWithTime> *getBufferAsVector(void);
00099   static double getClosestPolarInList(
00100           double startAngle, double endAngle, ArPose position, 
00101           unsigned int maxRange, double *angle, 
00102           const std::list<ArPoseWithTime *> *buffer);
00104   static double getClosestBoxInList(
00105           double x1, double y1, double x2, double y2, ArPose position, 
00106           unsigned int maxRange, ArPose *readingPos, 
00107           ArPose targetPose, const std::list<ArPoseWithTime *> *buffer);
00108 protected:
00109   std::vector<ArPoseWithTime> myVector;
00110   ArPose myBufferPose;          // where the robot was when readings were acquired
00111   ArPose myEncoderBufferPose;           // where the robot was when readings were acquired
00112 
00113   std::list<ArPoseWithTime *> myBuffer;
00114   std::list<ArPoseWithTime *> myInvalidBuffer;
00115   std::list<std::list<ArPoseWithTime *>::iterator > myInvalidSweepList;
00116   std::list<std::list<ArPoseWithTime *>::iterator >::iterator myInvalidIt;
00117   std::list<ArPoseWithTime *>::iterator myRedoIt;
00118   int myNumRedone;
00119   bool myHitEnd;
00120   
00121   size_t mySize;
00122   std::list<ArPoseWithTime *>::reverse_iterator myRevIterator;
00123   std::list<ArPoseWithTime *>::iterator myIterator;
00124   
00125   ArPoseWithTime * myReading;
00126 };
00127 
00128 #endif // ARRANGEBUFFER_H

Generated on Wed Oct 19 12:56:36 2005 for Aria by  doxygen 1.4.0