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

ArActionColorFollow.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 ARACTIONCOLORFOLLOW_H
00027 #define ARACTIONCOLORFOLLOW_H
00028 
00029 #include "ariaTypedefs.h"
00030 #include "ariaUtil.h"
00031 #include "ArFunctor.h"
00032 #include "ArAction.h"
00033 #include "ArACTS.h"
00034 #include "ArPTZ.h"
00035 
00038 class ArActionColorFollow : public ArAction
00039 {
00040   
00041 public:
00042   // Constructor
00043   AREXPORT ArActionColorFollow(const char *name, 
00044                    ArACTS_1_2 *acts,
00045                    ArPTZ *camera,
00046                    double speed = 200, 
00047                    int width = 160, 
00048                    int height = 120);
00049   
00050   // Destructor
00051   AREXPORT virtual ~ArActionColorFollow(void);
00052   
00053   // The action
00054   AREXPORT virtual ArActionDesired *fire(ArActionDesired currentDesired);
00055 
00056   // Set the ACTS channel that we want to get blob info out of
00057   AREXPORT bool setChannel(int channel);
00058 
00059   // Set the camera that we will be controlling
00060   AREXPORT void setCamera(ArPTZ *camera);
00061 
00062   // Toggle whether we should try to acquire a blob
00063   // if one cannot be seen
00064   AREXPORT void setAcquire(bool acquire);
00065 
00066   // Stop moving alltogether
00067   AREXPORT void stopMovement(void);
00068   
00069   // Start moving
00070   AREXPORT void startMovement(void);
00071 
00072   // Return the channel that we are looking for blobs on
00073   AREXPORT int getChannel();
00074   
00075   // Return whether or not we are trying to acquire a blob
00076   // if we cannot see one
00077   AREXPORT bool getAcquire();
00078   
00079   // Return whether or not we are moving
00080   AREXPORT bool getMovement();
00081 
00082   // Return whether or not we can see a target
00083   AREXPORT bool getBlob();
00084 
00085   // The state of the action
00086   enum TargetState 
00087   {
00088     NO_TARGET,      // There is no target in view
00089     TARGET          // There is a target in view
00090   };
00091 
00092   // The state of movement
00093   enum MoveState
00094   {
00095     FOLLOWING,     // Following a blob
00096     ACQUIRING,     // Searching for a blob
00097     STOPPED        // Sitting still
00098   };
00099 
00100   // The last seen location of the blob
00101   enum LocationState
00102   {
00103     LEFT,           // The blob is on the left side of the screen
00104     RIGHT,          // The blob is on the right side of the screen
00105     CENTER          // The blob is relatively close to the center
00106   };
00107   AREXPORT virtual ArActionDesired *getDesired(void) { return &myDesired; }
00108 #ifndef SWIG
00109   AREXPORT virtual const ArActionDesired *getDesired(void) const 
00110                                                         { return &myDesired; }
00111 #endif
00112 protected:
00113   ArActionDesired myDesired;
00114   ArACTS_1_2 *myActs;
00115   ArPTZ *myCamera;
00116   ArTime myLastSeen;
00117   TargetState myState;
00118   MoveState myMove;
00119   LocationState myLocation;
00120   bool myAcquire;
00121   bool killMovement;
00122   int myChannel;
00123   int myMaxTime;
00124   int myHeight;
00125   int myWidth;
00126   double mySpeed;
00127 };
00128 
00129 
00130 #endif // ARACTIONCOLORFOLLOW_H

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