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

ArACTS.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 ARACTS_H
00027 #define ARACTS_H
00028 
00029 #include "ariaTypedefs.h"
00030 #include "ArTcpConnection.h"
00031 #include "ariaUtil.h"
00032 #include "ArRobot.h"
00033 
00034 
00036 class ArACTSBlob
00037 {
00038 public:
00040   ArACTSBlob() {}
00042   virtual ~ArACTSBlob() {}
00044   int getArea(void) { return myArea; }
00046   int getXCG(void) { return myXCG; }
00048   int getYCG(void) { return myYCG; }
00050   int getLeft(void) { return myLeft; }
00052   int getRight(void) { return myRight; }
00054   int getTop(void) { return myTop; }
00056   int getBottom(void) { return myBottom; }
00058   void setArea(int area) { myArea = area; }
00060   void setXCG(int xcg) { myXCG = xcg; }
00062   void setYCG(int ycg) { myYCG = ycg; }
00064   void setLeft(int left) { myLeft = left; }
00066   void setRight(int right) { myRight = right; }
00068   void setTop(int top) { myTop = top; }
00070   void setBottom(int bottom) { myBottom = bottom; }
00072   void log(void)
00073     {
00074       ArLog::log(ArLog::Terse, "Area: %3d X: %3d Y: %3d l: %3d r: %3d t: %3d: b: %3d", 
00075          myArea, myXCG, myYCG, myLeft, myRight, myTop, myBottom);
00076     }
00077 protected:
00078   int myArea; 
00079   int myXCG;
00080   int myYCG;
00081   int myLeft;
00082   int myRight;
00083   int myTop;
00084   int myBottom;
00085 };
00086 
00088 class ArACTS_1_2
00089 {
00090 public:
00092   AREXPORT ArACTS_1_2();
00094   AREXPORT virtual ~ArACTS_1_2();
00095 
00097   AREXPORT bool openPort(ArRobot *robot, const char *host = "localhost", int port = 5001);
00099   AREXPORT bool closePort(void);
00100 
00102   AREXPORT bool isConnected(void);
00103 
00105   AREXPORT ArRobot *getRobot(void);
00107   AREXPORT void setRobot(ArRobot *robot);
00108 
00110   AREXPORT bool requestPacket(void);
00112   AREXPORT bool requestQuit(void);
00114   AREXPORT bool receiveBlobInfo(void);
00115   
00117   AREXPORT int getNumBlobs(int channel);
00118   
00120   AREXPORT bool getBlob(int channel, int blobNumber, ArACTSBlob *blob);
00121 
00123   AREXPORT void actsHandler(void);
00124   
00125   enum ActsConstants
00126   {
00127     NUM_CHANNELS = 32, 
00128     MAX_BLOBS = 10, 
00129     ACTS_BLOB_DATA_SIZE = 16, 
00130     DATA_HEADER = NUM_CHANNELS * 4, 
00131     MAX_DATA = 5300 
00132   };
00134   AREXPORT void invert(int width = 160, int height = 120);
00135 protected:
00136   int invertX(int before);
00137   int invertY(int before);
00139   int getData(char *rawData);
00140   ArFunctorC<ArACTS_1_2> mySensorTaskCB;
00141   ArRobot *myRobot;
00142   ArTcpConnection myConn;
00143   int myBlobNum[NUM_CHANNELS];
00144   int myBlobIndex[NUM_CHANNELS];
00145   char myData[MAX_DATA];
00146   bool myBlobsBad;
00147   bool myRequested;
00148   // these are for flipping the image
00149   bool myInverted;
00150   int myHeight;
00151   int myWidth;
00152 };
00153 
00154 #endif

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