I was looking over the documentation trying to find anything that will allow me the Kinect/device?
I'm trying to get accelerometer data, but not sure how. So far there
were two things I've spotted in the guide and docs:
XnModuleDeviceInterface/xn::ModuleDevice
and
XnModuleLockAwareInterface/xn::ModuleLockAwareInterface
.
I'm wondering if I can use the ModuleDevice Get/Set methods to talk to the device and ask for accelerometer data. If so, how can I get started?
Also, I was thinking, if it would be possible to 'lock' openni functionality temporarily while I try to get accelerometer data via freenect or something similar, then 'unlocking' after reading is done.
Has anyone tried this before? Any tips?
I'm currently using the SimpleOpenNI wrapper and Processing, but have used OpenFrameworks and the C++ library, so the language wouldn't be very important.
The standard OpenNI Kinect drivers don't expose or allow access to any accelerometer, motor, or LED controls. All of these controls are done through the "NUI Motor" USB device (protocol reference), which the SensorKinect Kinect driver doesn't communicate with.
One way around this is to use a modified OpenNI SensorKinect driver, i.e., this one which does connect to the NUI Motor device, and exposes basic accelerometer and motor control via a "CameraAngleVertical" integer property. It appears that you should be able to read/write an arbitrary integer property using SimpleOpenNI and Processing.
If you're willing to use a non-OpenNI-based solution, you can use Daniel Shiffman's Kinect Processing library which is based on libfreenect. You'll get good accelerometer, motor, etc..., but will lose access to the OpenNI skeleton/gesture support. A similar library for OpenFrameworks is ofxKinect.
Regarding locking of OpenNI nodes, my understanding is that this just prevents properties from updating and does nothing at the USB driver level. Switching between drivers--PrimeSense-based SensorKinect and libusb-based libfreenect--at runtime is not possible. It may be possible (I haven't tried it) to configure OpenNI for the camera device, and to use freenect to communicate with the NUI Motor device. No locking/synchronization between these devices should be required.
来源:https://stackoverflow.com/questions/8446605/how-can-i-access-the-kinect-device-via-openni