DHDHapticsDevice.h

Go to the documentation of this file.
00001 
00002 //    Copyright 2004, SenseGraphics AB
00003 //
00004 //    This file is part of H3D API.
00005 //
00006 //    H3D API is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    H3D API is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with H3D API; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 //
00020 //    A commercial license is also available. Please contact us at 
00021 //    www.sensegraphics.com for more information.
00022 //
00023 //
00027 //
00029 #ifndef __DHDHAPTICSDEVICE_H__
00030 #define __DHDHAPTICSDEVICE_H__
00031 
00032 #include "H3DThreadedHapticsDevice.h"
00033 #include "MFString.h"
00034 
00035 #ifdef HAVE_DHDAPI
00036 #include <dhdc.h>
00037 
00038 #ifdef _MSC_VER
00039 #pragma comment( lib, "dhdms.lib" )
00040 #endif
00041 
00042 #endif
00043 
00044 namespace H3D {
00045 
00054   class H3DAPI_API DHDHapticsDevice: public H3DThreadedHapticsDevice {
00055   public:
00056 
00058     DHDHapticsDevice( 
00059             Inst< ThreadSafeSField< SFVec3f > > _devicePosition = 0,
00060             Inst< ThreadSafeSField< SFRotation > > _deviceOrientation   = 0,
00061             Inst< TrackerPosition > _trackerPosition        = 0,
00062             Inst< TrackerOrientation > _trackerOrientation  = 0,
00063             Inst< PosCalibration  > _positionCalibration    = 0,
00064             Inst< OrnCalibration  > _orientationCalibration = 0,
00065             Inst< SFVec3f         > _proxyPosition          = 0,
00066             Inst< WeightedProxy   > _weightedProxyPosition  = 0,     
00067             Inst< SFFloat         > _proxyWeighting         = 0,
00068             Inst< ThreadSafeSField< SFBool > > _main_button = 0,
00069             Inst< ThreadSafeSField< SFVec3f > > _force      = 0,
00070             Inst< ThreadSafeSField< SFVec3f > > _torque     = 0,
00071             Inst< SFInt32         > _inputDOF               = 0,
00072             Inst< SFInt32         > _outputDOF              = 0,
00073             Inst< SFInt32         > _hapticsRate            = 0,
00074             Inst< SFNode          > _stylus                 = 0,
00075             Inst< SFBool          > _initialized            = 0
00076 );
00077     
00079     virtual ~DHDHapticsDevice() {
00080       disableDevice();
00081       if( thread ) {
00082         delete thread;
00083         thread = NULL;
00084       }
00085     }
00086 
00089     virtual void initDevice();
00090 
00094     virtual void disableDevice();
00095 
00097     static H3DNodeDatabase database;
00098 
00099   protected:
00102     virtual Vec3f getPosition();
00103 
00106     virtual Vec3f getVelocity();
00107 
00110     virtual Rotation getOrientation();
00111 
00114     virtual bool getButtonStatus();
00115 
00118     virtual void sendForce( const Vec3f &f );
00119 
00122     virtual void sendTorque( const Vec3f &f );
00123 
00124 
00125     int device_id;
00126   };
00127 }
00128 
00129 #endif

Generated on Thu Aug 24 12:38:32 2006 for H3D API by  doxygen 1.4.5