Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ManualController.h

Go to the documentation of this file.
00001 
00002 //
00003 //       Title           : ManualController.hpp
00004 //       Project         : D&D
00005 //       Created         : Thursday  August 1, 1996
00006 //       Author          : Mitch Pryor & Chetan Kapoor
00007 //       Platforms       : WIN32                        
00008 //       Copyright       : The University of Texas at Austin
00009 //                         All Rights Reserved.
00010 //       Access          : Company Confidential
00011 //       Purpose         : develop a class hierarchy for manual controllers             
00012 //
00013 //-------------------------------------------------------------------------
00014 //
00015 //       Classes:
00016 //               ManualController
00017 //
00018 //       Global Functions:
00019 //               <none>
00020 //
00021 //       Global Variables:
00022 //               <none>
00023 //
00024 //-------------------------------------------------------------------------
00025 //
00026 //       $Revisions$
00027 //          Modified June 9, 1998 by Chalongrath Pholsiri
00028 //                      Added collsion avoidance stuff April 15, 1999 by Chalongrath Pholsiri
00029 //                      Added client-server capability July 9, 1999 by Chalongrath Pholsiri
00030 //
00031 //       $Log: ManualController.h,v $
00032 //       Revision 1.3  2005/03/14 21:54:08  pmarch
00033 //       Added to namespace OSCAR and removed "RR" from front of class names.
00034 //
00035 //       Revision 1.2  2004/05/27 19:24:04  pmarch
00036 //       Added /defgroup and /ingroup tags.
00037 //
00038 //       Revision 1.1  2003/08/18 21:23:27  pmarch
00039 //       Initial commit of ManualController
00040 //
00041 //
00043 #ifndef ManualController_h
00044 #define ManualController_h
00045 
00046 #include "Base/Base.h"
00047 #include "Base/CommIncludes.h"
00048 #include "Math/Vector.h"
00049 #include "FileData/MatrixData.h"
00050 #include "Math/Matrix.h"
00051 #include "Math/HandPose.h"
00052 #include "Math/MathUtilities.h"
00053 #include "PCSHandPose.h"
00054 #include "Communications/TCP.h"
00055 
00056 #define LISA_IP_ADDRESS "129.116.146.242"
00057 #define BUZZ_IP_ADDRESS "129.116.140.120"
00058 
00060 namespace OSCAR {
00061 
00066   class ManualController : public virtual Base
00067   {
00068           public:
00069                   enum MC_TYPE {LOCAL, SERVER, CLIENT};
00070                   //constructors
00071                   ManualController(int numberOfButtons,
00072                                                           int numberOfDeltas,
00073                                                           const HandPose& startingHand,
00074                                                           const String& name, MC_TYPE type);
00075                   
00076                   //destuctor
00077                   virtual ~ManualController();
00078 
00079                   //public methods
00080                   const int GetNumberOfButtons();
00081                   const int GetNumberOfDeltas();
00082                   const int GetCurrentHand(HandPose& currentHand);
00083                   const int GetCurrentButtonStatus(Vector& buttons);
00084                   const int GetCurrentButtonPressed();
00085                   const int GetDeltas(Vector& deltas);
00086                                   
00087                   int SetCurrentHand(HandPose& currenthand);
00088 
00089                   int SetDeltaMaximums(Vector& deltaMaximums);
00090                   int SetADeltaMaximum(int number, double newDelta);
00091                   int GetDeltaMaximums(Vector& deltaMaximums) const;
00092                   
00093                   int SetDeltaScaling(Vector& deltaScaling);
00094                   int SetADeltaScaler(int number, double newScaler);
00095                   int GetDeltaScaling(Vector& deltaScaling) const;
00096 
00097                   void SetDeltaScalerOn();
00098                   void SetDeltaScalerOff();
00099                   void SetDeltaCheckerOn();
00100                   void SetDeltaCheckerOff();
00101 
00102                   void SetDominantAxisOn(bool on);
00103                   void SetRotationOn(bool on);
00104                   void SetTranslationOn(bool on);
00105 
00106       void SetMapAxesOn(){MAPAXES=true;}
00107       void SetMapAxesOff(){MAPAXES=false;}
00108       void SetAxisMap(Rot3by3& _axisMap); //used for mapping controller axes to 
00109                                             //application axes
00110       void SetDomAxisOn(){DOMINANT_AXIS = true;}
00111       void SetDomAxisOff(){DOMINANT_AXIS = false;}
00112 
00113                   // Notify server of quitting
00114                   int SendQuitMessage();
00115 
00116                   // pure virtual functions
00117                   virtual int Initialize() = 0;
00118                   virtual int GetPacketFromMC() = 0;
00119                   virtual int GetPacketFromServer() = 0;
00120                   virtual int Listen() = 0;
00121                   
00122           protected:
00123                   //protected data members
00124                   int             numberOfButtons;
00125                   int             numberOfDeltas;
00126                   int                           buttonPressed;
00127                   Vector                *buttons;
00128                   HandPose      currentHand;
00129   //        PCSHandPose   currentPCSHand;
00130                   Vector                *deltas;
00131                   Vector                *deltaScaling;
00132                   Vector                *deltaMaximums;
00133                   
00134                   BOOL ISINITIALIZED;
00135                   BOOL DELTASCALER;
00136                   BOOL DELTACHECKER;
00137                   BOOL AVOIDANCE;
00138       BOOL MAPAXES;
00139       bool DOMINANT_AXIS;
00140 
00141                   // client-server related members
00142                   MC_TYPE                       type;
00143                   TCPClient             *client;
00144                   TCPServer             *server;
00145                   unsigned char *sndClientBuf;
00146                   unsigned char *rcvFlag;
00147                   unsigned char *rcvClientBuf;
00148                   unsigned char *sndServerBuf;
00149 
00150       Matrix axisMap;
00151 
00152                   //protected methods
00153       void MapAxes();
00154                   void ScaleDeltas();
00155                   int  CheckDeltas();
00156                   void ErrorHandler(char* errorDescription, DWORD errorCode);
00157                   
00158   };
00159 
00160 }
00161 #endif //ManualController_h
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations