move.hh

00001 #ifndef MOVE_H
00002 # define MOVE_H
00003 
00004 # include <list>
00005 # include <string>
00006 
00007 # include "urbi/uclient.hh"
00008 
00009 namespace urbi
00010 {
00024   struct MovementProperties
00025   {
00026     float maxSpeed; //  m/s, deg/s
00027     float minSpeed;
00028     float resolution; //min move value (m,deg)
00029     float precision;  //will move by resolution+/-resolution*precision
00030   };
00031 
00032   struct LoadedFile
00033   {
00034     char name[256];
00035     float speed;
00036     float value;
00037     float precision;
00038   };
00039 
00040   class Move
00041   {
00042   public:
00043     int initialize(UClient * client, bool uploadFiles=true, const char * configFile="moveconfig", bool enableInterrupt=false);
00044     const MovementProperties& getWalkProperties ()
00045     {
00046       return pwalk;
00047     }
00048     const MovementProperties& getTurnProperties ()
00049     {
00050       return pturn;
00051     }
00052     int walk(float &distance, float relativePrecision,const char * tag=NULL);
00053     int turn(float &angle,  float relativePrecision, const char * tag=NULL);
00055     void interrupt(bool notifyEndMove);
00056     UCallbackAction moveEnd(const UMessage &msg);
00057     UClient * getConnection ()
00058     {
00059       return robot;
00060     }
00061     //attempt to break movement, still call endmove
00062 
00063   private:
00064     UClient * robot;
00065     UClient * interruptConnection;
00066     MovementProperties pwalk, pturn;
00067     std::list<LoadedFile> walks;
00068     std::list<LoadedFile> turns;
00069     char tag[64]; //our unique tag to mark end.
00070     int moving; //curently moving
00071     char usertag[URBI_MAX_TAG_LENGTH]; //user tag
00072     char execTag[URBI_MAX_TAG_LENGTH];
00073     std::list<std::string> sequence; //move/walk commands not yet sent to server
00074   };
00075 
00076 } // namespace urbi
00077 #endif

Generated on Tue Apr 10 17:45:44 2007 for URBISDK by  doxygen 1.5.1