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 
00027 #ifndef ARACTIONGOTOSTRAIGHT_H
00028 #define ARACTIONGOTOSTRAIGHT_H
00029 
00030 #include "ariaTypedefs.h"
00031 #include "ariaUtil.h"
00032 #include "ArAction.h"
00033 
00035 
00056 class ArActionGotoStraight : public ArAction
00057 {
00058 public:
00059   ArActionGotoStraight(const char *name = "goto", 
00060                                 double speed = 400);
00061   virtual ~ArActionGotoStraight();
00062 
00064   bool haveAchievedGoal(void);
00066   void cancelGoal(void);
00068   void setGoal(ArPose goal, bool backwards = false, 
00069                         bool justDistance = true);
00071   void setGoalRel(double dist, double deltaHeading, 
00072                            bool backwards = false, bool justDistance = true);
00074   ArPose getGoal(void) { return myGoal; }
00076   bool usingEncoderGoal(void) { return myUseEncoderGoal; }
00078   void setEncoderGoal(ArPose encoderGoal, bool backwards = false,
00079                                bool justDistance = true);
00081   void setEncoderGoalRel(double dist, double deltaHeading, 
00082                                   bool backwards = false, 
00083                                   bool justDistance = true);
00085   ArPose getEncoderGoal(void) { return myEncoderGoal; }
00087   void setSpeed(double speed) { mySpeed = speed; }
00089   double getSpeed(void) { return mySpeed; }
00091   void setCloseDist(double closeDist = 100) { myCloseDist = closeDist; } 
00093   double getCloseDist(void) { return myCloseDist; }
00095   bool getBacking(void) { return myBacking; }
00096   virtual ArActionDesired *fire(ArActionDesired currentDesired);
00097   virtual ArActionDesired *getDesired(void) { return &myDesired; }
00098 protected:
00099   ArPose myGoal;
00100   bool myUseEncoderGoal;
00101   ArPose myEncoderGoal;
00102   double mySpeed;
00103   bool myBacking;
00104   ArActionDesired myDesired;
00105   bool myPrinting;
00106   double myDist;
00107   double myCloseDist;
00108 
00109   bool myJustDist;
00110 
00111   double myDistTravelled;
00112   ArPose myLastPose;
00113   
00114   enum State
00115   {
00116     STATE_NO_GOAL, 
00117     STATE_ACHIEVED_GOAL,
00118     STATE_GOING_TO_GOAL
00119   };
00120   State myState;
00121 };
00122 
00123 #endif // ARACTIONGOTO