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.
Recommend calling this get hand pose API just after WVR_GetSyncPose to make sure hand model moving smooth.
- Version
- API Level 6
- 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_tpose
: The hand pose state refer to WVR_HandPoseData_t
- Return Value
WVR_Success
: Successfully retrieved data.Others
: WVR_Result mean failure.
-
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.
-
-
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.
-
-
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.
-
WVR_HandPoseStateBase_t
-
enum
WVR_FingerType
¶ The finger name.
Values:
-
WVR_FingerType_Thumb
= 1¶ Represent thumb finger.
-
WVR_FingerType_Index
= 2¶ Represent index finger.
-
WVR_FingerType_Middle
= 3¶ Represent middle finger.
-
WVR_FingerType_Ring
= 4¶ Represent ring finger.
-
WVR_FingerType_Pinky
= 5¶ Represent pinky finger.
-
-
struct
WVR_HandPosePinchState
¶ The pinch state.
Public Members
-
WVR_HandPoseStateBase_t
base
¶ Refer to WVR_HandPoseStateBase
-
WVR_FingerType
finger
¶ Which finger moves near or far to thumb, WVR_FingerType.
-
float
strength
¶ Value from 0 to 1, with 1 represents a full touch between fingers.
-
WVR_Vector3f_t
origin
¶ The pinch origin.
-
WVR_Vector3f_t
direction
¶ The pinch direction.
-
WVR_HandPoseStateBase_t
-
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.
-
WVR_HandPoseType
-
union
WVR_HandPoseState
¶ - #include <wvr_hand.h>
The hand pose state.
Public Members
-
WVR_HandPoseStateBase_t
base
¶ Refer to WVR_HandPoseStateBase
-
WVR_HandPosePinchState_t
pinch
¶ Refer to WVR_HandPosePinchState
-
WVR_HandPoseHoldState_t
hold
¶ Refer to WVR_HandPoseHoldState
-
WVR_HandPoseStateBase_t
-
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.
-
int64_t
-
struct
WVR_HandJointData
¶ The data structure of one hand.
- Version
- API Level 6
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.
-
WVR_Vector3f_t
wristLinearVelocity
¶ The wrist linear velocity.
-
WVR_Vector3f_t
wristAngularVelocity
¶ The wrist angular velocity.
-
struct
WVR_HandTrackingData
¶ The data structure of the hand tracker data that contains both hands.
- Version
- API Level 6
-
enum
WVR_PoseOriginModel
¶ The style of tracking origin.
Identifies which style of tracking origin the application wants to use for the poses it is requesting
Values:
-
WVR_PoseOriginModel_OriginOnHead
= 0¶ The origin of 6 DoF pose is on head.
-
WVR_PoseOriginModel_OriginOnGround
= 1¶ The origin of 6 DoF pose is on ground.
-
WVR_PoseOriginModel_OriginOnTrackingObserver
= 2¶ The raw pose from tracking system.
-
WVR_PoseOriginModel_OriginOnHead_3DoF
= 3¶ The origin of 3 DoF pose is on head.
-
-
enum
WVR_HandModelType
¶ The type of the hand model.
- Version
- API Level 6
Values:
-
WVR_HandModelType_WithoutController
= 1<<0¶
-
WVR_HandModelType_WithController
= 1<<1¶
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!
}