The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/psmv: Introduce proper grip and aim poses

Correctly rotate the grip pose to follow the spec more closely.

+34 -22
+3
doc/changes/drivers/mr.509.md
··· 1 + psmv: Introduce proper grip and aim poses, correctly rotate the grip pose to 2 + follow the spec more closely. The aim poses replaces the previous ball tip pose 3 + that was used before for aim.
+15 -7
src/xrt/drivers/psmv/psmv_driver.c
··· 71 71 PSMV_INDEX_CIRCLE_CLICK, 72 72 PSMV_INDEX_TRIANGLE_CLICK, 73 73 PSMV_INDEX_TRIGGER_VALUE, 74 + PSMV_INDEX_GRIP_POSE, 75 + PSMV_INDEX_AIM_POSE, 74 76 PSMV_INDEX_BODY_CENTER_POSE, 75 77 PSMV_INDEX_BALL_CENTER_POSE, 76 - PSMV_INDEX_BALL_TIP_POSE, 77 78 }; 78 79 79 80 /*! ··· 886 887 *out_relation_timestamp_ns = now; 887 888 } 888 889 889 - // Adjust from the normal body center pose to the ball tip. 890 - if (name != XRT_INPUT_PSMV_BALL_TIP_POSE) { 890 + /* 891 + * Both the grip and aim pose needs adjustments, the grip is a rotated 892 + * body center pose, while the aim pose needs to rotated and translated 893 + * to the tip of the ball. 894 + */ 895 + if (name != XRT_INPUT_PSMV_AIM_POSE && 896 + name != XRT_INPUT_PSMV_GRIP_POSE) { 891 897 return; 892 898 } 893 899 894 - float y = PSMV_BALL_FROM_IMU_Y_M; 895 - if (name == XRT_INPUT_PSMV_BALL_TIP_POSE) { 900 + float y = 0.0; 901 + if (name == XRT_INPUT_PSMV_AIM_POSE) { 902 + y += PSMV_BALL_FROM_IMU_Y_M; 896 903 y += PSMV_BALL_DIAMETER_M / 2.0; 897 904 } 898 905 ··· 967 974 968 975 enum u_device_alloc_flags flags = U_DEVICE_ALLOC_TRACKING_NONE; 969 976 struct psmv_device *psmv = 970 - U_DEVICE_ALLOCATE(struct psmv_device, flags, 12, 1); 977 + U_DEVICE_ALLOCATE(struct psmv_device, flags, 13, 1); 971 978 psmv->base.destroy = psmv_device_destroy; 972 979 psmv->base.update_inputs = psmv_device_update_inputs; 973 980 psmv->base.get_tracked_pose = psmv_device_get_tracked_pose; ··· 1019 1026 SET_INPUT(CIRCLE_CLICK); 1020 1027 SET_INPUT(TRIANGLE_CLICK); 1021 1028 SET_INPUT(TRIGGER_VALUE); 1029 + SET_INPUT(GRIP_POSE); 1030 + SET_INPUT(AIM_POSE); 1022 1031 SET_INPUT(BODY_CENTER_POSE); 1023 1032 SET_INPUT(BALL_CENTER_POSE); 1024 - SET_INPUT(BALL_TIP_POSE); 1025 1033 1026 1034 // We only have one output. 1027 1035 psmv->base.outputs[0].name = XRT_OUTPUT_NAME_PSMV_RUMBLE_VIBRATION;
+4 -3
src/xrt/include/xrt/xrt_defines.h
··· 475 475 XRT_INPUT_PSMV_CIRCLE_CLICK = XRT_INPUT_NAME(0x0026, BOOLEAN), 476 476 XRT_INPUT_PSMV_TRIANGLE_CLICK = XRT_INPUT_NAME(0x0027, BOOLEAN), 477 477 XRT_INPUT_PSMV_TRIGGER_VALUE = XRT_INPUT_NAME(0x0028, VEC1_ZERO_TO_ONE), 478 - XRT_INPUT_PSMV_BODY_CENTER_POSE = XRT_INPUT_NAME(0x0029, POSE), 479 - XRT_INPUT_PSMV_BALL_CENTER_POSE = XRT_INPUT_NAME(0x002A, POSE), 480 - XRT_INPUT_PSMV_BALL_TIP_POSE = XRT_INPUT_NAME(0x002B, POSE), 478 + XRT_INPUT_PSMV_GRIP_POSE = XRT_INPUT_NAME(0x0029, POSE), 479 + XRT_INPUT_PSMV_AIM_POSE = XRT_INPUT_NAME(0x002A, POSE), 480 + XRT_INPUT_PSMV_BODY_CENTER_POSE = XRT_INPUT_NAME(0x002B, POSE), 481 + XRT_INPUT_PSMV_BALL_CENTER_POSE = XRT_INPUT_NAME(0x002C, POSE), 481 482 482 483 XRT_INPUT_HYDRA_1_CLICK = XRT_INPUT_NAME(0x0030, BOOLEAN), 483 484 XRT_INPUT_HYDRA_2_CLICK = XRT_INPUT_NAME(0x0031, BOOLEAN),
+12 -12
src/xrt/state_trackers/oxr/oxr_binding_data.h
··· 93 93 }, 94 94 .inputs = 95 95 { 96 - XRT_INPUT_PSMV_BODY_CENTER_POSE, 96 + XRT_INPUT_PSMV_GRIP_POSE, 97 97 XRT_INPUT_HYDRA_POSE, 98 98 XRT_INPUT_DAYDREAM_POSE, 99 99 XRT_INPUT_INDEX_GRIP_POSE, ··· 111 111 }, 112 112 .inputs = 113 113 { 114 - XRT_INPUT_PSMV_BALL_TIP_POSE, 114 + XRT_INPUT_PSMV_AIM_POSE, 115 115 XRT_INPUT_HYDRA_POSE, 116 116 XRT_INPUT_DAYDREAM_POSE, 117 117 XRT_INPUT_INDEX_AIM_POSE, ··· 180 180 }, 181 181 .inputs = 182 182 { 183 - XRT_INPUT_PSMV_BODY_CENTER_POSE, 183 + XRT_INPUT_PSMV_GRIP_POSE, 184 184 XRT_INPUT_HYDRA_POSE, 185 185 XRT_INPUT_DAYDREAM_POSE, 186 186 XRT_INPUT_INDEX_GRIP_POSE, ··· 198 198 }, 199 199 .inputs = 200 200 { 201 - XRT_INPUT_PSMV_BALL_TIP_POSE, 201 + XRT_INPUT_PSMV_AIM_POSE, 202 202 XRT_INPUT_HYDRA_POSE, 203 203 XRT_INPUT_DAYDREAM_POSE, 204 204 XRT_INPUT_INDEX_AIM_POSE, ··· 303 303 .inputs = 304 304 { 305 305 #if 0 306 - XRT_INPUT_PSMV_BODY_CENTER_POSE, 306 + XRT_INPUT_PSMV_GRIP_POSE, 307 307 XRT_INPUT_HYDRA_POSE, 308 308 #endif 309 309 (enum xrt_input_name)0, ··· 320 320 .inputs = 321 321 { 322 322 #if 0 323 - XRT_INPUT_PSMV_BALL_TIP_POSE, 323 + XRT_INPUT_PSMV_AIM_POSE, 324 324 XRT_INPUT_HYDRA_POSE, 325 325 #endif 326 326 (enum xrt_input_name)0, ··· 394 394 .inputs = 395 395 { 396 396 #if 0 397 - XRT_INPUT_PSMV_BODY_CENTER_POSE, 397 + XRT_INPUT_PSMV_GRIP_POSE, 398 398 XRT_INPUT_HYDRA_POSE, 399 399 #endif 400 400 (enum xrt_input_name)0, ··· 411 411 .inputs = 412 412 { 413 413 #if 0 414 - XRT_INPUT_PSMV_BALL_TIP_POSE, 414 + XRT_INPUT_PSMV_AIM_POSE, 415 415 XRT_INPUT_HYDRA_POSE, 416 416 #endif 417 417 (enum xrt_input_name)0, ··· 567 567 }, 568 568 .inputs = 569 569 { 570 - XRT_INPUT_PSMV_BODY_CENTER_POSE, 570 + XRT_INPUT_PSMV_GRIP_POSE, 571 571 (enum xrt_input_name)0, 572 572 }, 573 573 }, ··· 595 595 }, 596 596 .inputs = 597 597 { 598 - XRT_INPUT_PSMV_BALL_TIP_POSE, 598 + XRT_INPUT_PSMV_AIM_POSE, 599 599 (enum xrt_input_name)0, 600 600 }, 601 601 }, ··· 748 748 }, 749 749 .inputs = 750 750 { 751 - XRT_INPUT_PSMV_BODY_CENTER_POSE, 751 + XRT_INPUT_PSMV_GRIP_POSE, 752 752 (enum xrt_input_name)0, 753 753 }, 754 754 }, ··· 776 776 }, 777 777 .inputs = 778 778 { 779 - XRT_INPUT_PSMV_BALL_TIP_POSE, 779 + XRT_INPUT_PSMV_AIM_POSE, 780 780 (enum xrt_input_name)0, 781 781 }, 782 782 },