00001 //=========================================================================== 00002 /* 00003 This file is part of the CHAI 3D visualization and haptics libraries. 00004 Copyright (C) 2003-2009 by CHAI 3D. All rights reserved. 00005 00006 This library is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License("GPL") version 2 00008 as published by the Free Software Foundation. 00009 00010 For using the CHAI 3D libraries with software that can not be combined 00011 with the GNU GPL, and for taking advantage of the additional benefits 00012 of our support services, please contact CHAI 3D about acquiring a 00013 Professional Edition License. 00014 00015 \author <http://www.chai3d.org> 00016 \author Federico Barbagli 00017 \author Francois Conti 00018 \version 2.0.0 $Rev: 251 $ 00019 */ 00020 //=========================================================================== 00021 00022 //--------------------------------------------------------------------------- 00023 #ifndef CPhantomDevicesH 00024 #define CPhantomDevicesH 00025 //--------------------------------------------------------------------------- 00026 #if defined(_ENABLE_PHANTOM_DEVICE_SUPPORT) 00027 //--------------------------------------------------------------------------- 00028 #include "devices/CGenericHapticDevice.h" 00029 //--------------------------------------------------------------------------- 00030 #ifdef _LINUX 00031 #include "devices/hdPhantom.h" 00032 #endif 00033 //--------------------------------------------------------------------------- 00034 00035 //=========================================================================== 00043 //=========================================================================== 00044 00045 //=========================================================================== 00054 //=========================================================================== 00055 class cPhantomDevice : public cGenericHapticDevice 00056 { 00057 public: 00058 //----------------------------------------------------------------------- 00059 // CONSTRUCTOR & DESTRUCTOR: 00060 //----------------------------------------------------------------------- 00061 00063 cPhantomDevice(unsigned int a_deviceNumber); 00064 00066 ~cPhantomDevice(); 00067 00068 00069 //----------------------------------------------------------------------- 00070 // METHODS: 00071 //----------------------------------------------------------------------- 00072 00074 int open(); 00075 00077 int close(); 00078 00080 int initialize(const bool a_resetEncoders=false); 00081 00083 unsigned int getNumDevices(); 00084 00086 int getPosition(cVector3d& a_position); 00087 00089 int getLinearVelocity(cVector3d& a_linearVelocity); 00090 00092 int getRotation(cMatrix3d& a_rotation); 00093 00095 int setForce(cVector3d& a_force); 00096 00098 int setTorque(cVector3d& a_torque); 00099 00101 int getUserSwitch(int a_switchIndex, bool& a_status); 00102 00103 00104 private: 00106 static int m_dllcount; 00107 00109 int m_deviceID; 00110 00112 bool m_driverInstalled; 00113 }; 00114 00115 //--------------------------------------------------------------------------- 00116 #endif // _ENABLE_PHANTOM_SUPPORT 00117 //--------------------------------------------------------------------------- 00118 #endif 00119 //--------------------------------------------------------------------------- 00120