devices/devicemocap/ordevicemocap_hardware.h

devices/devicemocap/ordevicemocap_hardware.h
#ifndef __ORDEVICE_SKELETON_KINECT_H__
#define __ORDEVICE_SKELETON_KINECT_H__
/***************************************************************************************
Autodesk(R) Open Reality(R) Samples
(C) 2013 Autodesk, Inc. and/or its licensors
All rights reserved.
AUTODESK SOFTWARE LICENSE AGREEMENT
Autodesk, Inc. licenses this Software to you only upon the condition that
you accept all of the terms contained in the Software License Agreement ("Agreement")
that is embedded in or that is delivered with this Software. By selecting
the "I ACCEPT" button at the end of the Agreement or by copying, installing,
uploading, accessing or using all or any portion of the Software you agree
to enter into the Agreement. A contract is then formed between Autodesk and
either you personally, if you acquire the Software for yourself, or the company
or other legal entity for which you are acquiring the software.
AUTODESK, INC., MAKES NO WARRANTY, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE REGARDING THESE MATERIALS, AND MAKES SUCH MATERIALS AVAILABLE SOLELY ON AN
"AS-IS" BASIS.
IN NO EVENT SHALL AUTODESK, INC., BE LIABLE TO ANYONE FOR SPECIAL, COLLATERAL,
INCIDENTAL, OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH OR ARISING OUT OF PURCHASE
OR USE OF THESE MATERIALS. THE SOLE AND EXCLUSIVE LIABILITY TO AUTODESK, INC.,
REGARDLESS OF THE FORM OF ACTION, SHALL NOT EXCEED THE PURCHASE PRICE OF THE
MATERIALS DESCRIBED HEREIN.
Autodesk, Inc., reserves the right to revise and improve its products as it sees fit.
Autodesk and Open Reality are registered trademarks or trademarks of Autodesk, Inc.,
in the U.S.A. and/or other countries. All other brand names, product names, or
trademarks belong to their respective holders.
GOVERNMENT USE
Use, duplication, or disclosure by the U.S. Government is subject to restrictions as
set forth in FAR 12.212 (Commercial Computer Software-Restricted Rights) and
DFAR 227.7202 (Rights in Technical Data and Computer Software), as applicable.
Manufacturer is Autodesk, Inc., 10 Duke Street, Montreal, Quebec, Canada, H3C 2L7.
***************************************************************************************/
//--- SDK include
#include <windows.h>
#include "NuiApi.h"
#include <fbsdk/fbsdk.h>
#include "statushandle.h"
#include "ispeech.h"
class ORDeviceMocapKinect
{
public:
ORDeviceMocapKinect();
~ORDeviceMocapKinect();
//--- Opens and closes Kinect. returns true if successful
bool Open();
bool Close();
bool GetSetupInfo ();
//--- Hardware communication
bool StartDataStream ();
bool StopDataStream ();
bool FetchMocapData (FBTime &pTime);
void GetSkeletonJointsOrder(FBBodyNodeId* &pSkeletonJointsOrder);
FBString GetHardWareName();
double GetAverageSensorFloorOffset();
void SetSensorFloorOffsetSet();
//--- Channel & Channel data management
int GetChannelCount () { return mChannelCount; }
const char* GetChannelName (int pChannel) { return mChannel[pChannel].mName; }
int GetChannelParent(int pChannel) { return mChannel[pChannel].mParentChannel; }
FBVector3d GetDefaultT (int pChannel) { SkeletonNodeInfo& lSI = mChannel[pChannel]; return FBVector3d(lSI.mDefaultT[0],lSI.mDefaultT[1],lSI.mDefaultT[2]); }
FBVector3d GetDefaultR (int pChannel) { SkeletonNodeInfo& lSI = mChannel[pChannel]; return FBVector3d(lSI.mDefaultR[0],lSI.mDefaultR[1],lSI.mDefaultR[2]); }
double GetDataTX (int pChannel) { return mChannel[pChannel].mT[0]; }
double GetDataTY (int pChannel) { return mChannel[pChannel].mT[1]; }
double GetDataTZ (int pChannel) { return mChannel[pChannel].mT[2]; }
double GetDataRX (int pChannel) { return mChannel[pChannel].mR[0]; }
double GetDataRY (int pChannel) { return mChannel[pChannel].mR[1]; }
double GetDataRZ (int pChannel) { return mChannel[pChannel].mR[2]; }
bool Init();
bool AdjustAngle();
inline void CalculateAverageSensorFloorOffset();
// Speech
bool SetupSpeechConnection();
SpeechCommands ProcessSpeech();
private:
struct SkeletonNodeInfo
{
const char* mName;
int mParentChannel;
double mDefaultT[3];
double mDefaultR[3];
double mT[3];
double mR[3];
};
SkeletonNodeInfo mChannel[NUI_SKELETON_POSITION_COUNT+2];
int mChannelCount;
bool mInitSuccessful;
bool mOpened;
INuiSensor* mNuiSensor;
HANDLE m_hNextSkeletonEvent;
double mAverageSensorFloorOffset;
bool mSensorFloorOffsetSet;
// Speech
ISpeech* mSpeech;
bool mHasVoiceControl;
public:
FBMocapJointsState* mKinectMocapJointsState;
};
#endif /* __ORDEVICE_SKELETON_KINECT_H__ */