WVR_GetHandTrackingData

WVR_EXPORT WVR_Result WVR_GetHandTrackingData(WVR_HandTrackerType trackerType, WVR_HandModelType modelType, WVR_PoseOriginModel originModel, WVR_HandTrackingData * skeleton, WVR_HandPoseData_t * pose = nullptr)

Use this function to get the hand tracking device.

Version
API Level 7
Parameters
  • trackerType: Specify the type of hand tracker. Refer to WVR_HandTrackerType.
  • modelType: Specify the type of hand model. Refer to WVR_HandModelType.
  • originModel: Specify the tracking universe of the origin tracking model. Refer to WVR_PoseOriginModel.
  • skeleton: The hand skeleton data WVR_HandTrackingData_t
  • pose: The hand pose state refer to WVR_HandPoseData_t
Return Value
  • WVR_Success: Successfully retrieved data.
  • Others: WVR_Result mean failure.

struct WVR_HandTrackingData

The data structure of the hand tracker data that contains both hands.

Version
API Level 7

Public Members

int64_t timestamp
WVR_HandJointData_t right

The hand tracker data of right hand, refer to WVR_HandJointData_t.

WVR_HandJointData_t left

The hand tracker data of left hand, refer to WVR_HandJointData_t.

struct WVR_HandJointData

The data structure of one hand.

Version
API Level 7

Public Members

bool isValidPose

The label of valid(true)/invalid(false) pose.

float confidence

The hand confidence value.

uint32_t jointCount

Specify the size of the WVR_Pose_t array.

WVR_Pose_t *joints

The array of the WVR_Pose_t.

WVR_Vector3f_t scale

The hand scale value to WVR_Vector3f_t. The default is 1.

enum WVR_HandJoint

The conventions of hand joints.

Version
API Level 7

Values:

WVR_HandJoint_Palm = 0
WVR_HandJoint_Wrist = 1
WVR_HandJoint_Thumb_Joint0 = 2
WVR_HandJoint_Thumb_Joint1 = 3
WVR_HandJoint_Thumb_Joint2 = 4
WVR_HandJoint_Thumb_Tip = 5
WVR_HandJoint_Index_Joint0 = 6
WVR_HandJoint_Index_Joint1 = 7
WVR_HandJoint_Index_Joint2 = 8
WVR_HandJoint_Index_Joint3 = 9
WVR_HandJoint_Index_Tip = 10
WVR_HandJoint_Middle_Joint0 = 11
WVR_HandJoint_Middle_Joint1 = 12
WVR_HandJoint_Middle_Joint2 = 13
WVR_HandJoint_Middle_Joint3 = 14
WVR_HandJoint_Middle_Tip = 15
WVR_HandJoint_Ring_Joint0 = 16
WVR_HandJoint_Ring_Joint1 = 17
WVR_HandJoint_Ring_Joint2 = 18
WVR_HandJoint_Ring_Joint3 = 19
WVR_HandJoint_Ring_Tip = 20
WVR_HandJoint_Pinky_Joint0 = 21
WVR_HandJoint_Pinky_Joint1 = 22
WVR_HandJoint_Pinky_Joint2 = 23
WVR_HandJoint_Pinky_Joint3 = 24
WVR_HandJoint_Pinky_Tip = 25
struct WVR_HandPoseData

The hands pose information.

Public Members

int64_t timestamp

The current time in milliseconds.

WVR_HandPoseState_t right

The pose state of right hand, refer to WVR_HandPoseState.

WVR_HandPoseState_t left

The pose state of left hand, refer to WVR_HandPoseState.

enum WVR_HandPoseType

The hand pose type definition.

Values:

WVR_HandPoseType_Invalid = 0

The hand pose type is invalid.

WVR_HandPoseType_Pinch = 1

The hand pose type is pinch.

WVR_HandPoseType_Hold = 2

The hand pose type is hold.

struct WVR_HandPoseStateBase

The common pose state information.

Public Members

WVR_HandPoseType type

The current hand pose type.

struct WVR_HandPosePinchState

The pinch state.

Public Members

WVR_HandPoseStateBase_t base

Refer to WVR_HandPoseStateBase

WVR_FingerType finger

Move someone finger and thumb apart or bring them together.

float strength

The value of ranges between 0 to 1 for each finger pich, 1 means pinch with the finger touching the thumb fully.

WVR_Vector3f_t origin

The pinch origin.

WVR_Vector3f_t direction

The pinch direction.

struct WVR_HandPoseHoldState

The hand hold state.

Public Members

WVR_HandPoseStateBase_t base

Refer to WVR_HandPoseStateBase.

WVR_HandHoldRoleType role

The role type of hand hold, refer to WVR_HandHoldRoleType.

WVR_HandHoldObjectType object

The object type of hand hold, refer to WVR_HandHoldObjectType.

enum WVR_HandHoldRoleType

The role type of hand hold.

Values:

WVR_HandHoldRoleType_None = 0

The role type of hand hold is none.

WVR_HandHoldRoleType_MainHold = 1

The role type of hand hold is main hold.

WVR_HandHoldRoleType_SideHold = 2

The role type of hand hold is side hold.

enum WVR_HandHoldObjectType

The object type of hand hold.

Values:

WVR_HandHoldObjectType_None = 0

The object type of hand hold is none.

WVR_HandHoldObjectType_Gun = 1

The object type of hand hold is a gun.

WVR_HandHoldObjectType_OCSpray = 2

The object type of hand hold is a OC spray.

WVR_HandHoldObjectType_LongGun = 3

The object type of hand hold is a long gun.

WVR_HandHoldObjectType_Baton = 4

The object type of hand hold is a baton.

WVR_HandHoldObjectType_FlashLight = 5

The object type of hand hold is a flashlight.

How to use

Sample function:

#include <wvr/wvr_hand.h>

if (WVR_StartHandTracking(WVR_HandTrackerType_Natural) == WVR_Success) {
    WVR_HandTrackingData skeleton = {};
    WVR_HandPoseData pose = {};
    if (WVR_GetHandTrackingData(WVR_HandTrackerType_Natural,
                            WVR_HandModelType_WithoutController,
                            WVR_PoseOriginModel_OriginOnHead,
                            &skeleton, &pose) == WVR_Success) {
        // get hand tracking data success
        switch (pose.left.base.type) {
            default:
                LOGI("no special pose");
                break;
            case WVR_HandPoseType_Pinch: {
                LOGI("The left has special pose that is pinch");
                break;
            case WVR_HandPoseType_Hold: {
                LOGI("The left has special pose that is hold");
                break;
        }
    } else {
        // start hand tracking failed!
    }
    //WVR_StopHandTracking
} else {
    // start hand tracking failed!
}