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 ARACTIONSTALLRECOVER_H
00027 #define ARACTIONSTALLRECOVER_H
00028
00029 #include "ariaTypedefs.h"
00030 #include "ArAction.h"
00031
00032 class ArResolver;
00033
00035
00039 class ArActionStallRecover : public ArAction
00040 {
00041 public:
00043 AREXPORT ArActionStallRecover(const char * name = "stall recover",
00044 double obstacleDistance = 225, int cyclesToMove = 50,
00045 double speed = 150, double degreesToTurn = 45);
00047 AREXPORT virtual ~ArActionStallRecover();
00048 AREXPORT virtual ArActionDesired *fire(ArActionDesired currentDesired);
00049 AREXPORT virtual ArActionDesired *getDesired(void)
00050 { return &myActionDesired; }
00051 #ifndef SWIG
00052 AREXPORT virtual const ArActionDesired *getDesired(void) const
00053 { return &myActionDesired; }
00054 #endif
00055 AREXPORT void addToConfig(ArConfig* config, const char* sectionName, int priority = ArPriority::NORMAL);
00056 protected:
00057
00058 void doit(void);
00059 void addSequence(int sequence);
00060 int myDoing;
00061 int myState;
00062 int myCount;
00063 int mySideStalled;
00064
00065 enum State
00066 {
00067 STATE_NOTHING = 0,
00068 STATE_GOING
00069 };
00070
00071 enum What
00072 {
00073 BACK=0x1,
00074 FORWARD=0x2,
00075 TURN=0x4,
00076 TURN_LEFT=0x8,
00077 TURN_RIGHT=0x10,
00078 MOVEMASK = BACK | FORWARD,
00079 TURNMASK = TURN | TURN_LEFT | TURN_RIGHT
00080 };
00081
00082 std::map<int, int> mySequence;
00083 int mySequenceNum;
00084 int mySequencePos;
00085 time_t myLastFired;
00086 double myObstacleDistance;
00087 int myCyclesToMove;
00088 double mySpeed;
00089 int myCyclesToTurn;
00090 double myDegreesToTurn;
00091 double myDesiredHeading;
00092 ArActionDesired myActionDesired;
00093
00094 ArResolver *myResolver;
00095 };
00096
00097 #endif //ARACTIONSTALLRECOVER_H