00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #ifndef ARACTIONGOTOSTRAIGHT_H
00027 #define ARACTIONGOTOSTRAIGHT_H
00028 
00029 #include "ariaTypedefs.h"
00030 #include "ariaUtil.h"
00031 #include "ArAction.h"
00032 
00034 
00055 class ArActionGotoStraight : public ArAction
00056 {
00057 public:
00058   AREXPORT ArActionGotoStraight(const char *name = "goto", 
00059                 double speed = 400);
00060   AREXPORT virtual ~ArActionGotoStraight();
00061 
00063   AREXPORT bool haveAchievedGoal(void);
00065   AREXPORT void cancelGoal(void);
00067   AREXPORT void setGoal(ArPose goal, bool backwards = false, 
00068             bool justDistance = true);
00070   AREXPORT void setGoalRel(double dist, double deltaHeading, 
00071                bool backwards = false, bool justDistance = true);
00073   ArPose getGoal(void) { return myGoal; }
00075   bool usingEncoderGoal(void) { return myUseEncoderGoal; }
00077   AREXPORT void setEncoderGoal(ArPose encoderGoal, bool backwards = false,
00078                    bool justDistance = true);
00080   AREXPORT void setEncoderGoalRel(double dist, double deltaHeading, 
00081                   bool backwards = false, 
00082                   bool justDistance = true);
00084   ArPose getEncoderGoal(void) { return myEncoderGoal; }
00086   void setSpeed(double speed) { mySpeed = speed; }
00088   double getSpeed(void) { return mySpeed; }
00090   void setCloseDist(double closeDist = 100) { myCloseDist = closeDist; } 
00092   double getCloseDist(void) { return myCloseDist; }
00094   bool getBacking(void) { return myBacking; }
00095   AREXPORT virtual ArActionDesired *fire(ArActionDesired currentDesired);
00096   AREXPORT virtual ArActionDesired *getDesired(void) { return &myDesired; }
00097 #ifndef SWIG
00098   AREXPORT virtual const ArActionDesired *getDesired(void) const 
00099                                                         { return &myDesired; }
00100 #endif
00101 protected:
00102   ArPose myGoal;
00103   bool myUseEncoderGoal;
00104   ArPose myEncoderGoal;
00105   double mySpeed;
00106   bool myBacking;
00107   ArActionDesired myDesired;
00108   bool myPrinting;
00109   double myDist;
00110   double myCloseDist;
00111 
00112   bool myJustDist;
00113 
00114   double myDistTravelled;
00115   ArPose myLastPose;
00116   
00117   enum State
00118   {
00119     STATE_NO_GOAL, 
00120     STATE_ACHIEVED_GOAL,
00121     STATE_GOING_TO_GOAL
00122   };
00123   State myState;
00124 };
00125 
00126 #endif // ARACTIONGOTO