diff --git a/demos/sim_hand_poses/README.md b/demos/sim_hand_poses/README.md new file mode 100644 index 00000000..c8a11e0a --- /dev/null +++ b/demos/sim_hand_poses/README.md @@ -0,0 +1,31 @@ +# Simulator Hand Poses Demo + +Small developer demo for inspecting and authoring simulator hand poses. + +The demo shows both simulator hands, exposes per-joint semantic rotation +controls, and displays the resolved raw joint transforms produced by forward +kinematics. It is useful when tuning preset hand poses, checking gesture +recognition behavior, or copying rotation JSON into simulator pose data. + +## Controls + +- Use the simulator hand pose controls to switch between built-in poses. +- Use the sidebar sliders to edit the currently displayed pose rotations. +- Rotation sliders are shown in degrees from `-180` to `180`. +- The runtime hand rotation API still uses radians. +- The controls mirror the active simulator hand and update as the displayed + pose changes. +- `Reset` returns the edited hand rotations to neutral. + +## JSON Views + +- `Raw JSON` shows the currently displayed WebXR-style joint transforms after + FK resolution. +- `Rotations JSON` shows the semantic rotation data for the active hand. +- Use `Copy` to copy either JSON view. + +## AI Prompt + +The prompt bubble can generate semantic hand rotations from a text +description when AI support is configured. Generated rotations are applied to +both hands and can then be inspected or adjusted with the sliders. diff --git a/demos/sim_hand_poses/main.js b/demos/sim_hand_poses/main.js index 108ce536..c46d5a67 100644 --- a/demos/sim_hand_poses/main.js +++ b/demos/sim_hand_poses/main.js @@ -22,10 +22,14 @@ Rotations are applied onto a flat neutral hand pose. Rotations are applied through forward kinematics. Format: {"joint-name":[x,y,z]} where x/y/z are euler angle radians. For long fingers: -x: flexion/extension. Negative curls toward palm, positive extends away. -y: abduction/adduction. Negative spreads toward thumb, positive away. -z: twist. Negative twists away from thumb, positive toward thumb. -Prefer not to change the thumb metacarpal joint. +x: flexion/extension. Positive flexes toward palm, negative extends away. +y: abduction/adduction. Positive spreads away from the middle-finger axis, negative adducts toward it. +z: axial roll. Positive rolls toward thumb, negative rolls away from thumb. +For the middle finger, y is radial/ulnar deviation: positive moves toward index/thumb, negative toward ring/pinky. +For the thumb: +x: positive flexes across palm, negative extends/repositions. +y: positive abducts away from palm, negative adducts back toward palm. +z: positive rolls into opposition/internal rotation, negative repositions/external rotation away. Include every non-tip WebXR joint listed below. Use [0,0,0] for neutral joints: ${ROTATION_JOINT_NAMES.join(', ')} `; @@ -73,6 +77,15 @@ function cleanRotationsForJson(rotations) { return cleanRotations; } +function copyRotations(target, source) { + for (const jointName of ROTATION_JOINT_NAMES) { + const rotation = source[jointName] ?? [0, 0, 0]; + target[jointName][0] = rotation[0]; + target[jointName][1] = rotation[1]; + target[jointName][2] = rotation[2]; + } +} + function cleanJointsForJson(joints) { return joints.map((joint) => ({ t: joint.t.map(toFixedNumber), @@ -380,6 +393,17 @@ class ManualSimHandScene extends xb.Script { } } +class DisplayedPoseSync extends xb.Script { + constructor(syncDisplayedPose) { + super(); + this._syncDisplayedPose = syncDisplayedPose; + } + + update() { + this._syncDisplayedPose(); + } +} + class GestureHUD extends xb.Script { init() { this._active = { @@ -498,19 +522,35 @@ async function start() { let updateJsonViews = () => {}; + const getActiveHandRotations = () => { + const activeHandIndex = + xb.core.simulator.controls.simulatorControllerState + .currentControllerIndex; + return activeHandIndex === 0 + ? xb.core.simulator.hands.leftHandCurrentRotations + : xb.core.simulator.hands.rightHandCurrentRotations; + }; + + const getDisplayedJoints = (bones) => + bones.map((bone) => ({ + t: bone.position.toArray(), + r: bone.quaternion.toArray(), + s: bone.scale.toArray(), + })); + const applyHandRotations = () => { xb.core.simulator.hands.setLeftHandRotations(handRotations); xb.core.simulator.hands.setRightHandRotations(handRotations); updateJsonViews(); }; - const syncControlsToRotations = () => { + const syncControlsToRotations = (rotations = getActiveHandRotations()) => { for (const input of document.querySelectorAll( '.manual-sim-hand-slider input[type="range"]' )) { const axisIndex = ['x', 'y', 'z'].indexOf(input.dataset.axis); const degrees = Math.round( - handRotations[input.dataset.joint][axisIndex] / DEG_TO_RAD + (rotations[input.dataset.joint]?.[axisIndex] ?? 0) / DEG_TO_RAD ); input.value = String(degrees); input.nextElementSibling.value = String(degrees); @@ -519,6 +559,7 @@ async function start() { updateJsonViews = createSidebar( (jointName, axis, value) => { + copyRotations(handRotations, getActiveHandRotations()); handRotations[jointName][['x', 'y', 'z'].indexOf(axis)] = value; applyHandRotations(); }, @@ -526,20 +567,28 @@ async function start() { for (const rotation of Object.values(handRotations)) { rotation.fill(0); } - syncControlsToRotations(); + syncControlsToRotations(handRotations); applyHandRotations(); }, () => ({ raw: { - left: cleanJointsForJson(xb.core.simulator.hands.leftHandTargetJoints), + left: cleanJointsForJson( + getDisplayedJoints(xb.core.simulator.hands.leftHandBones) + ), right: cleanJointsForJson( - xb.core.simulator.hands.rightHandTargetJoints + getDisplayedJoints(xb.core.simulator.hands.rightHandBones) ), }, - rotations: cleanRotationsForJson(handRotations), + rotations: cleanRotationsForJson(getActiveHandRotations()), }) ); + const syncDisplayedPose = () => { + syncControlsToRotations(); + updateJsonViews(); + }; + xb.add(new DisplayedPoseSync(syncDisplayedPose)); + createPromptBubble(async (description) => { xb.core.options.ai.gemini.config = { responseMimeType: 'application/json', @@ -558,7 +607,7 @@ async function start() { handRotations[jointName][1] = generatedRotation[1]; handRotations[jointName][2] = generatedRotation[2]; } - syncControlsToRotations(); + syncControlsToRotations(handRotations); applyHandRotations(); }); } diff --git a/src/simulator/SimulatorHands.ts b/src/simulator/SimulatorHands.ts index 8848b598..57b1ba12 100644 --- a/src/simulator/SimulatorHands.ts +++ b/src/simulator/SimulatorHands.ts @@ -11,12 +11,12 @@ import { SimulatorHandPoseJoints, SimulatorHandPoseRotations, } from './handPoses/HandPoseJoints'; +import {SimulatorHandPose} from './handPoses/HandPoses'; import { - SIMULATOR_HAND_POSE_TO_JOINTS_LEFT, - SIMULATOR_HAND_POSE_TO_JOINTS_RIGHT, - SimulatorHandPose, -} from './handPoses/HandPoses'; -import {resolveSimulatorHandPoseRotations} from './handPoses/HandPoseFK'; + applySimulatorHandPoseRotationConstraints, + resolveSimulatorHandPoseRotations, +} from './handPoses/HandPoseFK'; +import {SIMULATOR_HAND_POSE_ROTATIONS} from './handPoses/HandPoseRotations'; import {SimulatorControllerState} from './SimulatorControllerState'; import {SimulatorXRHand} from './SimulatorXRHand'; @@ -25,12 +25,72 @@ const DEFAULT_HAND_PROFILE_PATH = const vector3 = new THREE.Vector3(); const quaternion = new THREE.Quaternion(); +const ROTATION_JOINT_NAMES = HAND_JOINT_NAMES.filter( + (jointName) => !jointName.endsWith('-tip') +); export type SimulatorHandPoseHTMLElement = HTMLElement & { visible: boolean; handPose?: SimulatorHandPose; }; +function cloneHandPoseRotations( + rotations: DeepReadonly +): SimulatorHandPoseRotations { + const clonedRotations: SimulatorHandPoseRotations = {}; + for (const jointName of ROTATION_JOINT_NAMES) { + const rotation = rotations[jointName]; + if (!rotation) continue; + clonedRotations[jointName] = [rotation[0], rotation[1], rotation[2]]; + } + return clonedRotations; +} + +function lerpHandPoseRotations( + currentRotations: SimulatorHandPoseRotations, + targetRotations: DeepReadonly, + lerpSpeed: number +) { + for (const jointName of ROTATION_JOINT_NAMES) { + const currentRotation = + currentRotations[jointName] ?? (currentRotations[jointName] = [0, 0, 0]); + const targetRotation = targetRotations[jointName] ?? [0, 0, 0]; + currentRotation[0] += (targetRotation[0] - currentRotation[0]) * lerpSpeed; + currentRotation[1] += (targetRotation[1] - currentRotation[1]) * lerpSpeed; + currentRotation[2] += (targetRotation[2] - currentRotation[2]) * lerpSpeed; + } +} + +function applyHandJoints( + bones: THREE.Object3D[], + joints: DeepReadonly +) { + for (let i = 0; i < bones.length; i++) { + const bone = bones[i]; + const jointData = joints[i]; + if (!bone || !jointData) continue; + bone.position.fromArray(jointData.t); + bone.quaternion.fromArray(jointData.r); + bone.scale.fromArray([1, 1, 1]); + } +} + +function lerpHandJoints( + bones: THREE.Object3D[], + joints: DeepReadonly, + lerpSpeed: number +) { + for (let i = 0; i < bones.length; i++) { + const bone = bones[i]; + const targetJoint = joints[i]; + if (!bone || !targetJoint) continue; + vector3.fromArray(targetJoint.t); + quaternion.fromArray(targetJoint.r); + bone.position.lerp(vector3, lerpSpeed); + bone.quaternion.slerp(quaternion, lerpSpeed); + } +} + export class SimulatorHands { leftController = new THREE.Object3D(); rightController = new THREE.Object3D(); @@ -40,10 +100,18 @@ export class SimulatorHands { rightHandBones: THREE.Object3D[] = []; leftHandPose? = SimulatorHandPose.RELAXED; rightHandPose? = SimulatorHandPose.RELAXED; - leftHandTargetJoints: DeepReadonly = - SIMULATOR_HAND_POSE_TO_JOINTS_LEFT[SimulatorHandPose.RELAXED]; - rightHandTargetJoints: DeepReadonly = - SIMULATOR_HAND_POSE_TO_JOINTS_RIGHT[SimulatorHandPose.RELAXED]; + leftHandCurrentRotations = cloneHandPoseRotations( + SIMULATOR_HAND_POSE_ROTATIONS[SimulatorHandPose.RELAXED] + ); + rightHandCurrentRotations = cloneHandPoseRotations( + SIMULATOR_HAND_POSE_ROTATIONS[SimulatorHandPose.RELAXED] + ); + leftHandTargetRotations = cloneHandPoseRotations( + SIMULATOR_HAND_POSE_ROTATIONS[SimulatorHandPose.RELAXED] + ); + rightHandTargetRotations = cloneHandPoseRotations( + SIMULATOR_HAND_POSE_ROTATIONS[SimulatorHandPose.RELAXED] + ); lerpSpeed = 0.1; handPosePanelElement?: SimulatorHandPoseHTMLElement; input!: Input; @@ -51,6 +119,8 @@ export class SimulatorHands { private leftXRHand = new SimulatorXRHand(); private rightXRHand = new SimulatorXRHand(); + private leftHandRawTargetJoints?: DeepReadonly; + private rightHandRawTargetJoints?: DeepReadonly; constructor( private simulatorControllerState: SimulatorControllerState, @@ -81,7 +151,13 @@ export class SimulatorHands { console.warn(`Couldn't find ${jointName} in left hand mesh`); } }); - this.setLeftHandJoints(this.leftHandTargetJoints); + applyHandJoints( + this.leftHandBones, + resolveSimulatorHandPoseRotations( + Handedness.LEFT, + this.leftHandCurrentRotations + ) + ); this.input.hands[0]?.dispatchEvent?.({ type: 'connected', data: {hand: this.leftXRHand, handedness: 'left'} as XRInputSource, @@ -98,7 +174,13 @@ export class SimulatorHands { console.warn(`Couldn't find ${jointName} in right hand mesh`); } }); - this.setRightHandJoints(this.rightHandTargetJoints); + applyHandJoints( + this.rightHandBones, + resolveSimulatorHandPoseRotations( + Handedness.RIGHT, + this.rightHandCurrentRotations + ) + ); this.input.hands[1]?.dispatchEvent?.({ type: 'connected', data: {hand: this.rightXRHand, handedness: 'right'} as XRInputSource, @@ -107,9 +189,10 @@ export class SimulatorHands { } setLeftHandLerpPose(pose: SimulatorHandPose) { - if (this.leftHandPose === pose) return; - - if (pose === SimulatorHandPose.PINCHING) { + if ( + this.leftHandPose !== SimulatorHandPose.PINCHING && + pose === SimulatorHandPose.PINCHING + ) { this.input.dispatchEvent({ type: 'selectstart', target: this.input.controllers[0], @@ -117,7 +200,10 @@ export class SimulatorHands { handedness: 'left', }, }); - } else if (this.leftHandPose === SimulatorHandPose.PINCHING) { + } else if ( + this.leftHandPose === SimulatorHandPose.PINCHING && + pose !== SimulatorHandPose.PINCHING + ) { this.input.dispatchEvent({ type: 'selectend', target: this.input.controllers[0], @@ -128,14 +214,18 @@ export class SimulatorHands { } this.leftHandPose = pose; - this.leftHandTargetJoints = SIMULATOR_HAND_POSE_TO_JOINTS_LEFT[pose]; + this.leftHandRawTargetJoints = undefined; + this.leftHandTargetRotations = cloneHandPoseRotations( + SIMULATOR_HAND_POSE_ROTATIONS[pose] + ); this.updateHandPosePanel(); } setRightHandLerpPose(pose: SimulatorHandPose) { - if (this.rightHandPose === pose) return; - - if (pose === SimulatorHandPose.PINCHING) { + if ( + this.rightHandPose !== SimulatorHandPose.PINCHING && + pose === SimulatorHandPose.PINCHING + ) { this.input.dispatchEvent({ type: 'selectstart', target: this.input.controllers[1], @@ -143,7 +233,10 @@ export class SimulatorHands { handedness: 'right', }, }); - } else if (this.rightHandPose === SimulatorHandPose.PINCHING) { + } else if ( + this.rightHandPose === SimulatorHandPose.PINCHING && + pose !== SimulatorHandPose.PINCHING + ) { this.input.dispatchEvent({ type: 'selectend', target: this.input.controllers[1], @@ -154,11 +247,18 @@ export class SimulatorHands { } this.rightHandPose = pose; - this.rightHandTargetJoints = SIMULATOR_HAND_POSE_TO_JOINTS_RIGHT[pose]; + this.rightHandRawTargetJoints = undefined; + this.rightHandTargetRotations = cloneHandPoseRotations( + SIMULATOR_HAND_POSE_ROTATIONS[pose] + ); this.updateHandPosePanel(); } - setLeftHandRotations(rotations: SimulatorHandPoseRotations) { + /** Applies semantic biomechanical rotations from SimulatorHandPoseRotations. */ + setLeftHandRotations( + rotations: SimulatorHandPoseRotations, + applyConstraints = false + ) { if (this.leftHandPose === SimulatorHandPose.PINCHING) { this.input.dispatchEvent({ type: 'selectend', @@ -169,14 +269,20 @@ export class SimulatorHands { }); } this.leftHandPose = undefined; - this.leftHandTargetJoints = resolveSimulatorHandPoseRotations( - Handedness.LEFT, - rotations + this.leftHandRawTargetJoints = undefined; + this.leftHandTargetRotations = cloneHandPoseRotations( + applyConstraints + ? applySimulatorHandPoseRotationConstraints(rotations) + : rotations ); this.updateHandPosePanel(); } - setRightHandRotations(rotations: SimulatorHandPoseRotations) { + /** Applies semantic biomechanical rotations from SimulatorHandPoseRotations. */ + setRightHandRotations( + rotations: SimulatorHandPoseRotations, + applyConstraints = false + ) { if (this.rightHandPose === SimulatorHandPose.PINCHING) { this.input.dispatchEvent({ type: 'selectend', @@ -187,9 +293,11 @@ export class SimulatorHands { }); } this.rightHandPose = undefined; - this.rightHandTargetJoints = resolveSimulatorHandPoseRotations( - Handedness.RIGHT, - rotations + this.rightHandRawTargetJoints = undefined; + this.rightHandTargetRotations = cloneHandPoseRotations( + applyConstraints + ? applySimulatorHandPoseRotationConstraints(rotations) + : rotations ); this.updateHandPosePanel(); } @@ -205,19 +313,9 @@ export class SimulatorHands { }, }); } - if (joints != this.leftHandTargetJoints) { - this.leftHandPose = undefined; - this.leftHandTargetJoints = joints; - } - for (let i = 0; i < this.leftHandBones.length; i++) { - const bone = this.leftHandBones[i]; - const jointData = joints[i]; - if (bone && jointData) { - bone.position.fromArray(jointData.t); - bone.quaternion.fromArray(jointData.r); - bone.scale.fromArray([1, 1, 1]); - } - } + this.leftHandPose = undefined; + this.leftHandRawTargetJoints = joints; + applyHandJoints(this.leftHandBones, joints); } setRightHandJoints(joints: DeepReadonly) { @@ -231,19 +329,9 @@ export class SimulatorHands { }, }); } - if (joints != this.rightHandTargetJoints) { - this.rightHandPose = undefined; - this.rightHandTargetJoints = joints; - } - for (let i = 0; i < this.rightHandBones.length; i++) { - const bone = this.rightHandBones[i]; - const jointData = joints[i]; - if (bone && jointData) { - bone.position.fromArray(jointData.t); - bone.quaternion.fromArray(jointData.r); - bone.scale.fromArray([1, 1, 1]); - } - } + this.rightHandPose = undefined; + this.rightHandRawTargetJoints = joints; + applyHandJoints(this.rightHandBones, joints); } update() { @@ -253,31 +341,51 @@ export class SimulatorHands { } lerpLeftHandPose() { - for (let i = 0; i < this.leftHandBones.length; i++) { - const bone = this.leftHandBones[i]; - const targetJoint = this.leftHandTargetJoints[i]; - if (bone && targetJoint) { - vector3.fromArray(targetJoint.t); - quaternion.fromArray(targetJoint.r); - - bone.position.lerp(vector3, this.lerpSpeed); - bone.quaternion.slerp(quaternion, this.lerpSpeed); - } + if (this.leftHandRawTargetJoints) { + lerpHandJoints( + this.leftHandBones, + this.leftHandRawTargetJoints, + this.lerpSpeed + ); + return; } + + lerpHandPoseRotations( + this.leftHandCurrentRotations, + this.leftHandTargetRotations, + this.lerpSpeed + ); + applyHandJoints( + this.leftHandBones, + resolveSimulatorHandPoseRotations( + Handedness.LEFT, + this.leftHandCurrentRotations + ) + ); } lerpRightHandPose() { - for (let i = 0; i < this.rightHandBones.length; i++) { - const bone = this.rightHandBones[i]; - const targetJoint = this.rightHandTargetJoints[i]; - if (bone && targetJoint) { - vector3.fromArray(targetJoint.t); - quaternion.fromArray(targetJoint.r); - - bone.position.lerp(vector3, this.lerpSpeed); - bone.quaternion.slerp(quaternion, this.lerpSpeed); - } + if (this.rightHandRawTargetJoints) { + lerpHandJoints( + this.rightHandBones, + this.rightHandRawTargetJoints, + this.lerpSpeed + ); + return; } + + lerpHandPoseRotations( + this.rightHandCurrentRotations, + this.rightHandTargetRotations, + this.lerpSpeed + ); + applyHandJoints( + this.rightHandBones, + resolveSimulatorHandPoseRotations( + Handedness.RIGHT, + this.rightHandCurrentRotations + ) + ); } syncHandJoints() { diff --git a/src/simulator/handPoses/FistHandPoses.ts b/src/simulator/handPoses/FistHandPoses.ts deleted file mode 100644 index 59dadcf6..00000000 --- a/src/simulator/handPoses/FistHandPoses.ts +++ /dev/null @@ -1,55 +0,0 @@ -export const LEFT_HAND_FIST = [ - {t: [-0.0933, -0.0266, -0.1338], r: [0.1346, -0.1437, 0.0038, 0.9804]}, - {t: [-0.0648, -0.0265, -0.1529], r: [0.0354, -0.3351, -0.1786, 0.9244]}, - {t: [-0.0318, -0.0293, -0.1932], r: [0.0407, -0.2202, -0.5685, 0.7916]}, - {t: [-0.0212, -0.0345, -0.2179], r: [0.0132, -0.12, -0.576, 0.8084]}, - {t: [-0.0161, -0.039, -0.2469], r: [0.0132, -0.12, -0.576, 0.8084]}, - {t: [-0.0731, -0.0197, -0.1569], r: [0.0999, -0.2377, 0.0822, 0.9627]}, - {t: [-0.0399, -0.0023, -0.2221], r: [-0.4356, -0.1075, -0.0127, 0.8936]}, - {t: [-0.0325, -0.0319, -0.246], r: [0.9331, 0.066, 0.0832, -0.3436]}, - {t: [-0.035, -0.0462, -0.2296], r: [0.9874, 0.021, 0.128, -0.0903]}, - {t: [-0.0408, -0.0496, -0.2076], r: [0.9874, 0.021, 0.128, -0.0903]}, - {t: [-0.0853, -0.0187, -0.1614], r: [0.115, -0.1594, 0.0889, 0.9765]}, - {t: [-0.0646, -0.0007, -0.2271], r: [-0.4919, -0.1197, 0.0382, 0.8616]}, - {t: [-0.0544, -0.0353, -0.2477], r: [0.9309, 0.1571, 0.0605, -0.324]}, - {t: [-0.0548, -0.0542, -0.2244], r: [0.9835, 0.1315, 0.1097, 0.0583]}, - {t: [-0.0607, -0.051, -0.2013], r: [0.9835, 0.1315, 0.1097, 0.0583]}, - {t: [-0.0972, -0.0213, -0.1628], r: [0.0881, -0.0966, 0.0847, 0.9878]}, - {t: [-0.0856, -0.0088, -0.2263], r: [-0.4818, -0.1075, 0.1033, 0.8635]}, - {t: [-0.0742, -0.0406, -0.246], r: [0.9378, 0.1774, 0.0089, -0.2983]}, - {t: [-0.0715, -0.0585, -0.2205], r: [0.9769, 0.1847, 0.0804, 0.0714]}, - {t: [-0.0757, -0.0552, -0.1994], r: [0.9769, 0.1847, 0.0804, 0.0714]}, - {t: [-0.1078, -0.0253, -0.162], r: [0.0535, -0.0126, 0.0933, 0.9941]}, - {t: [-0.1069, -0.0188, -0.2215], r: [-0.4433, -0.1294, 0.1523, 0.8738]}, - {t: [-0.0939, -0.0444, -0.2398], r: [0.9002, 0.2018, -0.0275, -0.385]}, - {t: [-0.0891, -0.0599, -0.2248], r: [0.9644, 0.2553, 0.0425, -0.0538]}, - {t: [-0.0914, -0.0623, -0.2063], r: [0.9644, 0.2553, 0.0425, -0.0538]}, -] as const; - -export const RIGHT_HAND_FIST = [ - {t: [0.0504, -0.0155, -0.1083], r: [0.1392, 0.117, -0.058, 0.9816]}, - {t: [0.022, -0.0122, -0.1291], r: [-0.0068, 0.3422, 0.1705, 0.924]}, - {t: [-0.011, -0.019, -0.1691], r: [-0.0952, 0.2257, 0.5977, 0.7634]}, - {t: [-0.0171, -0.0305, -0.1932], r: [-0.249, 0.0162, 0.627, 0.738]}, - {t: [-0.0073, -0.0427, -0.2185], r: [-0.249, 0.0162, 0.627, 0.738]}, - {t: [0.0314, -0.0068, -0.133], r: [0.1126, 0.213, -0.1468, 0.9594]}, - {t: [0.0035, 0.014, -0.1987], r: [-0.5177, 0.1865, 0.0124, 0.8349]}, - {t: [-0.0086, -0.0192, -0.2148], r: [0.9671, -0.1129, -0.1466, -0.1747]}, - {t: [-0.0031, -0.0274, -0.1952], r: [0.9714, -0.0492, -0.2057, 0.1081]}, - {t: [0.0063, -0.0222, -0.1749], r: [0.9714, -0.0492, -0.2057, 0.1081]}, - {t: [0.0441, -0.0073, -0.137], r: [0.1251, 0.1341, -0.1467, 0.972]}, - {t: [0.0283, 0.0126, -0.2028], r: [-0.5227, 0.1469, -0.0852, 0.8354]}, - {t: [0.0144, -0.0224, -0.2202], r: [0.9399, -0.2078, -0.0451, -0.2671]}, - {t: [0.0137, -0.0382, -0.1948], r: [0.9665, -0.181, -0.1188, 0.1381]}, - {t: [0.0207, -0.0318, -0.1726], r: [0.9665, -0.181, -0.1188, 0.1381]}, - {t: [0.0559, -0.0112, -0.1379], r: [0.0948, 0.0732, -0.1351, 0.9836]}, - {t: [0.0482, 0.0022, -0.2011], r: [-0.5015, 0.1223, -0.1588, 0.8416]}, - {t: [0.0337, -0.0294, -0.2191], r: [0.9432, -0.2267, 0.0156, -0.2423]}, - {t: [0.0294, -0.0438, -0.1916], r: [0.9569, -0.2379, -0.08, 0.1464]}, - {t: [0.0346, -0.0376, -0.1714], r: [0.9569, -0.2379, -0.08, 0.1464]}, - {t: [0.0662, -0.0164, -0.1368], r: [0.0546, -0.0084, -0.1349, 0.9893]}, - {t: [0.068, -0.0102, -0.1955], r: [-0.4587, 0.1335, -0.2099, 0.853]}, - {t: [0.0529, -0.0353, -0.2127], r: [0.9107, -0.2444, 0.0606, -0.3274]}, - {t: [0.0466, -0.0483, -0.1959], r: [0.9518, -0.3056, -0.0236, 0.0063]}, - {t: [0.0488, -0.0485, -0.1773], r: [0.9518, -0.3056, -0.0236, 0.0063]}, -] as const; diff --git a/src/simulator/handPoses/HandPoseFK.ts b/src/simulator/handPoses/HandPoseFK.ts index c8576920..40c3c6e9 100644 --- a/src/simulator/handPoses/HandPoseFK.ts +++ b/src/simulator/handPoses/HandPoseFK.ts @@ -1,11 +1,30 @@ import * as THREE from 'three'; +/** + * SimulatorHandPoseRotations are authored as standardized biomechanical hand angles + * + * Long fingers: + * - x: flexion toward the palm; negative x extends away from the palm. + * - y: abduction away from the middle-finger axis; negative y adducts toward it. + * - z: axial radial roll toward the thumb; negative z rolls away from the thumb. + * + * Middle finger: + * - y: radial deviation toward index/thumb; negative y is ulnar deviation. + * + * Thumb: + * - x: flexion across the palm; negative x extends/repositions. + * - y: palmar abduction away from the palm; negative y adducts back. + * - z: opposition/internal roll into the hand; negative z repositions away. + */ + import {HAND_JOINT_NAMES} from '../../input/components/HandJointNames'; import {Handedness, type JointName} from '../../input/Hands'; import type { + SimulatorHandJointRotationArray, SimulatorHandPoseJoints, SimulatorHandPoseRotations, } from './HandPoseJoints'; +import {SIMULATOR_HAND_COMMON_BIOMECHANICAL_CONSTRAINTS_DEGREES} from './HandPoseJoints'; import {LEFT_HAND_NEUTRAL, RIGHT_HAND_NEUTRAL} from './NeutralHandPose'; const HAND_JOINT_PARENT: Partial> = { @@ -90,29 +109,95 @@ function createRestJoints( const LEFT_REST_JOINTS = createRestJoints(LEFT_HAND_NEUTRAL); const RIGHT_REST_JOINTS = createRestJoints(RIGHT_HAND_NEUTRAL); +const RAD_TO_DEG = 180 / Math.PI; +const DEG_TO_RAD = Math.PI / 180; + +function clamp(value: number, min: number, max: number) { + return Math.min(max, Math.max(min, value)); +} + +export function applySimulatorHandPoseRotationConstraints( + rotations: SimulatorHandPoseRotations +): SimulatorHandPoseRotations { + const constrainedRotations: SimulatorHandPoseRotations = {}; + + for (const [jointName, rotation] of Object.entries(rotations)) { + const jointConstraints = + SIMULATOR_HAND_COMMON_BIOMECHANICAL_CONSTRAINTS_DEGREES[ + jointName as keyof typeof SIMULATOR_HAND_COMMON_BIOMECHANICAL_CONSTRAINTS_DEGREES + ]; + constrainedRotations[jointName as JointName] = rotation.map( + (axisValue, axisIndex) => { + const axisConstraints = jointConstraints?.[axisIndex]; + if (!axisConstraints) return axisValue; + + const [minDegrees, maxDegrees] = axisConstraints; + return ( + clamp(axisValue * RAD_TO_DEG, minDegrees, maxDegrees) * DEG_TO_RAD + ); + } + ) as SimulatorHandJointRotationArray; + } + + return constrainedRotations; +} + +// conversion into the neutral hand pose standard +// TODO: could directly encode these into the actual quaternions +function getRawFKRotation( + jointName: JointName, + rotation: SimulatorHandPoseRotations[JointName] = [0, 0, 0] +): SimulatorHandJointRotationArray { + const [x, y, z] = rotation; + + if (jointName === 'thumb-metacarpal') { + return [y, x, -z]; + } + + if (jointName.startsWith('thumb-')) { + return [-x, -y, -z]; + } + + if ( + jointName.startsWith('index-finger-') || + jointName.startsWith('middle-finger-') + ) { + return [-x, -y, z]; + } + + return [-x, y, z]; +} function getHandednessRotation( handedness: Handedness, - rotation: SimulatorHandPoseRotations[JointName] = [0, 0, 0] + rotation: SimulatorHandJointRotationArray ) { if (handedness !== Handedness.RIGHT) { return rotation; } return [rotation[0], -rotation[1], -rotation[2]] as const; } - +// apply constraints applies a biomechanical constraint onto hand pose rotations function resolveHandPoseRotations( handedness: Handedness, restJoints: Map, - rotations: SimulatorHandPoseRotations + rotations: SimulatorHandPoseRotations, + applyConstraints = false ): SimulatorHandPoseJoints { const finalPositions = new Map(); const finalRotations = new Map(); const resolvedJoints: SimulatorHandPoseJoints = []; + const resolvedRotations = applyConstraints + ? applySimulatorHandPoseRotationConstraints(rotations) + : rotations; for (const jointName of HAND_JOINT_NAMES) { const restJoint = restJoints.get(jointName)!; - const rotation = getHandednessRotation(handedness, rotations[jointName]); + const rawRotation = getRawFKRotation( + jointName, + resolvedRotations[jointName] + ); + const rotation = getHandednessRotation(handedness, rawRotation); const offsetRotation = new THREE.Quaternion().setFromEuler( new THREE.Euler(rotation[0], rotation[1], rotation[2], 'XYZ') ); @@ -155,11 +240,13 @@ function resolveHandPoseRotations( export function resolveSimulatorHandPoseRotations( handedness: Handedness, - rotations: SimulatorHandPoseRotations + rotations: SimulatorHandPoseRotations, + applyConstraints = false ) { return resolveHandPoseRotations( handedness, handedness === Handedness.LEFT ? LEFT_REST_JOINTS : RIGHT_REST_JOINTS, - rotations + rotations, + applyConstraints ); } diff --git a/src/simulator/handPoses/HandPoseJoints.ts b/src/simulator/handPoses/HandPoseJoints.ts index 3ce2c0dc..dbd24bf6 100644 --- a/src/simulator/handPoses/HandPoseJoints.ts +++ b/src/simulator/handPoses/HandPoseJoints.ts @@ -7,12 +7,142 @@ export type SimulatorHandPoseJoints = { s?: number[]; }[]; +/** + * Semantic biomechanical hand angles in radians, ordered as [x, y, z]. + * + * Long fingers: + * - x: positive flexes toward the palm; negative extends away. + * - y: positive abducts away from the middle-finger axis; negative adducts. + * - z: positive axial roll toward the thumb; negative rolls away. + * + * Middle finger: + * - y: positive radial deviation toward index/thumb; negative ulnar deviation. + * + * Thumb: + * - x: positive flexes across the palm; negative extends/repositions. + * - y: positive palmar abduction away from the palm; negative adducts back. + * - z: positive opposition/internal roll into the hand; negative repositions away. + */ export type SimulatorHandJointRotationArray = [number, number, number]; export type SimulatorHandPoseRotations = Partial< Record >; +export type SimulatorHandPoseRotationRangeDegrees = readonly [ + minDegrees: number, + maxDegrees: number, +]; + +export type SimulatorHandPoseRotationConstraintsDegrees = Partial< + Record< + JointName, + readonly [ + x: SimulatorHandPoseRotationRangeDegrees, + y: SimulatorHandPoseRotationRangeDegrees, + z: SimulatorHandPoseRotationRangeDegrees, + ] + > +>; + +export const SIMULATOR_HAND_COMMON_BIOMECHANICAL_CONSTRAINTS_DEGREES = { + 'thumb-metacarpal': [ + [-10, 55], + [-15, 45], + [-20, 45], + ], + 'thumb-phalanx-proximal': [ + [-10, 70], + [-15, 15], + [0, 0], + ], + 'thumb-phalanx-distal': [ + [-15, 80], + [0, 0], + [0, 0], + ], + 'index-finger-metacarpal': [ + [0, 0], + [0, 0], + [0, 0], + ], + 'index-finger-phalanx-proximal': [ + [-30, 90], + [-20, 20], + [-10, 10], + ], + 'index-finger-phalanx-intermediate': [ + [0, 110], + [0, 0], + [0, 0], + ], + 'index-finger-phalanx-distal': [ + [0, 80], + [0, 0], + [0, 0], + ], + 'middle-finger-metacarpal': [ + [0, 0], + [0, 0], + [0, 0], + ], + 'middle-finger-phalanx-proximal': [ + [-30, 90], + [-10, 10], + [-10, 10], + ], + 'middle-finger-phalanx-intermediate': [ + [0, 110], + [0, 0], + [0, 0], + ], + 'middle-finger-phalanx-distal': [ + [0, 80], + [0, 0], + [0, 0], + ], + 'ring-finger-metacarpal': [ + [0, 0], + [0, 0], + [0, 0], + ], + 'ring-finger-phalanx-proximal': [ + [-30, 90], + [-15, 15], + [-10, 10], + ], + 'ring-finger-phalanx-intermediate': [ + [0, 110], + [0, 0], + [0, 0], + ], + 'ring-finger-phalanx-distal': [ + [0, 80], + [0, 0], + [0, 0], + ], + 'pinky-finger-metacarpal': [ + [0, 0], + [0, 0], + [0, 0], + ], + 'pinky-finger-phalanx-proximal': [ + [-30, 90], + [-20, 20], + [-10, 10], + ], + 'pinky-finger-phalanx-intermediate': [ + [0, 110], + [0, 0], + [0, 0], + ], + 'pinky-finger-phalanx-distal': [ + [0, 80], + [0, 0], + [0, 0], + ], +} as const satisfies SimulatorHandPoseRotationConstraintsDegrees; + const HAND_JOINT_NAME_SET = new Set(HAND_JOINT_NAMES); export function parseSimulatorHandPoseRotations( diff --git a/src/simulator/handPoses/HandPoseRotations.ts b/src/simulator/handPoses/HandPoseRotations.ts new file mode 100644 index 00000000..90ebb6cb --- /dev/null +++ b/src/simulator/handPoses/HandPoseRotations.ts @@ -0,0 +1,205 @@ +import type {SimulatorHandPoseRotations} from './HandPoseJoints'; +import {SimulatorHandPose} from './HandPoses'; + +export const SIMULATOR_HAND_POSE_ROTATIONS: Readonly< + Record +> = Object.freeze({ + [SimulatorHandPose.NEUTRAL]: { + wrist: [0, 0, 0], + 'thumb-metacarpal': [0, 0, 0], + 'thumb-phalanx-proximal': [0, 0, 0], + 'thumb-phalanx-distal': [0, 0, 0], + 'index-finger-metacarpal': [0, 0, 0], + 'index-finger-phalanx-proximal': [0, 0, 0], + 'index-finger-phalanx-intermediate': [0, 0, 0], + 'index-finger-phalanx-distal': [0, 0, 0], + 'middle-finger-metacarpal': [0, 0, 0], + 'middle-finger-phalanx-proximal': [0, 0, 0], + 'middle-finger-phalanx-intermediate': [0, 0, 0], + 'middle-finger-phalanx-distal': [0, 0, 0], + 'ring-finger-metacarpal': [0, 0, 0], + 'ring-finger-phalanx-proximal': [0, 0, 0], + 'ring-finger-phalanx-intermediate': [0, 0, 0], + 'ring-finger-phalanx-distal': [0, 0, 0], + 'pinky-finger-metacarpal': [0, 0, 0], + 'pinky-finger-phalanx-proximal': [0, 0, 0], + 'pinky-finger-phalanx-intermediate': [0, 0, 0], + 'pinky-finger-phalanx-distal': [0, 0, 0], + }, + [SimulatorHandPose.RELAXED]: { + wrist: [0.066528, 0.199494, 0.406252], + 'thumb-metacarpal': [0.288969, -0.421561, 0.566077], + 'thumb-phalanx-proximal': [0.314159, 0, 0], + 'thumb-phalanx-distal': [0, 0, 0], + 'index-finger-metacarpal': [0, 0, 0], + 'index-finger-phalanx-proximal': [0.436331, 0, 0], + 'index-finger-phalanx-intermediate': [0.57596, 0, 0], + 'index-finger-phalanx-distal': [0.226891, 0, 0], + 'middle-finger-metacarpal': [0, 0, 0], + 'middle-finger-phalanx-proximal': [0.157079, 0, 0], + 'middle-finger-phalanx-intermediate': [0.610866, 0, 0], + 'middle-finger-phalanx-distal': [0.2618, 0, 0], + 'ring-finger-metacarpal': [0, 0, 0], + 'ring-finger-phalanx-proximal': [0, 0, 0], + 'ring-finger-phalanx-intermediate': [0.610866, 0, 0], + 'ring-finger-phalanx-distal': [0.261799, 0, 0], + 'pinky-finger-metacarpal': [0, 0, 0], + 'pinky-finger-phalanx-proximal': [0, 0, 0], + 'pinky-finger-phalanx-intermediate': [0.506145, 0, 0], + 'pinky-finger-phalanx-distal': [0.261799, 0, 0], + }, + [SimulatorHandPose.PINCHING]: { + wrist: [0.066528, 0.199494, 0.406252], + 'thumb-metacarpal': [0.672677, -0.541947, 0.45959], + 'thumb-phalanx-proximal': [0.428777, -0.042223, -0.002288], + 'thumb-phalanx-distal': [-0.185089, -0.007076, -0.003675], + 'index-finger-metacarpal': [0.005858, -0.000129, 0.000663], + 'index-finger-phalanx-proximal': [0.959931, 0.11827, -0.091682], + 'index-finger-phalanx-intermediate': [0.692695, 0.000662, -0.000369], + 'index-finger-phalanx-distal': [0.033553, -0.000104, -0.000203], + 'middle-finger-metacarpal': [0.004162, 0.000012, -0.00278], + 'middle-finger-phalanx-proximal': [0.151863, 0.088683, 0.002485], + 'middle-finger-phalanx-intermediate': [0.715085, 0.000293, 0.000308], + 'middle-finger-phalanx-distal': [0.173078, -0.000105, -0.000133], + 'ring-finger-metacarpal': [0.001171, 0.000302, -0.007015], + 'ring-finger-phalanx-proximal': [-0.037672, -0.115556, 0.033333], + 'ring-finger-phalanx-intermediate': [0.690004, -0.000103, 0.000208], + 'ring-finger-phalanx-distal': [0.234816, -0.000133, 0.000076], + 'pinky-finger-metacarpal': [-0.002313, 0.000835, -0.011248], + 'pinky-finger-phalanx-proximal': [0.008876, -0.107748, 0.030917], + 'pinky-finger-phalanx-intermediate': [0.527087, -0.000118, 0.000211], + 'pinky-finger-phalanx-distal': [0.279492, 0.000126, 0.000026], + }, + [SimulatorHandPose.FIST]: { + wrist: [0.718906, -0.420664, 0.506276], + 'thumb-metacarpal': [0.501474, -0.295042, 0.551349], + 'thumb-phalanx-proximal': [0.457195, -0.17737, 0.299589], + 'thumb-phalanx-distal': [0.050138, 0.061422, -0.365074], + 'index-finger-metacarpal': [0.16857, 0.00471, 0], + 'index-finger-phalanx-proximal': [1.466077, 0, 0], + 'index-finger-phalanx-intermediate': [1.413682, -0.001122, 0.000132], + 'index-finger-phalanx-distal': [1.256637, -0.000368, 0], + 'middle-finger-metacarpal': [0.060684, 0.007245, 0], + 'middle-finger-phalanx-proximal': [1.186824, 0, 0], + 'middle-finger-phalanx-intermediate': [1.375812, -0.001242, 0.000057], + 'middle-finger-phalanx-distal': [1.169371, -0.000647, -0.000158], + 'ring-finger-metacarpal': [0, 0, 0], + 'ring-finger-phalanx-proximal': [1.169371, 0, 0], + 'ring-finger-phalanx-intermediate': [1.330938, 0.001089, -0.000398], + 'ring-finger-phalanx-distal': [1.343904, 0.00026, -0.000166], + 'pinky-finger-metacarpal': [-0.002309, 0, 0], + 'pinky-finger-phalanx-proximal': [1.256637, 0.000002, 0], + 'pinky-finger-phalanx-intermediate': [1.389296, 0.000234, -0.000492], + 'pinky-finger-phalanx-distal': [1.291544, 0.000307, 0.000013], + }, + [SimulatorHandPose.THUMBS_UP]: { + wrist: [0.704686, -0.201371, 1.791237], + 'thumb-metacarpal': [0.134051, -0.193436, 0.759515], + 'thumb-phalanx-proximal': [-0.125664, -0.029745, 0.357544], + 'thumb-phalanx-distal': [-0.08182, 0.010624, -0.369933], + 'index-finger-metacarpal': [0.156866, 0.01325, 0.103641], + 'index-finger-phalanx-proximal': [1.39272, -0.12805, 0.164079], + 'index-finger-phalanx-intermediate': [1.584616, -0.00124, 0.000347], + 'index-finger-phalanx-distal': [0.536045, -0.000439, -0.000414], + 'middle-finger-metacarpal': [0.055222, 0.011182, 0.102008], + 'middle-finger-phalanx-proximal': [1.326915, -0.138643, 0.126843], + 'middle-finger-phalanx-intermediate': [1.541392, -0.001225, 0.000167], + 'middle-finger-phalanx-distal': [0.707589, -0.000696, -0.000066], + 'ring-finger-metacarpal': [0.022297, -0.015343, 0.137564], + 'ring-finger-phalanx-proximal': [1.286056, 0.225023, 0.176957], + 'ring-finger-phalanx-intermediate': [1.562286, 0.001084, -0.000253], + 'ring-finger-phalanx-distal': [0.622574, 0.000385, 0.000122], + 'pinky-finger-metacarpal': [-0.007839, -0.022999, 0.194136], + 'pinky-finger-phalanx-proximal': [1.220849, 0.266958, 0.111277], + 'pinky-finger-phalanx-intermediate': [1.790949, 0.000178, -0.000611], + 'pinky-finger-phalanx-distal': [0.601801, 0.000321, 0.0003], + }, + [SimulatorHandPose.POINTING]: { + wrist: [0.596035, -0.414914, 1.043752], + 'thumb-metacarpal': [0.637297, -0.491225, 0.458936], + 'thumb-phalanx-proximal': [0.759414, -0.175775, 0.269178], + 'thumb-phalanx-distal': [0.081354, 0.073188, -0.363034], + 'index-finger-metacarpal': [0.000001, 0.003655, 0.000013], + 'index-finger-phalanx-proximal': [-0.000086, -0.000092, 0], + 'index-finger-phalanx-intermediate': [0, -0.000363, -0.001156], + 'index-finger-phalanx-distal': [0, 0.000023, -0.000357], + 'middle-finger-metacarpal': [0, 0.007851, 0], + 'middle-finger-phalanx-proximal': [0.944767, -0.158674, 0.038806], + 'middle-finger-phalanx-intermediate': [1.301244, -0.001132, -0.000083], + 'middle-finger-phalanx-distal': [0.429908, -0.000818, -0.000263], + 'ring-finger-metacarpal': [0.014748, -0.019316, 0.158147], + 'ring-finger-phalanx-proximal': [1.093878, 0.194757, 0.02078], + 'ring-finger-phalanx-intermediate': [1.298489, 0.001164, -0.00052], + 'ring-finger-phalanx-distal': [0.510774, 0.000157, -0.000034], + 'pinky-finger-metacarpal': [-0.008366, -0.028749, 0.217979], + 'pinky-finger-phalanx-proximal': [0.977895, 0.073588, -0.202452], + 'pinky-finger-phalanx-intermediate': [1.33904, 0.00018, -0.000557], + 'pinky-finger-phalanx-distal': [0.58579, 0.00031, 0.000028], + }, + [SimulatorHandPose.ROCK]: { + wrist: [0.011734, -0.065693, 0.297017], + 'thumb-metacarpal': [0.785398, -0.750492, 0.575959], + 'thumb-phalanx-proximal': [0.794647, -0.152901, 0.267991], + 'thumb-phalanx-distal': [-0.127808, -0.007272, -0.369855], + 'index-finger-metacarpal': [0.000008, 0.000002, 0], + 'index-finger-phalanx-proximal': [0, 0, 0], + 'index-finger-phalanx-intermediate': [0, -0.000368, -0.001003], + 'index-finger-phalanx-distal': [0, -0.00004, -0.000417], + 'middle-finger-metacarpal': [0.000012, 0, 0], + 'middle-finger-phalanx-proximal': [0.855211, -0.08504, -0.009794], + 'middle-finger-phalanx-intermediate': [1.064651, -0.001181, -0.000268], + 'middle-finger-phalanx-distal': [1.500983, 0.000001, -0.000536], + 'ring-finger-metacarpal': [0.006811, -0.000004, 0], + 'ring-finger-phalanx-proximal': [0.593412, 0.000002, 0], + 'ring-finger-phalanx-intermediate': [1.32645, 0.000966, -0.000864], + 'ring-finger-phalanx-distal': [0.977384, 0.000177, -0.000314], + 'pinky-finger-metacarpal': [-0.00368, -0.000004, 0], + 'pinky-finger-phalanx-proximal': [-0.000013, 0.008337, 0], + 'pinky-finger-phalanx-intermediate': [0, -0.00029, -0.000068], + 'pinky-finger-phalanx-distal': [0, 0.000287, -0.000171], + }, + [SimulatorHandPose.THUMBS_DOWN]: { + wrist: [0.640485, -1.129773, -0.862294], + 'thumb-metacarpal': [0.134043, -0.297017, 0.699054], + 'thumb-phalanx-proximal': [-0.219144, 0.085162, 0.341408], + 'thumb-phalanx-distal': [-0.182932, -0.028732, -0.368936], + 'index-finger-metacarpal': [0.179881, 0.01461, -0.081296], + 'index-finger-phalanx-proximal': [1.094576, -0.009837, 0.210567], + 'index-finger-phalanx-intermediate': [1.409529, -0.001213, 0.000183], + 'index-finger-phalanx-distal': [0.411586, -0.000133, -0.000362], + 'middle-finger-metacarpal': [0.067365, 0.01336, 0.042841], + 'middle-finger-phalanx-proximal': [1.170727, -0.076803, 0.077463], + 'middle-finger-phalanx-intermediate': [1.482675, -0.00116, 0.000134], + 'middle-finger-phalanx-distal': [0.578475, -0.000688, -0.000169], + 'ring-finger-metacarpal': [0.018267, -0.009114, 0.18615], + 'ring-finger-phalanx-proximal': [1.141257, 0.264759, 0.083493], + 'ring-finger-phalanx-intermediate': [1.504595, 0.001183, 0], + 'ring-finger-phalanx-distal': [0.52937, 0.000492, -0.000155], + 'pinky-finger-metacarpal': [0.00421, -0.021035, 0.291251], + 'pinky-finger-phalanx-proximal': [0.905139, 0.318725, -0.069524], + 'pinky-finger-phalanx-intermediate': [1.693415, 0.000318, -0.000533], + 'pinky-finger-phalanx-distal': [0.580409, 0.000258, 0.000122], + }, + [SimulatorHandPose.VICTORY]: { + wrist: [0.10923, 0.217352, 0.365586], + 'thumb-metacarpal': [0.907571, -0.577914, 0.414543], + 'thumb-phalanx-proximal': [0.931093, -0.18921, 0.243373], + 'thumb-phalanx-distal': [0.349066, 0.000003, -0.366582], + 'index-finger-metacarpal': [0, 0, 0], + 'index-finger-phalanx-proximal': [0, 0.000006, 0], + 'index-finger-phalanx-intermediate': [0, -0.000334, -0.000981], + 'index-finger-phalanx-distal': [0, -0.000126, -0.000478], + 'middle-finger-metacarpal': [0.000003, 0, 0], + 'middle-finger-phalanx-proximal': [0, -0.000022, 0], + 'middle-finger-phalanx-intermediate': [0, -0.000308, -0.001127], + 'middle-finger-phalanx-distal': [0, -0.000334, -0.000871], + 'ring-finger-metacarpal': [0.139626, -0.05236, 0.15708], + 'ring-finger-phalanx-proximal': [0.279253, -0.000012, 0], + 'ring-finger-phalanx-intermediate': [2.007129, 0.000761, -0.000725], + 'ring-finger-phalanx-distal': [0.663225, 0.000338, -0.000212], + 'pinky-finger-metacarpal': [0.157079, -0.087266, 0.191986], + 'pinky-finger-phalanx-proximal': [0.15708, -0.20944, 0], + 'pinky-finger-phalanx-intermediate': [2.059489, -0.000263, -0.000474], + 'pinky-finger-phalanx-distal': [0.977384, 0.000422, 0.000077], + }, +} as const); diff --git a/src/simulator/handPoses/HandPoses.ts b/src/simulator/handPoses/HandPoses.ts index 318bbc79..743c90f4 100644 --- a/src/simulator/handPoses/HandPoses.ts +++ b/src/simulator/handPoses/HandPoses.ts @@ -1,16 +1,3 @@ -import type {DeepReadonly} from '../../utils/Types'; - -import {LEFT_HAND_FIST, RIGHT_HAND_FIST} from './FistHandPoses'; -import type {SimulatorHandPoseJoints} from './HandPoseJoints'; -import {LEFT_HAND_NEUTRAL, RIGHT_HAND_NEUTRAL} from './NeutralHandPose'; -import {LEFT_HAND_PINCHING, RIGHT_HAND_PINCHING} from './PinchingHandPoses'; -import {LEFT_HAND_POINTING, RIGHT_HAND_POINTING} from './PointingHandPoses'; -import {LEFT_HAND_RELAXED, RIGHT_HAND_RELAXED} from './RelaxedHandPoses'; -import {LEFT_HAND_ROCK, RIGHT_HAND_ROCK} from './RockHandPoses'; -import {LEFT_HAND_THUMBS_DOWN, RIGHT_HAND_THUMBS_DOWN} from './ThumbsDownPoses'; -import {LEFT_HAND_THUMBS_UP, RIGHT_HAND_THUMBS_UP} from './ThumbsUpPoses'; -import {LEFT_HAND_VICTORY, RIGHT_HAND_VICTORY} from './VictoryHandPoses'; - // Enum of hand poses. export enum SimulatorHandPose { NEUTRAL = 'neutral', @@ -24,34 +11,6 @@ export enum SimulatorHandPose { VICTORY = 'victory', } -export const SIMULATOR_HAND_POSE_TO_JOINTS_LEFT: DeepReadonly< - Record -> = Object.freeze({ - [SimulatorHandPose.NEUTRAL]: LEFT_HAND_NEUTRAL, - [SimulatorHandPose.RELAXED]: LEFT_HAND_RELAXED, - [SimulatorHandPose.PINCHING]: LEFT_HAND_PINCHING, - [SimulatorHandPose.FIST]: LEFT_HAND_FIST, - [SimulatorHandPose.THUMBS_UP]: LEFT_HAND_THUMBS_UP, - [SimulatorHandPose.POINTING]: LEFT_HAND_POINTING, - [SimulatorHandPose.ROCK]: LEFT_HAND_ROCK, - [SimulatorHandPose.THUMBS_DOWN]: LEFT_HAND_THUMBS_DOWN, - [SimulatorHandPose.VICTORY]: LEFT_HAND_VICTORY, -} as const); - -export const SIMULATOR_HAND_POSE_TO_JOINTS_RIGHT: DeepReadonly< - Record -> = Object.freeze({ - [SimulatorHandPose.NEUTRAL]: RIGHT_HAND_NEUTRAL, - [SimulatorHandPose.RELAXED]: RIGHT_HAND_RELAXED, - [SimulatorHandPose.PINCHING]: RIGHT_HAND_PINCHING, - [SimulatorHandPose.FIST]: RIGHT_HAND_FIST, - [SimulatorHandPose.THUMBS_UP]: RIGHT_HAND_THUMBS_UP, - [SimulatorHandPose.POINTING]: RIGHT_HAND_POINTING, - [SimulatorHandPose.ROCK]: RIGHT_HAND_ROCK, - [SimulatorHandPose.THUMBS_DOWN]: RIGHT_HAND_THUMBS_DOWN, - [SimulatorHandPose.VICTORY]: RIGHT_HAND_VICTORY, -}); - export const SIMULATOR_HAND_POSE_NAMES: Readonly< Record > = Object.freeze({ diff --git a/src/simulator/handPoses/NeutralHandPose.ts b/src/simulator/handPoses/NeutralHandPose.ts index a28d3376..62d3e6fd 100644 --- a/src/simulator/handPoses/NeutralHandPose.ts +++ b/src/simulator/handPoses/NeutralHandPose.ts @@ -133,123 +133,123 @@ export const RIGHT_HAND_NEUTRAL = [ s: [1, 1, 1], }, { - t: [0.02714, -0.066906, -0.122492], - r: [0.390827, 0.303443, 0.211954, 0.842754], + t: [0.027338, -0.067039, -0.122241], + r: [0.394372, 0.415858, 0.220458, 0.789271], s: [1, 1, 1], }, { - t: [-0.012951, -0.037875, -0.148455], - r: [0.456561, 0.261457, 0.42092, 0.738834], + t: [-0.017754, -0.043135, -0.143554], + r: [0.514492, 0.382382, 0.392596, 0.659546], s: [1, 1, 1], }, { - t: [-0.034444, -0.025126, -0.16151], - r: [0.531996, 0.128649, 0.517554, 0.657452], + t: [-0.043077, -0.032545, -0.149159], + r: [0.56159, 0.206804, 0.487, 0.636248], s: [1, 1, 1], }, { - t: [-0.055852, -0.008059, -0.175472], - r: [0.531942, 0.128636, 0.517501, 0.657385], + t: [-0.067278, -0.017229, -0.159647], + r: [0.56161, 0.206811, 0.487017, 0.636271], s: [1, 1, 1], }, { - t: [0.032341, -0.059135, -0.115948], - r: [0.560925, 0.108731, 0.182482, 0.800152], + t: [0.032269, -0.059371, -0.115777], + r: [0.567561, 0.097691, 0.203196, 0.791889], s: [1, 1, 1], }, { - t: [0.005279, 0.003447, -0.154551], - r: [0.501803, 0.014742, 0.185614, 0.844655], + t: [0.005609, 0.002735, -0.153999], + r: [0.507186, 0.063324, 0.203911, 0.83502], s: [1, 1, 1], }, { - t: [-0.003678, 0.037362, -0.173626], - r: [0.440465, -0.001003, 0.184485, 0.878535], + t: [-0.007245, 0.035597, -0.172199], + r: [0.458663, 0.049313, 0.205676, 0.86312], s: [1, 1, 1], }, { - t: [-0.007055, 0.054976, -0.187353], - r: [0.439723, -0.035383, 0.16791, 0.881478], + t: [-0.013177, 0.052938, -0.185024], + r: [0.397899, 0.002456, 0.189554, 0.897684], s: [1, 1, 1], }, { - t: [-0.008779, 0.073092, -0.202432], - r: [0.439692, -0.035381, 0.167898, 0.881417], + t: [-0.016515, 0.069224, -0.201788], + r: [0.397916, 0.002456, 0.189562, 0.897722], s: [1, 1, 1], }, { - t: [0.043703, -0.053527, -0.112791], - r: [0.558877, 0.019041, 0.1763, 0.810031], + t: [0.043623, -0.053662, -0.112719], + r: [0.553746, 0.007309, 0.191796, 0.810263], s: [1, 1, 1], }, { - t: [0.028511, 0.010965, -0.145572], - r: [0.432239, -0.006021, 0.115346, 0.894241], + t: [0.028562, 0.010251, -0.145199], + r: [0.472064, -0.017109, 0.111029, 0.874356], s: [1, 1, 1], }, { - t: [0.024687, 0.044316, -0.172183], - r: [0.440799, 0.034254, 0.1351, 0.886651], + t: [0.02549, 0.045618, -0.168513], + r: [0.441765, 0.01643, 0.133573, 0.886956], s: [1, 1, 1], }, { - t: [0.019373, 0.06842, -0.190857], - r: [0.424278, 0.040476, 0.143145, 0.893232], + t: [0.021146, 0.069622, -0.187059], + r: [0.310755, 0.005124, 0.143074, 0.939638], s: [1, 1, 1], }, { - t: [0.0149, 0.08625, -0.207445], - r: [0.42431, 0.040479, 0.143156, 0.8933], + t: [0.019044, 0.083146, -0.207534], + r: [0.310762, 0.005124, 0.143078, 0.939662], s: [1, 1, 1], }, { - t: [0.055416, -0.052725, -0.110626], - r: [0.54139, -0.067994, 0.183816, 0.817666], + t: [0.055288, -0.052779, -0.110872], + r: [0.521068, -0.080546, 0.193884, 0.827277], s: [1, 1, 1], }, { - t: [0.051144, 0.007776, -0.142131], - r: [0.43212, -0.002596, 0.053462, 0.900259], + t: [0.051159, 0.007143, -0.141754], + r: [0.461693, -0.031862, 0.045643, 0.885256], s: [1, 1, 1], }, { - t: [0.049513, 0.038866, -0.167958], - r: [0.43004, 0.023258, 0.068866, 0.899852], + t: [0.051676, 0.039517, -0.165253], + r: [0.378491, -0.011831, 0.061086, 0.923512], s: [1, 1, 1], }, { - t: [0.046401, 0.063754, -0.188051], - r: [0.405791, 0.02026, 0.093674, 0.908878], + t: [0.051113, 0.062013, -0.187766], + r: [0.260819, -0.021358, 0.083438, 0.961583], s: [1, 1, 1], }, { - t: [0.04415, 0.07964, -0.203715], - r: [0.40578, 0.02026, 0.093671, 0.908852], + t: [0.051187, 0.072388, -0.207475], + r: [0.260827, -0.021359, 0.083441, 0.961614], s: [1, 1, 1], }, { - t: [0.066378, -0.054668, -0.108764], - r: [0.519054, -0.162615, 0.164965, 0.822762], + t: [0.066037, -0.054584, -0.108849], + r: [0.488069, -0.176432, 0.171185, 0.837447], s: [1, 1, 1], }, { - t: [0.074255, -0.000033, -0.137755], - r: [0.373958, -0.03966, -0.015715, 0.926469], + t: [0.074056, -0.000635, -0.137437], + r: [0.440891, -0.100924, -0.027575, 0.891356], s: [1, 1, 1], }, { - t: [0.076808, 0.023101, -0.164096], - r: [0.459067, -0.036703, -0.005892, 0.887605], + t: [0.080655, 0.025614, -0.159345], + r: [0.437071, -0.097627, -0.021249, 0.893713], s: [1, 1, 1], }, { - t: [0.078415, 0.042099, -0.176711], - r: [0.469121, -0.020332, 0.049975, 0.881495], + t: [0.085037, 0.043556, -0.172445], + r: [0.3904, -0.08214, 0.029839, 0.916297], s: [1, 1, 1], }, { - t: [0.079492, 0.057874, -0.187862], - r: [0.469173, -0.020334, 0.04998, 0.881592], + t: [0.08881, 0.056942, -0.18567], + r: [0.390393, -0.082139, 0.029838, 0.916279], s: [1, 1, 1], }, ] as const; diff --git a/src/simulator/handPoses/PinchingHandPoses.ts b/src/simulator/handPoses/PinchingHandPoses.ts deleted file mode 100644 index 96be2512..00000000 --- a/src/simulator/handPoses/PinchingHandPoses.ts +++ /dev/null @@ -1,247 +0,0 @@ -export const LEFT_HAND_PINCHING = [ - {t: [-0.05, -0.08, -0.1], r: [0.5373, 0, 0, 0.8434], s: [1, 1, 1]}, - { - t: [-0.0281, -0.0594, -0.1165], - r: [0.3072, -0.0483, -0.257, 0.915], - s: [1, 1, 1], - }, - { - t: [-0.0083, -0.0299, -0.1581], - r: [0.1832, 0.0632, -0.4718, 0.8602], - s: [1, 1, 1], - }, - { - t: [-0.0069, -0.0195, -0.1841], - r: [0.2232, 0.1362, -0.6112, 0.747], - s: [1, 1, 0.9999], - }, - { - t: [-0.0063, -0.0051, -0.2109], - r: [0.2232, 0.1362, -0.6112, 0.747], - s: [1, 1, 0.9999], - }, - { - t: [-0.0369, -0.0541, -0.112], - r: [0.5858, -0.1038, 0.0205, 0.8035], - s: [1, 1, 1], - }, - { - t: [-0.024, 0.0142, -0.1465], - r: [0.1342, -0.1392, -0.0707, 0.9786], - s: [1.0001, 1, 0.9999], - }, - { - t: [-0.0122, 0.0248, -0.1828], - r: [-0.2614, -0.0983, -0.1184, 0.9529], - s: [1.0001, 0.9999, 0.9999], - }, - { - t: [-0.0095, 0.0131, -0.2017], - r: [-0.3454, -0.0506, -0.1338, 0.9275], - s: [1, 0.9999, 1], - }, - { - t: [-0.0098, -0.0028, -0.219], - r: [-0.3454, -0.0506, -0.1338, 0.9275], - s: [1, 0.9999, 1], - }, - { - t: [-0.0498, -0.0529, -0.1126], - r: [0.5552, -0.0196, 0.0307, 0.8309], - s: [1.0001, 1, 1], - }, - { - t: [-0.0496, 0.0131, -0.1444], - r: [0.3957, -0.0669, 0.0916, 0.9113], - s: [1, 0.9999, 1], - }, - { - t: [-0.0477, 0.0443, -0.173], - r: [0.0284, -0.1256, 0.0276, 0.9913], - s: [1, 1, 0.9999], - }, - { - t: [-0.0403, 0.0463, -0.2027], - r: [-0.1956, -0.1387, -0.007, 0.9708], - s: [1.0001, 1, 1], - }, - { - t: [-0.0339, 0.036, -0.224], - r: [-0.1956, -0.1387, -0.007, 0.9708], - s: [1.0001, 1, 1], - }, - { - t: [-0.0612, -0.0561, -0.1137], - r: [0.5088, 0.0591, 0.0245, 0.8585], - s: [1, 1.0001, 1], - }, - { - t: [-0.0697, 0.0021, -0.1467], - r: [0.464, -0.0595, 0.1601, 0.8692], - s: [1, 1, 1], - }, - { - t: [-0.0713, 0.0348, -0.1698], - r: [0.0595, -0.1373, 0.0948, 0.9842], - s: [1.0001, 1.0001, 1], - }, - { - t: [-0.0633, 0.0395, -0.2003], - r: [-0.1735, -0.159, 0.0354, 0.9713], - s: [1, 1, 0.9999], - }, - { - t: [-0.0561, 0.0313, -0.2197], - r: [-0.1735, -0.159, 0.0354, 0.9713], - s: [1, 1, 0.9999], - }, - { - t: [-0.0707, -0.0617, -0.1146], - r: [0.4573, 0.1467, 0.0408, 0.8762], - s: [1, 1, 1], - }, - { - t: [-0.0889, -0.0132, -0.148], - r: [0.4065, 0.0051, 0.2314, 0.8838], - s: [1, 0.9999, 1.0001], - }, - { - t: [-0.0946, 0.0109, -0.1723], - r: [0.1595, -0.0578, 0.2175, 0.9612], - s: [1, 0.9999, 1], - }, - { - t: [-0.094, 0.019, -0.1934], - r: [-0.0122, -0.1189, 0.1509, 0.9813], - s: [1.0001, 1, 1], - }, - { - t: [-0.0904, 0.0182, -0.2123], - r: [-0.0122, -0.1189, 0.1509, 0.9813], - s: [1.0001, 1, 1], - }, -] as const; - -export const RIGHT_HAND_PINCHING = [ - {t: [0.05, -0.08, -0.1], r: [0.5373, 0, 0, 0.8434], s: [1, 1, 1]}, - { - t: [0.0279, -0.0593, -0.1166], - r: [0.307, 0.046, 0.2483, 0.9176], - s: [1, 1, 1], - }, - { - t: [0.0082, -0.0291, -0.1587], - r: [0.1833, -0.0669, 0.4657, 0.8632], - s: [0.9999, 1, 1], - }, - { - t: [0.0071, -0.0186, -0.185], - r: [0.2256, -0.1369, 0.6093, 0.7477], - s: [1, 1, 0.9999], - }, - { - t: [0.0064, -0.0039, -0.212], - r: [0.2256, -0.1369, 0.6093, 0.7477], - s: [1, 1, 0.9999], - }, - { - t: [0.037, -0.0539, -0.1122], - r: [0.5831, 0.1146, -0.0388, 0.8034], - s: [1, 0.9999, 1], - }, - { - t: [0.0237, 0.0153, -0.147], - r: [0.1209, 0.0891, 0.0196, 0.9885], - s: [1, 0.9999, 1], - }, - { - t: [0.0163, 0.0257, -0.1849], - r: [-0.2747, 0.0723, 0.0511, 0.9574], - s: [1, 0.9999, 0.9999], - }, - { - t: [0.014, 0.0138, -0.204], - r: [-0.3165, 0.0337, 0.0633, 0.9459], - s: [1, 0.9999, 1], - }, - { - t: [0.0136, -0.0012, -0.2226], - r: [-0.3165, 0.0337, 0.0633, 0.9459], - s: [1, 0.9999, 1], - }, - { - t: [0.0501, -0.0527, -0.1126], - r: [0.5625, 0.0291, -0.0455, 0.825], - s: [1, 1, 1], - }, - { - t: [0.0497, 0.0141, -0.1449], - r: [0.3465, 0.0658, -0.0921, 0.9312], - s: [1.0001, 0.9999, 0.9999], - }, - { - t: [0.0473, 0.0424, -0.177], - r: [0.0559, 0.1235, -0.0403, 0.9899], - s: [1.0001, 1, 0.9999], - }, - { - t: [0.0402, 0.0463, -0.2069], - r: [-0.0703, 0.1381, -0.0195, 0.9877], - s: [1.0001, 1, 0.9999], - }, - { - t: [0.0335, 0.0419, -0.2304], - r: [-0.0703, 0.1381, -0.0195, 0.9877], - s: [1.0001, 1, 0.9999], - }, - { - t: [0.0615, -0.0561, -0.1136], - r: [0.5287, -0.0513, -0.0363, 0.8465], - s: [1.0001, 1, 0.9999], - }, - { - t: [0.07, 0.003, -0.1472], - r: [0.4197, 0.0598, -0.1607, 0.8913], - s: [1, 1, 0.9999], - }, - { - t: [0.0709, 0.0336, -0.1737], - r: [0.1329, 0.1258, -0.1128, 0.9766], - s: [1, 1, 1], - }, - { - t: [0.0643, 0.0431, -0.2038], - r: [-0.0172, 0.145, -0.068, 0.9869], - s: [1.0001, 0.9999, 1], - }, - { - t: [0.0577, 0.0418, -0.2253], - r: [-0.0172, 0.145, -0.068, 0.9869], - s: [1.0001, 0.9999, 1], - }, - { - t: [0.0711, -0.0617, -0.1145], - r: [0.4861, -0.139, -0.0517, 0.8612], - s: [1.0001, 0.9999, 1], - }, - { - t: [0.0893, -0.0125, -0.1485], - r: [0.317, 0.0459, -0.2224, 0.9208], - s: [1.0001, 0.9999, 1], - }, - { - t: [0.0902, 0.0078, -0.1772], - r: [0.1921, 0.0784, -0.2077, 0.9559], - s: [1, 1, 0.9999], - }, - { - t: [0.0889, 0.0174, -0.1979], - r: [0.0936, 0.1253, -0.1462, 0.9768], - s: [1.0001, 1, 1], - }, - { - t: [0.0857, 0.0208, -0.2167], - r: [0.0936, 0.1253, -0.1462, 0.9768], - s: [1.0001, 1, 1], - }, -] as const; diff --git a/src/simulator/handPoses/PointingHandPoses.ts b/src/simulator/handPoses/PointingHandPoses.ts deleted file mode 100644 index a9c55100..00000000 --- a/src/simulator/handPoses/PointingHandPoses.ts +++ /dev/null @@ -1,55 +0,0 @@ -export const LEFT_HAND_POINTING = [ - {t: [-0.0283, -0.0376, -0.0293], r: [0.1372, -0.208, 0.241, 0.938]}, - {t: [0.0016, -0.0246, -0.0431], r: [0.0106, -0.3992, -0.0014, 0.9168]}, - {t: [0.0392, -0.0237, -0.0781], r: [-0.1, -0.2869, -0.466, 0.831]}, - {t: [0.0496, -0.0357, -0.1004], r: [-0.1511, -0.183, -0.4918, 0.8377]}, - {t: [0.0533, -0.0497, -0.1265], r: [-0.1511, -0.183, -0.4918, 0.8377]}, - {t: [-0.0078, -0.0226, -0.0496], r: [0.1168, -0.3031, 0.3253, 0.8881]}, - {t: [0.0265, 0.0074, -0.1082], r: [0.0563, -0.1303, 0.2725, 0.9516]}, - {t: [0.0346, 0.0153, -0.1453], r: [-0.0635, -0.1606, 0.2541, 0.9516]}, - {t: [0.0419, 0.0144, -0.1659], r: [-0.1073, -0.1342, 0.2464, 0.9538]}, - {t: [0.0494, 0.0105, -0.1873], r: [-0.1073, -0.1342, 0.2464, 0.9538]}, - {t: [-0.0184, -0.0273, -0.0562], r: [0.1156, -0.2249, 0.3238, 0.9117]}, - {t: [0.0052, -0.0021, -0.1177], r: [-0.4452, -0.2871, 0.2041, 0.8233]}, - {t: [0.0324, -0.0274, -0.1363], r: [0.8476, 0.3909, 0.031, -0.3574]}, - {t: [0.0392, -0.0465, -0.1142], r: [0.9167, 0.3645, 0.16, -0.0352]}, - {t: [0.032, -0.0501, -0.0915], r: [0.9167, 0.3645, 0.16, -0.0352]}, - {t: [-0.028, -0.0348, -0.0593], r: [0.0757, -0.1724, 0.308, 0.9326]}, - {t: [-0.01, -0.0186, -0.1201], r: [-0.5151, -0.3075, 0.2332, 0.7654]}, - {t: [0.018, -0.0439, -0.1306], r: [0.8841, 0.4115, 0.0419, -0.2175]}, - {t: [0.0214, -0.0572, -0.1026], r: [0.8915, 0.3885, 0.1955, 0.1266]}, - {t: [0.0111, -0.0549, -0.0835], r: [0.8915, 0.3885, 0.1955, 0.1266]}, - {t: [-0.0357, -0.0434, -0.0601], r: [0.0242, -0.0998, 0.3079, 0.9459]}, - {t: [-0.0254, -0.037, -0.1183], r: [-0.4608, -0.35, 0.2807, 0.7658]}, - {t: [0.0022, -0.0544, -0.1281], r: [0.8346, 0.4535, 0.0038, -0.3127]}, - {t: [0.0089, -0.0663, -0.1107], r: [0.8657, 0.4769, 0.1519, -0.0059]}, - {t: [0.003, -0.0699, -0.0932], r: [0.8657, 0.4769, 0.1519, -0.0059]}, -] as const; - -export const RIGHT_HAND_POINTING = [ - {t: [-0.0042, -0.0248, -0.0222], r: [0.1163, -0.0095, -0.3006, 0.9466]}, - {t: [-0.024, -0.0114, -0.048], r: [-0.052, 0.2376, -0.0719, 0.9673]}, - {t: [-0.0482, -0.0149, -0.0937], r: [-0.2324, 0.2162, 0.3797, 0.869]}, - {t: [-0.0535, -0.0306, -0.1155], r: [-0.2846, 0.1212, 0.4068, 0.8595]}, - {t: [-0.0521, -0.0492, -0.1388], r: [-0.2846, 0.1212, 0.4068, 0.8595]}, - {t: [-0.0129, -0.0119, -0.0508], r: [0.1258, 0.0866, -0.3895, 0.9083]}, - {t: [-0.0173, 0.01, -0.1215], r: [0.1174, -0.0564, -0.3421, 0.9306]}, - {t: [-0.0097, 0.018, -0.1587], r: [-0.0512, 0.0028, -0.347, 0.9365]}, - {t: [-0.0105, 0.0158, -0.1805], r: [-0.1583, 0.003, -0.3458, 0.9249]}, - {t: [-0.0137, 0.0085, -0.2021], r: [-0.1583, 0.003, -0.3458, 0.9249]}, - {t: [-0.0017, -0.019, -0.052], r: [0.1155, 0.0062, -0.386, 0.9152]}, - {t: [0.0038, -0.0037, -0.1206], r: [-0.2494, 0.0619, -0.3947, 0.8822]}, - {t: [-0.0086, -0.0197, -0.1569], r: [-0.7146, 0.3231, -0.2612, 0.5628]}, - {t: [-0.0306, -0.0389, -0.1502], r: [0.8643, -0.4054, 0.1306, -0.2676]}, - {t: [-0.0406, -0.0469, -0.1297], r: [0.8643, -0.4054, 0.1306, -0.2676]}, - {t: [0.0068, -0.0279, -0.0499], r: [0.0671, -0.0438, -0.3807, 0.9212]}, - {t: [0.0155, -0.022, -0.1146], r: [-0.3096, 0.1005, -0.4385, 0.8377]}, - {t: [-0.0022, -0.0389, -0.1452], r: [0.7388, -0.369, 0.2794, -0.4899]}, - {t: [-0.0264, -0.0553, -0.1341], r: [0.852, -0.4611, 0.1257, -0.214]}, - {t: [-0.0346, -0.0602, -0.1146], r: [0.852, -0.4611, 0.1257, -0.214]}, - {t: [0.0126, -0.0374, -0.0464], r: [0.0105, -0.1129, -0.3882, 0.9146]}, - {t: [0.0254, -0.0415, -0.1045], r: [-0.3088, 0.1125, -0.4825, 0.8119]}, - {t: [0.0078, -0.0548, -0.1304], r: [-0.6368, 0.3211, -0.3767, 0.5912]}, - {t: [-0.0112, -0.0661, -0.1307], r: [0.7535, -0.4639, 0.2523, -0.3916]}, - {t: [-0.0244, -0.0737, -0.1196], r: [0.7535, -0.4639, 0.2523, -0.3916]}, -] as const; diff --git a/src/simulator/handPoses/RelaxedHandPoses.ts b/src/simulator/handPoses/RelaxedHandPoses.ts deleted file mode 100644 index d4711fb0..00000000 --- a/src/simulator/handPoses/RelaxedHandPoses.ts +++ /dev/null @@ -1,55 +0,0 @@ -export const LEFT_HAND_RELAXED = [ - {t: [-0.05, -0.08, -0.1], r: [0.5373, 0, 0, 0.8434]}, - {t: [-0.0281, -0.0594, -0.1165], r: [0.3943, -0.2036, -0.3103, 0.8407]}, - {t: [0.0026, -0.0299, -0.1518], r: [0.3476, -0.1049, -0.5285, 0.7674]}, - {t: [0.0169, -0.0181, -0.1728], r: [0.3521, 0.0515, -0.635, 0.6857]}, - {t: [0.0268, -0.0018, -0.1966], r: [0.3521, 0.0515, -0.635, 0.6857]}, - {t: [-0.0369, -0.0541, -0.1121], r: [0.5882, -0.1036, 0.0205, 0.8018]}, - {t: [-0.024, 0.0143, -0.1465], r: [0.3269, -0.0887, -0.0003, 0.9409]}, - {t: [-0.0172, 0.0394, -0.1765], r: [-0.0114, -0.0813, -0.0286, 0.9962]}, - {t: [-0.0138, 0.0388, -0.1986], r: [-0.1994, -0.0379, -0.0372, 0.9785]}, - {t: [-0.0125, 0.0287, -0.2199], r: [-0.1994, -0.0379, -0.0372, 0.9785]}, - {t: [-0.0499, -0.0528, -0.1125], r: [0.5569, -0.0203, 0.0319, 0.8297]}, - {t: [-0.0496, 0.0131, -0.1445], r: [0.3908, -0.0273, 0.1089, 0.9136]}, - {t: [-0.0513, 0.0438, -0.1738], r: [0.0747, -0.0923, 0.0634, 0.9909]}, - {t: [-0.0462, 0.0488, -0.2036], r: [-0.1936, -0.1156, 0.0299, 0.9738]}, - {t: [-0.0404, 0.0387, -0.2253], r: [-0.1936, -0.1156, 0.0299, 0.9738]}, - {t: [-0.0612, -0.0561, -0.1138], r: [0.5095, 0.0572, 0.0274, 0.8581]}, - {t: [-0.0698, 0.0022, -0.1468], r: [0.4396, -0.0068, 0.1748, 0.881]}, - {t: [-0.0751, 0.0329, -0.1719], r: [0.071, -0.0911, 0.1344, 0.9842]}, - {t: [-0.0703, 0.0383, -0.2029], r: [-0.1764, -0.1244, 0.0831, 0.9729]}, - {t: [-0.0641, 0.0302, -0.2227], r: [-0.1764, -0.1244, 0.0831, 0.9729]}, - {t: [-0.0708, -0.0616, -0.1145], r: [0.4571, 0.1437, 0.0457, 0.8765]}, - {t: [-0.0889, -0.0132, -0.148], r: [0.3971, 0.0569, 0.2436, 0.883]}, - {t: [-0.098, 0.0096, -0.1727], r: [0.1604, -0.0085, 0.243, 0.9566]}, - {t: [-0.0997, 0.0171, -0.194], r: [-0.0034, -0.0735, 0.1859, 0.9798]}, - {t: [-0.0979, 0.0165, -0.2131], r: [-0.0034, -0.0735, 0.1859, 0.9798]}, -] as const; - -export const RIGHT_HAND_RELAXED = [ - {t: [0.05, -0.08, -0.1], r: [0.5373, 0, 0, 0.8434]}, - {t: [0.0279, -0.0592, -0.1167], r: [0.3237, 0.1161, 0.293, 0.8921]}, - {t: [0.0026, -0.0313, -0.158], r: [0.2171, 0.0194, 0.5207, 0.8254]}, - {t: [-0.0042, -0.0219, -0.1837], r: [0.2597, -0.0685, 0.6498, 0.711]}, - {t: [-0.01, -0.0084, -0.2107], r: [0.2597, -0.0685, 0.6498, 0.711]}, - {t: [0.037, -0.0539, -0.1123], r: [0.5808, 0.1164, -0.0414, 0.8046]}, - {t: [0.0238, 0.0151, -0.147], r: [0.3081, 0.0484, -0.0273, 0.9497]}, - {t: [0.0206, 0.0393, -0.1786], r: [-0.0461, 0.0526, -0.0104, 0.9975]}, - {t: [0.0185, 0.0373, -0.201], r: [-0.1674, 0.0162, -0.0064, 0.9857]}, - {t: [0.0177, 0.0287, -0.223], r: [-0.1674, 0.0162, -0.0064, 0.9857]}, - {t: [0.05, -0.0527, -0.1126], r: [0.5619, 0.0306, -0.0478, 0.8252]}, - {t: [0.0497, 0.0138, -0.1449], r: [0.353, 0.0474, -0.1014, 0.9289]}, - {t: [0.0491, 0.0425, -0.1767], r: [0.0777, 0.1076, -0.0559, 0.9896]}, - {t: [0.0431, 0.0478, -0.2066], r: [-0.0679, 0.1248, -0.0343, 0.9893]}, - {t: [0.0369, 0.0436, -0.2302], r: [-0.0679, 0.1248, -0.0343, 0.9893]}, - {t: [0.0614, -0.0561, -0.1136], r: [0.5303, -0.05, -0.0384, 0.8455]}, - {t: [0.0699, 0.0028, -0.1472], r: [0.4168, 0.0427, -0.1662, 0.8926]}, - {t: [0.0722, 0.0331, -0.1739], r: [0.1339, 0.1107, -0.1236, 0.977]}, - {t: [0.0665, 0.0425, -0.2041], r: [-0.0175, 0.1318, -0.0809, 0.9878]}, - {t: [0.0606, 0.0413, -0.2257], r: [-0.0175, 0.1318, -0.0809, 0.9878]}, - {t: [0.0711, -0.0618, -0.1145], r: [0.4891, -0.1378, -0.0535, 0.8596]}, - {t: [0.0892, -0.0127, -0.1484], r: [0.3439, 0.0196, -0.23, 0.9102]}, - {t: [0.0924, 0.0087, -0.1761], r: [0.1965, 0.0585, -0.2173, 0.9543]}, - {t: [0.0921, 0.0184, -0.1968], r: [0.0936, 0.1069, -0.1575, 0.9773]}, - {t: [0.0896, 0.0217, -0.2157], r: [0.0936, 0.1069, -0.1575, 0.9773]}, -] as const; diff --git a/src/simulator/handPoses/RockHandPoses.ts b/src/simulator/handPoses/RockHandPoses.ts deleted file mode 100644 index d216d306..00000000 --- a/src/simulator/handPoses/RockHandPoses.ts +++ /dev/null @@ -1,255 +0,0 @@ -export const LEFT_HAND_ROCK = [ - { - t: [-0.0123, -0.0183, -0.0267], - r: [0.5149, -0.0845, -0.1158, 0.8452], - s: [1, 1, 1], - }, - { - t: [0.0153, -0.0052, -0.0437], - r: [0.2665, -0.0899, -0.3721, 0.8846], - s: [1, 1, 1], - }, - { - t: [0.0335, 0.0154, -0.0867], - r: [0.0177, 0.1842, -0.6731, 0.716], - s: [1, 1, 1], - }, - { - t: [0.0267, 0.0228, -0.1122], - r: [0.0728, 0.2226, -0.6735, 0.7011], - s: [1, 1, 1], - }, - { - t: [0.019, 0.0341, -0.1386], - r: [0.0728, 0.2226, -0.6735, 0.7011], - s: [1, 1, 1], - }, - { - t: [0.0067, 0.0029, -0.0406], - r: [0.475, -0.2118, -0.0726, 0.851], - s: [1, 1, 1], - }, - { - t: [0.0388, 0.061, -0.0749], - r: [0.5779, -0.1002, -0.0602, 0.8077], - s: [1, 1, 1], - }, - { - t: [0.0481, 0.097, -0.086], - r: [0.5059, -0.0922, -0.0672, 0.855], - s: [1, 1, 1], - }, - { - t: [0.0529, 0.1158, -0.0964], - r: [0.4458, -0.0565, -0.053, 0.8918], - s: [1, 1, 1], - }, - { - t: [0.0562, 0.1334, -0.1107], - r: [0.4458, -0.0565, -0.053, 0.8918], - s: [1, 1, 1], - }, - { - t: [-0.0052, 0.0075, -0.0412], - r: [0.5055, -0.126, -0.0623, 0.8513], - s: [1, 1, 1], - }, - { - t: [0.0144, 0.0671, -0.0735], - r: [0.1227, -0.0631, -0.0269, 0.9901], - s: [1, 1, 1], - }, - { - t: [0.0199, 0.0775, -0.1133], - r: [-0.4479, -0.0687, -0.0876, 0.8871], - s: [1, 1, 1], - }, - { - t: [0.0211, 0.0534, -0.1312], - r: [-0.6828, -0.0523, -0.1046, 0.7212], - s: [1, 1, 1], - }, - { - t: [0.0192, 0.0294, -0.1316], - r: [-0.6828, -0.0523, -0.1046, 0.7212], - s: [1, 1, 1], - }, - { - t: [-0.0167, 0.0074, -0.0424], - r: [0.491, -0.0372, -0.0778, 0.8669], - s: [1, 1, 1], - }, - { - t: [-0.0075, 0.0623, -0.0758], - r: [0.1717, -0.0904, 0.0273, 0.9806], - s: [1, 1, 1], - }, - { - t: [-0.0007, 0.0753, -0.1121], - r: [-0.3257, -0.1136, -0.0418, 0.9377], - s: [1, 1, 1], - }, - { - t: [0.005, 0.0561, -0.1361], - r: [-0.5492, -0.1111, -0.0905, 0.8233], - s: [1, 1, 1], - }, - { - t: [0.0066, 0.0356, -0.1433], - r: [-0.5492, -0.1111, -0.0905, 0.8233], - s: [1, 1, 1], - }, - { - t: [-0.0273, 0.0051, -0.0431], - r: [0.4566, 0.0629, -0.0766, 0.8841], - s: [1, 1, 1], - }, - { - t: [-0.0297, 0.0531, -0.0769], - r: [0.3942, -0.0035, 0.1163, 0.9116], - s: [1, 1, 1], - }, - { - t: [-0.0317, 0.0768, -0.1013], - r: [0.4582, 0.0006, 0.1099, 0.882], - s: [1, 1, 1], - }, - { - t: [-0.0341, 0.0951, -0.1136], - r: [0.4085, -0.0179, 0.0535, 0.911], - s: [1, 1, 1], - }, - { - t: [-0.0354, 0.1086, -0.1266], - r: [0.4085, -0.0179, 0.0535, 0.911], - s: [1, 1, 1], - }, -] as const; - -export const RIGHT_HAND_ROCK = [ - { - t: [0.0015, -0.0417, -0.0513], - r: [0.5617, 0.0123, 0.1355, 0.8161], - s: [1, 1, 1], - }, - { - t: [-0.0235, -0.025, -0.07], - r: [0.2818, 0.0046, 0.4006, 0.8718], - s: [1, 1, 1], - }, - { - t: [-0.0354, -0.0001, -0.1128], - r: [-0.0257, -0.2764, 0.6652, 0.6931], - s: [1, 1, 1], - }, - { - t: [-0.0238, 0.0089, -0.1359], - r: [-0.0006, -0.3419, 0.6556, 0.6733], - s: [1, 1, 1], - }, - { - t: [-0.0088, 0.0215, -0.1584], - r: [-0.0006, -0.3419, 0.6556, 0.6733], - s: [1, 1, 1], - }, - { - t: [-0.015, -0.0179, -0.0645], - r: [0.5302, 0.1299, 0.1154, 0.8299], - s: [1, 1, 1], - }, - { - t: [-0.0403, 0.0456, -0.0947], - r: [0.5874, 0.0115, 0.0813, 0.8051], - s: [1, 1, 1], - }, - { - t: [-0.0451, 0.0825, -0.1058], - r: [0.5048, 0.001, 0.0806, 0.8595], - s: [1, 1, 1], - }, - { - t: [-0.0468, 0.1015, -0.1165], - r: [0.4494, -0.0352, 0.0601, 0.8906], - s: [1, 1, 1], - }, - { - t: [-0.0465, 0.1195, -0.1308], - r: [0.4494, -0.0352, 0.0601, 0.8906], - s: [1, 1, 1], - }, - { - t: [-0.0029, -0.0139, -0.063], - r: [0.5567, 0.046, 0.0996, 0.8234], - s: [1, 1, 1], - }, - { - t: [-0.016, 0.0502, -0.0895], - r: [0.1657, -0.0189, 0.0053, 0.986], - s: [1, 1, 1], - }, - { - t: [-0.0146, 0.0642, -0.1285], - r: [-0.4455, 0.0104, 0.0258, 0.8948], - s: [1, 1, 1], - }, - { - t: [-0.0143, 0.0404, -0.1468], - r: [-0.7027, 0.0133, 0.0292, 0.7107], - s: [1, 1, 1], - }, - { - t: [-0.0137, 0.0163, -0.146], - r: [-0.7027, 0.0133, 0.0292, 0.7107], - s: [1, 1, 1], - }, - { - t: [0.0087, -0.0144, -0.0627], - r: [0.5389, -0.0411, 0.1061, 0.8346], - s: [1, 1, 1], - }, - { - t: [0.0058, 0.0446, -0.0897], - r: [0.2331, 0.0139, -0.0389, 0.9716], - s: [1, 1, 1], - }, - { - t: [0.0052, 0.0621, -0.1248], - r: [-0.3041, 0.0513, -0.0024, 0.9512], - s: [1, 1, 1], - }, - { - t: [0.0022, 0.0442, -0.1503], - r: [-0.5472, 0.0609, 0.0335, 0.8341], - s: [1, 1, 1], - }, - { - t: [0.0009, 0.0239, -0.1579], - r: [-0.5472, 0.0609, 0.0335, 0.8341], - s: [1, 1, 1], - }, - { - t: [0.0194, -0.0172, -0.0627], - r: [0.5054, -0.1365, 0.0899, 0.8473], - s: [1, 1, 1], - }, - { - t: [0.0276, 0.0346, -0.0893], - r: [0.4597, -0.0527, -0.1093, 0.8797], - s: [1, 1, 1], - }, - { - t: [0.0334, 0.0611, -0.1099], - r: [0.5162, -0.056, -0.0989, 0.8489], - s: [1, 1, 1], - }, - { - t: [0.0378, 0.0805, -0.1194], - r: [0.4448, -0.0407, -0.0462, 0.8935], - s: [1, 1, 1], - }, - { - t: [0.0411, 0.0949, -0.1311], - r: [0.4448, -0.0407, -0.0462, 0.8935], - s: [1, 1, 1], - }, -] as const; diff --git a/src/simulator/handPoses/ThumbsDownPoses.ts b/src/simulator/handPoses/ThumbsDownPoses.ts deleted file mode 100644 index 514e50ed..00000000 --- a/src/simulator/handPoses/ThumbsDownPoses.ts +++ /dev/null @@ -1,255 +0,0 @@ -export const LEFT_HAND_THUMBS_DOWN = [ - { - t: [-0.0169, 0.0317, -0.0845], - r: [0.2721, -0.3488, -0.6314, 0.6369], - s: [1, 1, 1], - }, - { - t: [-0.0019, 0.008, -0.1021], - r: [-0.0533, 0.5043, 0.7891, -0.3467], - s: [1, 1, 1], - }, - { - t: [0.0208, -0.0318, -0.1276], - r: [-0.2229, 0.6138, 0.7555, 0.0539], - s: [1, 1, 1], - }, - { - t: [0.0282, -0.0578, -0.1318], - r: [-0.2724, 0.6476, 0.7112, 0.0242], - s: [1, 1, 1], - }, - { - t: [0.0389, -0.0856, -0.1338], - r: [-0.2724, 0.6476, 0.7112, 0.0242], - s: [1, 1, 1], - }, - { - t: [0.0046, 0.0177, -0.0997], - r: [0.1919, -0.3993, -0.6438, 0.6238], - s: [1, 1, 1], - }, - { - t: [0.0618, -0.0034, -0.1463], - r: [-0.1884, 0.0883, -0.6795, 0.7035], - s: [1, 1, 1], - }, - { - t: [0.0481, -0.0093, -0.1821], - r: [0.6204, -0.5352, 0.4297, -0.3794], - s: [1, 1, 1], - }, - { - t: [0.0275, -0.0094, -0.1746], - r: [0.6806, -0.6532, 0.2814, -0.176], - s: [1, 1, 1], - }, - { - t: [0.0141, -0.0064, -0.1561], - r: [0.6806, -0.6532, 0.2814, -0.176], - s: [1, 1, 1], - }, - { - t: [0.0062, 0.0299, -0.1019], - r: [0.2399, -0.3631, -0.598, 0.6731], - s: [1, 1, 1], - }, - { - t: [0.0621, 0.0218, -0.1466], - r: [-0.241, 0.1225, -0.6156, 0.7403], - s: [1, 1, 1], - }, - { - t: [0.0427, 0.0133, -0.1823], - r: [0.7097, -0.4862, 0.373, -0.3475], - s: [1, 1, 1], - }, - { - t: [0.0165, 0.0095, -0.1681], - r: [0.7968, -0.5892, 0.1321, -0.0209], - s: [1, 1, 1], - }, - { - t: [0.0119, 0.0128, -0.1447], - r: [0.7968, -0.5892, 0.1321, -0.0209], - s: [1, 1, 1], - }, - { - t: [0.0033, 0.0406, -0.1037], - r: [0.2574, -0.3085, -0.5681, 0.7183], - s: [1, 1, 1], - }, - { - t: [0.052, 0.0419, -0.1485], - r: [-0.2306, 0.1278, -0.5499, 0.7925], - s: [1, 1, 1], - }, - { - t: [0.0339, 0.0328, -0.182], - r: [0.7575, -0.4754, 0.2861, -0.344], - s: [1, 1, 1], - }, - { - t: [0.0099, 0.025, -0.1634], - r: [0.843, -0.5293, 0.0926, -0.0248], - s: [1, 1, 1], - }, - { - t: [0.0068, 0.0266, -0.142], - r: [0.843, -0.5293, 0.0926, -0.0248], - s: [1, 1, 1], - }, - { - t: [-0.0018, 0.0508, -0.104], - r: [0.2798, -0.2351, -0.5355, 0.7614], - s: [1, 1, 1], - }, - { - t: [0.0378, 0.0613, -0.1483], - r: [-0.1652, 0.0952, -0.5046, 0.842], - s: [1, 1, 1], - }, - { - t: [0.0259, 0.054, -0.1792], - r: [0.7429, -0.4404, 0.2677, -0.4273], - s: [1, 1, 1], - }, - { - t: [0.0084, 0.0449, -0.169], - r: [0.8704, -0.4542, 0.1121, -0.1532], - s: [1, 1, 1], - }, - { - t: [0.002, 0.0431, -0.1514], - r: [0.8704, -0.4542, 0.1121, -0.1532], - s: [1, 1, 1], - }, -] as const; - -export const RIGHT_HAND_THUMBS_DOWN = [ - { - t: [0.0237, 0.033, -0.083], - r: [0.325, 0.2979, 0.5612, 0.7004], - s: [1, 1, 1], - }, - { - t: [0.0039, 0.0142, -0.1018], - r: [0.0744, 0.4501, 0.7672, 0.4508], - s: [1, 1, 1], - }, - { - t: [-0.0239, -0.0191, -0.133], - r: [0.2089, 0.5732, 0.7915, 0.0363], - s: [1, 1, 1], - }, - { - t: [-0.0341, -0.0435, -0.1401], - r: [0.2664, 0.6251, 0.7316, 0.0555], - s: [1, 1, 1], - }, - { - t: [-0.0476, -0.0698, -0.144], - r: [0.2664, 0.6251, 0.7316, 0.0555], - s: [1, 1, 1], - }, - { - t: [-0.0003, 0.0251, -0.0989], - r: [0.2488, 0.3591, 0.5717, 0.6944], - s: [1, 1, 1], - }, - { - t: [-0.0603, 0.0201, -0.1463], - r: [-0.2217, -0.1036, 0.5936, 0.7667], - s: [1, 1, 1], - }, - { - t: [-0.045, 0.0116, -0.1809], - r: [0.681, 0.4806, -0.3657, -0.4143], - s: [1, 1, 1], - }, - { - t: [-0.0253, 0.0071, -0.1724], - r: [0.7487, 0.5817, -0.2444, -0.2032], - s: [1, 1, 1], - }, - { - t: [-0.0121, 0.0068, -0.1535], - r: [0.7487, 0.5817, -0.2444, -0.2032], - s: [1, 1, 1], - }, - { - t: [0.001, 0.0374, -0.1005], - r: [0.2971, 0.3158, 0.527, 0.7309], - s: [1, 1, 1], - }, - { - t: [-0.0548, 0.0447, -0.1454], - r: [-0.2475, -0.1117, 0.5236, 0.8076], - s: [1, 1, 1], - }, - { - t: [-0.0369, 0.0331, -0.181], - r: [0.759, 0.413, -0.3155, -0.3922], - s: [1, 1, 1], - }, - { - t: [-0.0126, 0.0231, -0.1665], - r: [0.8595, 0.4988, -0.1065, -0.0339], - s: [1, 1, 1], - }, - { - t: [-0.0084, 0.0248, -0.1428], - r: [0.8595, 0.4988, -0.1065, -0.0339], - s: [1, 1, 1], - }, - { - t: [0.0064, 0.0472, -0.1018], - r: [0.3122, 0.2567, 0.4998, 0.766], - s: [1, 1, 1], - }, - { - t: [-0.0402, 0.0619, -0.1463], - r: [-0.22, -0.1072, 0.4537, 0.8569], - s: [1, 1, 1], - }, - { - t: [-0.025, 0.0506, -0.1806], - r: [0.8003, 0.3914, -0.2353, -0.3886], - s: [1, 1, 1], - }, - { - t: [-0.0035, 0.0369, -0.1624], - r: [0.8979, 0.4322, -0.0728, -0.0395], - s: [1, 1, 1], - }, - { - t: [-0.0008, 0.0373, -0.1409], - r: [0.8979, 0.4322, -0.0728, -0.0395], - s: [1, 1, 1], - }, - { - t: [0.0136, 0.0558, -0.1017], - r: [0.3278, 0.1772, 0.4672, 0.8018], - s: [1, 1, 1], - }, - { - t: [-0.0219, 0.0775, -0.1452], - r: [-0.1811, -0.0932, 0.4016, 0.8929], - s: [1, 1, 1], - }, - { - t: [-0.0108, 0.0677, -0.1758], - r: [0.7842, 0.3582, -0.2073, -0.4623], - s: [1, 1, 1], - }, - { - t: [0.004, 0.0547, -0.1656], - r: [0.9158, 0.3542, -0.0821, -0.1706], - s: [1, 1, 1], - }, - { - t: [0.0096, 0.0511, -0.1481], - r: [0.9158, 0.3542, -0.0821, -0.1706], - s: [1, 1, 1], - }, -] as const; diff --git a/src/simulator/handPoses/ThumbsUpPoses.ts b/src/simulator/handPoses/ThumbsUpPoses.ts deleted file mode 100644 index f81a0e66..00000000 --- a/src/simulator/handPoses/ThumbsUpPoses.ts +++ /dev/null @@ -1,55 +0,0 @@ -export const LEFT_HAND_THUMBS_UP = [ - {t: [-0.011, -0.0299, -0.0701], r: [0.1224, -0.1562, 0.6052, 0.771]}, - {t: [0.0025, -0.0017, -0.0854], r: [0.3796, -0.3776, 0.3843, 0.7521]}, - {t: [0.0162, 0.041, -0.1065], r: [0.6152, -0.1749, 0.0935, 0.763]}, - {t: [0.0204, 0.0676, -0.1116], r: [0.5992, -0.1247, 0.1335, 0.7795]}, - {t: [0.0225, 0.096, -0.1202], r: [0.5992, -0.1247, 0.1335, 0.7795]}, - {t: [-0.0042, -0.008, -0.0928], r: [0.1427, -0.2467, 0.6763, 0.6793]}, - {t: [0.0063, 0.0312, -0.155], r: [-0.4551, -0.5645, 0.3425, 0.5974]}, - {t: [0.0447, 0.0257, -0.1538], r: [0.7509, 0.6277, 0.1981, -0.053]}, - {t: [0.0396, 0.0184, -0.1338], r: [0.7246, 0.5124, 0.4244, 0.1797]}, - {t: [0.0207, 0.0148, -0.1212], r: [0.7246, 0.5124, 0.4244, 0.1797]}, - {t: [-0.0078, -0.0192, -0.0982], r: [0.109, -0.1737, 0.6698, 0.7137]}, - {t: [-0.0006, 0.0083, -0.163], r: [-0.4929, -0.5301, 0.4215, 0.5462]}, - {t: [0.0407, 0.0046, -0.1614], r: [0.705, 0.703, 0.0897, -0.0263]}, - {t: [0.0382, -0.0005, -0.132], r: [0.6279, 0.5816, 0.4074, 0.3186]}, - {t: [0.0165, -0.0021, -0.1217], r: [0.6279, 0.5816, 0.4074, 0.3186]}, - {t: [-0.0092, -0.031, -0.0993], r: [0.0472, -0.1416, 0.6514, 0.7439]}, - {t: [0.0006, -0.0142, -0.1626], r: [-0.5202, -0.4929, 0.4819, 0.5042]}, - {t: [0.0398, -0.0159, -0.1611], r: [0.6996, 0.7076, 0.0706, 0.0696]}, - {t: [0.0338, -0.0161, -0.1304], r: [0.5876, 0.6289, 0.3607, 0.3593]}, - {t: [0.0143, -0.0168, -0.1208], r: [0.5876, 0.6289, 0.3607, 0.3593]}, - {t: [-0.0081, -0.0426, -0.0982], r: [-0.0269, -0.0934, 0.6476, 0.7558]}, - {t: [0.0026, -0.0377, -0.1578], r: [0.5435, 0.4612, -0.5243, -0.4658]}, - {t: [0.0366, -0.0376, -0.1559], r: [0.6991, 0.7017, 0.0384, 0.1318]}, - {t: [0.032, -0.0347, -0.1344], r: [0.575, 0.6796, 0.2522, 0.3795]}, - {t: [0.0166, -0.0342, -0.1237], r: [0.575, 0.6796, 0.2522, 0.3795]}, -] as const; - -export const RIGHT_HAND_THUMBS_UP = [ - {t: [0.0317, -0.0212, -0.089], r: [0.2199, 0.1003, -0.594, 0.7673]}, - {t: [0.0223, 0.009, -0.1042], r: [0.4294, 0.285, -0.3619, 0.7768]}, - {t: [0.0158, 0.0521, -0.1273], r: [0.6012, 0.067, -0.0513, 0.7947]}, - {t: [0.0145, 0.0784, -0.1348], r: [0.597, 0.0134, -0.0918, 0.7968]}, - {t: [0.0163, 0.1065, -0.1446], r: [0.597, 0.0134, -0.0918, 0.7968]}, - {t: [0.0303, 0.0032, -0.1103], r: [0.2434, 0.2002, -0.656, 0.6858]}, - {t: [0.0337, 0.0475, -0.1698], r: [-0.3298, 0.4729, -0.4297, 0.6949]}, - {t: [-0.0026, 0.0462, -0.1835], r: [0.7134, -0.6368, -0.0002, -0.2925]}, - {t: [-0.0107, 0.0369, -0.1654], r: [0.7745, -0.5891, -0.2133, -0.0877]}, - {t: [-0.0047, 0.0282, -0.145], r: [0.7745, -0.5891, -0.2133, -0.0877]}, - {t: [0.0347, -0.0077, -0.1158], r: [0.2088, 0.1254, -0.6589, 0.7117]}, - {t: [0.0416, 0.0251, -0.1782], r: [-0.3597, 0.4829, -0.4746, 0.6421]}, - {t: [0.0018, 0.0251, -0.19], r: [-0.673, 0.7069, -0.0014, 0.2177]}, - {t: [-0.0077, 0.0162, -0.163], r: [0.6957, -0.6456, -0.2988, 0.0994]}, - {t: [0.0063, 0.0104, -0.1443], r: [0.6957, -0.6456, -0.2988, 0.0994]}, - {t: [0.0361, -0.0196, -0.1178], r: [0.1467, 0.0923, -0.6537, 0.7367]}, - {t: [0.0398, 0.0027, -0.1801], r: [-0.3611, 0.446, -0.5466, 0.6099]}, - {t: [0.0028, 0.0047, -0.193], r: [-0.6782, 0.7246, -0.0014, 0.1226]}, - {t: [-0.003, -0.0006, -0.1628], r: [-0.652, 0.6801, 0.2937, -0.1613]}, - {t: [0.0108, -0.0046, -0.1465], r: [-0.652, 0.6801, 0.2937, -0.1613]}, - {t: [0.0343, -0.0315, -0.1182], r: [0.0757, 0.0463, -0.6692, 0.7378]}, - {t: [0.0363, -0.021, -0.1779], r: [-0.3141, 0.3981, -0.6168, 0.602]}, - {t: [0.0062, -0.0166, -0.1931], r: [-0.6691, 0.7354, -0.0331, 0.1021]}, - {t: [0.0012, -0.0185, -0.1716], r: [-0.6175, 0.7316, 0.235, -0.168]}, - {t: [0.0116, -0.0223, -0.1564], r: [-0.6175, 0.7316, 0.235, -0.168]}, -] as const; diff --git a/src/simulator/handPoses/VictoryHandPoses.ts b/src/simulator/handPoses/VictoryHandPoses.ts deleted file mode 100644 index acdc7cc4..00000000 --- a/src/simulator/handPoses/VictoryHandPoses.ts +++ /dev/null @@ -1,255 +0,0 @@ -export const LEFT_HAND_VICTORY = [ - { - t: [-0.0485, -0.0629, -0.0748], - r: [0.5235, 0.0269, -0.0122, 0.8515], - s: [1, 1, 1], - }, - { - t: [-0.0274, -0.0424, -0.0935], - r: [0.2683, -0.0091, -0.2476, 0.9309], - s: [1, 1, 1], - }, - { - t: [-0.0197, -0.0171, -0.1372], - r: [-0.0874, 0.2587, -0.5403, 0.7959], - s: [1, 1, 1], - }, - { - t: [-0.0337, -0.0134, -0.1604], - r: [-0.1021, 0.3471, -0.5231, 0.7717], - s: [1, 1, 1], - }, - { - t: [-0.0538, -0.0084, -0.1819], - r: [-0.1021, 0.3471, -0.5231, 0.7717], - s: [1, 1, 1], - }, - { - t: [-0.0376, -0.037, -0.0897], - r: [0.5048, -0.107, 0.0348, 0.8559], - s: [1, 1, 1], - }, - { - t: [-0.0266, 0.0281, -0.1246], - r: [0.567, -0.0696, 0.0098, 0.8207], - s: [1, 1, 1], - }, - { - t: [-0.0224, 0.0646, -0.1371], - r: [0.5031, -0.0677, 0.0059, 0.8615], - s: [1, 1, 1], - }, - { - t: [-0.0201, 0.0836, -0.1477], - r: [0.4589, -0.0365, 0.0223, 0.8874], - s: [1, 1, 1], - }, - { - t: [-0.019, 0.1018, -0.1617], - r: [0.4589, -0.0365, 0.0223, 0.8874], - s: [1, 1, 1], - }, - { - t: [-0.0503, -0.0361, -0.0891], - r: [0.5225, -0.0136, 0.0382, 0.8517], - s: [1, 1, 1], - }, - { - t: [-0.0515, 0.0267, -0.1211], - r: [0.5428, 0.1035, 0.1149, 0.8255], - s: [1, 1, 1], - }, - { - t: [-0.0638, 0.0631, -0.1369], - r: [0.5306, 0.067, 0.0906, 0.8401], - s: [1, 1, 1], - }, - { - t: [-0.0702, 0.0896, -0.1495], - r: [0.5467, 0.0608, 0.081, 0.8312], - s: [1, 1, 1], - }, - { - t: [-0.0747, 0.1108, -0.1601], - r: [0.5467, 0.0608, 0.081, 0.8312], - s: [1, 1, 1], - }, - { - t: [-0.0613, -0.0396, -0.0891], - r: [0.4925, 0.0763, 0.0204, 0.8667], - s: [1, 1, 1], - }, - { - t: [-0.0712, 0.0158, -0.1219], - r: [0.2546, -0.0246, 0.1592, 0.9535], - s: [1, 1, 1], - }, - { - t: [-0.0722, 0.0349, -0.1561], - r: [-0.2354, -0.1181, 0.1042, 0.959], - s: [1, 1, 1], - }, - { - t: [-0.0638, 0.0217, -0.1832], - r: [-0.4573, -0.1496, 0.0503, 0.8752], - s: [1, 1, 1], - }, - { - t: [-0.0571, 0.0041, -0.1941], - r: [-0.4573, -0.1496, 0.0503, 0.8752], - s: [1, 1, 1], - }, - { - t: [-0.0706, -0.045, -0.0892], - r: [0.4433, 0.1733, 0.0233, 0.8791], - s: [1, 1, 1], - }, - { - t: [-0.0898, 0.0006, -0.1216], - r: [0.0458, -0.1976, 0.107, 0.9733], - s: [1, 1, 1], - }, - { - t: [-0.0762, 0.0038, -0.1526], - r: [-0.348, -0.2273, 0.0117, 0.9095], - s: [1, 1, 1], - }, - { - t: [-0.0668, -0.0095, -0.1675], - r: [-0.5475, -0.2656, -0.0806, 0.7894], - s: [1, 1, 1], - }, - { - t: [-0.0618, -0.0269, -0.1725], - r: [-0.5475, -0.2656, -0.0806, 0.7894], - s: [1, 1, 1], - }, -] as const; - -export const RIGHT_HAND_VICTORY = [ - { - t: [-0.0017, -0.0652, -0.0663], - r: [0.5651, 0.0392, -0.0573, 0.8221], - s: [1, 1, 1], - }, - { - t: [-0.0247, -0.042, -0.0786], - r: [0.3207, 0.0849, 0.243, 0.9115], - s: [1, 1, 1], - }, - { - t: [-0.0407, -0.0141, -0.1186], - r: [-0.0285, -0.1953, 0.5625, 0.8029], - s: [1, 1, 1], - }, - { - t: [-0.031, -0.0094, -0.1439], - r: [-0.0751, -0.3079, 0.5331, 0.7845], - s: [1, 1, 1], - }, - { - t: [-0.0133, -0.0043, -0.1673], - r: [-0.0751, -0.3079, 0.5331, 0.7845], - s: [1, 1, 1], - }, - { - t: [-0.0136, -0.0376, -0.076], - r: [0.5464, 0.1682, -0.0848, 0.8161], - s: [1, 1, 1], - }, - { - t: [-0.0272, 0.0313, -0.1019], - r: [0.6129, 0.1411, -0.0752, 0.7738], - s: [1, 1, 1], - }, - { - t: [-0.032, 0.0692, -0.1089], - r: [0.5643, 0.143, -0.0679, 0.8103], - s: [1, 1, 1], - }, - { - t: [-0.0353, 0.0897, -0.1161], - r: [0.5256, 0.1162, -0.0834, 0.8386], - s: [1, 1, 1], - }, - { - t: [-0.038, 0.11, -0.1265], - r: [0.5256, 0.1162, -0.0834, 0.8386], - s: [1, 1, 1], - }, - { - t: [-0.0009, -0.0372, -0.0776], - r: [0.5593, 0.0765, -0.0968, 0.8197], - s: [1, 1, 1], - }, - { - t: [-0.0021, 0.0287, -0.1033], - r: [0.6072, -0.0412, -0.1868, 0.7712], - s: [1, 1, 1], - }, - { - t: [0.01, 0.0671, -0.1136], - r: [0.5687, 0.0002, -0.1587, 0.8071], - s: [1, 1, 1], - }, - { - t: [0.0156, 0.0946, -0.124], - r: [0.5609, 0.0092, -0.1498, 0.8142], - s: [1, 1, 1], - }, - { - t: [0.019, 0.1163, -0.1339], - r: [0.5609, 0.0092, -0.1498, 0.8142], - s: [1, 1, 1], - }, - { - t: [0.0096, -0.0411, -0.08], - r: [0.5291, -0.0092, -0.0837, 0.8443], - s: [1, 1, 1], - }, - { - t: [0.0165, 0.0173, -0.1087], - r: [0.2191, 0.1389, -0.1874, 0.9474], - s: [1, 1, 1], - }, - { - t: [0.009, 0.0353, -0.1427], - r: [-0.3548, 0.2386, -0.0503, 0.9026], - s: [1, 1, 1], - }, - { - t: [-0.0055, 0.0162, -0.1628], - r: [-0.5898, 0.2546, 0.0402, 0.7653], - s: [1, 1, 1], - }, - { - t: [-0.0126, -0.0042, -0.1657], - r: [-0.5898, 0.2546, 0.0402, 0.7653], - s: [1, 1, 1], - }, - { - t: [0.0184, -0.0469, -0.0826], - r: [0.4806, -0.0996, -0.0936, 0.8662], - s: [1, 1, 1], - }, - { - t: [0.034, 0.0014, -0.1134], - r: [0.079, 0.2891, -0.1225, 0.9461], - s: [1, 1, 1], - }, - { - t: [0.0152, 0.0077, -0.141], - r: [-0.2784, 0.3171, 0.0012, 0.9066], - s: [1, 1, 1], - }, - { - t: [0.0023, -0.0029, -0.1556], - r: [-0.458, 0.3482, 0.1094, 0.8106], - s: [1, 1, 1], - }, - { - t: [-0.0053, -0.0187, -0.1623], - r: [-0.458, 0.3482, 0.1094, 0.8106], - s: [1, 1, 1], - }, -] as const; diff --git a/src/xrblocks.ts b/src/xrblocks.ts index b90211ff..89a3ff86 100644 --- a/src/xrblocks.ts +++ b/src/xrblocks.ts @@ -50,6 +50,7 @@ export * from './simulator/controlModes/SimulatorControlMode'; export * from './simulator/events/SimulatorEvents'; export * from './simulator/handPoses/HandPoseFK'; export * from './simulator/handPoses/HandPoseJoints'; +export * from './simulator/handPoses/HandPoseRotations'; export * from './simulator/handPoses/HandPoses'; export * from './simulator/Simulator'; export * from './simulator/SimulatorCamera';