H3D API  2.4.1
HaptikDevice.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __HAPTIKDEVICE_H__
30 #define __HAPTIKDEVICE_H__
31 
32 #include <H3D/H3DHapticsDevice.h>
33 #include <H3D/MFString.h>
34 #include <H3D/PeriodicUpdate.h>
35 namespace H3D {
36 
78  class H3DAPI_API HaptikDevice: public H3DHapticsDevice {
79  public:
80 
86  class H3DAPI_API SelectDevice:
87  public TypedField< PeriodicUpdate< SFInt32 >,
88  Types< SFInt32, SFString > > {
89  virtual void update();
90  };
91 
93  HaptikDevice(
94  Inst< SFVec3f > _devicePosition = 0,
95  Inst< SFRotation > _deviceOrientation = 0,
96  Inst< TrackerPosition > _trackerPosition = 0,
97  Inst< TrackerOrientation > _trackerOrientation = 0,
98  Inst< SFMatrix4f > _positionCalibration = 0,
99  Inst< SFRotation > _orientationCalibration = 0,
100  Inst< SFVec3f > _proxyPosition = 0,
101  Inst< WeightedProxy > _weightedProxyPosition = 0,
102  Inst< SFFloat > _proxyWeighting = 0,
103  Inst< SFBool > _mainButton = 0,
104  Inst< SFBool > _secondaryButton = 0,
105  Inst< SFInt32 > _buttons = 0,
106  Inst< SFVec3f > _force = 0,
107  Inst< SFVec3f > _torque = 0,
108  Inst< SFInt32 > _inputDOF = 0,
109  Inst< SFInt32 > _outputDOF = 0,
110  Inst< SFInt32 > _hapticsRate = 0,
111  Inst< SFInt32 > _desiredHapticsRate = 0,
112  Inst< SFNode > _stylus = 0,
113  Inst< MFString > _deviceName = 0,
114  Inst< MFString > _modelName = 0,
115  Inst< MFString > _manufacturer = 0,
116  Inst< SelectDevice > _selectedDevice = 0,
117  Inst< SFInt32 > _set_selectedDevice = 0,
118  Inst< SFString > _preferredDeviceType = 0 );
119 
121  virtual void initialize();
122 
124  virtual ~HaptikDevice() {
125  disableDevice();
126  }
127 
132  H3DUniquePtr< MFString > deviceName;
133 
138  H3DUniquePtr< MFString > modelName;
139 
144  H3DUniquePtr< MFString > manufacturer;
145 
152  H3DUniquePtr< SelectDevice > selectedDevice;
153 
163  H3DUniquePtr< SFInt32 > set_selectedDevice;
164 
186  H3DUniquePtr< SFString > preferredDeviceType;
187 
190 
191  protected:
193  virtual void changeHaptikDevice( unsigned int new_id );
194  };
195 }
196 
197 #endif
Header file for H3DHapticsDevice.
Contains the MFString field class.
Header file for PeriodicUpdate, template field modifier.
Base class for all haptic devices.
Definition: H3DHapticsDevice.h:68
The SelectDevice field changes the haptics device to use depending on the values of set_selectedDevic...
Definition: HaptikDevice.h:88
The HaptikDevice uses the Haptik library (www.haptiklibrary.org) to access haptics devices.
Definition: HaptikDevice.h:78
static H3DNodeDatabase database
Node database entry.
Definition: HaptikDevice.h:189
virtual ~HaptikDevice()
Destructor. Stops haptics rendering and remove callback functions.
Definition: HaptikDevice.h:124
H3DUniquePtr< MFString > manufacturer
The manufacturer field contains the name of the manufacturer of each haptics device that is available...
Definition: HaptikDevice.h:144
H3DUniquePtr< SFInt32 > set_selectedDevice
The set_selectedDevice field lets you choose the index of the haptics device you want to use.
Definition: HaptikDevice.h:163
H3DUniquePtr< MFString > deviceName
The deviceName field contains the name of each haptics device that is available.
Definition: HaptikDevice.h:132
H3DUniquePtr< MFString > modelName
The modelName field contains the model name of each haptics device that is available.
Definition: HaptikDevice.h:138
H3DUniquePtr< SFString > preferredDeviceType
The preferredDeviceType field will be used if the set_selectedDevice field is -1 to specify which kin...
Definition: HaptikDevice.h:186
H3DUniquePtr< SelectDevice > selectedDevice
The selectedDevice field contains the index of the haptics device that is currently in use.
Definition: HaptikDevice.h:152
A template modifier class for adding type checking on the routes to any Field class.
Definition: TypedField.h:84
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194