ArActionDriveDistance.h

00001 /*
00002 MobileRobots Advanced Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004,2005 ActivMedia Robotics LLC
00004 Copyright (C) 2006 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 ARACTIONDRIVEDISTANCE_H
00027 #define ARACTIONDRIVEDISTANCE_H
00028 
00029 #include "ariaTypedefs.h"
00030 #include "ariaUtil.h"
00031 #include "ArAction.h"
00032 
00034 
00054 class ArActionDriveDistance : public ArAction
00055 {
00056 public:
00057   AREXPORT ArActionDriveDistance(const char *name = "driveDistance", 
00058                 double speed = 400, double deceleration = 200);
00059   AREXPORT virtual ~ArActionDriveDistance();
00060 
00062   AREXPORT bool haveAchievedDistance(void);
00064   AREXPORT void cancelDistance(void);
00066   AREXPORT void setDistance(double distance, bool useEncoders = true);
00068   bool usingEncoders(void) { return myUseEncoders; }
00070   void setSpeed(double speed = 400) { mySpeed = speed; }
00072   double getSpeed(void) { return mySpeed; }
00074   void setDeceleration(double deceleration = 200) 
00075     { myDeceleration = deceleration; }
00077   double getDeceleration(void) { return myDeceleration; }
00079   void setPrinting(bool printing) { myPrinting = printing; }
00080   AREXPORT virtual ArActionDesired *fire(ArActionDesired currentDesired);
00081   AREXPORT virtual ArActionDesired *getDesired(void) { return &myDesired; }
00082 #ifndef SWIG
00083   AREXPORT virtual const ArActionDesired *getDesired(void) const 
00084                                                         { return &myDesired; }
00085 #endif
00086 protected:
00087   double myDistance;
00088   bool myUseEncoders;
00089   double mySpeed;
00090   double myDeceleration;
00091   ArActionDesired myDesired;
00092   bool myPrinting;
00093   double myLastVel;
00094 
00095   double myDistTravelled;
00096   ArPose myLastPose;
00097   
00098   enum State
00099   {
00100     STATE_NO_DISTANCE, 
00101     STATE_ACHIEVED_DISTANCE,
00102     STATE_GOING_DISTANCE
00103   };
00104   State myState;
00105 };
00106 
00107 #endif // ARACTIONDRIVE

Generated on Fri Dec 1 10:55:11 2006 for Aria by  doxygen 1.4.7