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

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

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