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 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