Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Garry_M_
Beginner
36 Views

Possible Reasons for QueryHandData() returning "PXCM_STATUS_DATA_UNAVAILABLE""

Hi All,

2 days into RealSense development and I'm trying to grab some finger co-ordinates via the RealSense camera and map them into Unity.

I'm developing in C Sharp and have been following the programming guide getting as far as setting up the SenseManager and hand module.

The problem I'm having is once I get down to the QueryHandData() function I am unable to get any data from it and the function returns: "PXCM_STATUS_DATA_UNAVAILABLE""


I'm sure I'm doing something wrong in the setup somewhere, would appreciate if someone could give me hand and see if there's any obvious problems with my code:

public class RealSenseTestScript : MonoBehaviour {
    private PXCMSenseManager sm;
    PXCMHandData.IHand ihand;
    PXCMHandData handData;
    PXCMHandModule handModule;
    PXCMHandConfiguration handConfig;


    // Use this for initialization
    void Start () {
        sm = PXCMSenseManager.CreateInstance();
        Debug.Log("CHECK ENABLE HAND: "+ sm.EnableHand());
        handModule = sm.QueryHand();
        handData = handModule.CreateOutput();

        if(handData != null) {
            Debug.Log("Hand Data is NOT Null");
        } else {
            Debug.Log("Hand Data IS Null");
        }
        
        handConfig = handModule.CreateActiveConfiguration();
        handConfig.SetTrackingMode(PXCMHandData.TrackingModeType.TRACKING_MODE_FULL_HAND);
        handConfig.ApplyChanges();

        Debug.Log("CHECK INIT(): " + sm.Init());
    }

    void Awake() {
    }

    // Update is called once per frame
    void Update() {
        Debug.Log("In the update loop");
        if (handData != null) {
            handData.Update();
            Debug.Log("QueryHandData: " + handData.QueryHandData(PXCMHandData.AccessOrderType.ACCESS_ORDER_BY_TIME, 0, out ihand));

            if(ihand != null) {
                Debug.Log("iHand is NOT null!");
                Debug.Log("x: " + ihand.QueryMassCenterWorld().x + " y: " + ihand.QueryMassCenterWorld().y + " z:" + ihand.QueryMassCenterWorld().z);
            } else {
                //Debug.Log("iHand IS null");
            }
       
        } else {
            Debug.Log("Hand Data is null!");
        }
    }

}

 

Thanks in advance!

Garry

 

0 Kudos
0 Replies
Reply