H3D.org Forum Index Programming Issues
HAPIHapticsDevice | Register To Post |
| Threaded | Newest First | Previous Topic | Next Topic | Bottom |
| Poster | Thread |
|---|---|
| sfabel | Posted on: 2010/1/29 22:41 |
Not too shy to talk ![]() ![]() Joined: 2009/10/7 From: Posts: 7 |
HAPIHapticsDevice Hello all,
I'd like to be able to use multiple different haptic input devices in one program. In order to make that happen, I would need to - detect how many input devices are currently attached - initialize them, ideally in a vector< HAPIHapticsDevice *> devices for easy access to all of them - work on the vector with constructs like Looking at the doxygen documentation for HAPI, I find that AnyHapticsDevice is derived from HAPIHapticsDevice, and in one level with all the specific implementations. For now, all I want to do is run a thread that updates the DeviceValues for each attached device, independent of what device it actually is. AnyHapticsDevice does not let me do that. HAPIHapticsDevice does not let me do that (i.e., does not provide a virtual function for it), and I have not found a method that allows me to detect attached devices and declare them depending upon their type. So, I am stuck. Does this make even sense to anyone and more importantly, can you help me out? :) Thanks, Stephan |
| Markus | Posted on: 2010/2/3 8:31 |
Webmaster ![]() ![]() Joined: 2006/3/27 From: SenseGraphics Posts: 1531 |
Re: HAPIHapticsDevice AnyHapticsDevice will use the first device that it can initialize. The order of devices is unknown. The code for this can be found in AnyHapticsDevice::initHapticsDevice in AnyHapticsDevice.cpp. You could use this code, slightly modified, to store the initialized devices in a vector of HAPIHapticsDevices instead. Note that such code will not be implemented as a subclass to HAPIHapticsDevice but rather a simple creation function that is run once when your application starts.
Why do you want to run a separate thread to update DeviceValues for each attached device? Each device in HAPI has their own haptics thread. There is no way to update DeviceValues for all attached devices in one separate thread, maybe if you do some serious hacking but I doubt it it possible even then. The devices values are updated depending on how the user is moving the devices and the setup of the haptic scene. The updates of device values are done in the virtual function updateDeviceValues for each device. Could you please explain a bit more on why you want to update the DeviceValues for each attached device in the same separate thread? |
| Threaded | Newest First | Previous Topic | Next Topic | Top |
| Register To Post | |



