KP to Hand Rotations - #384
Conversation
|
Follow https://google.github.io/styleguide/tsguide.html#method-and-function-comments Suggest to Adherence to Coding Guidelines :) The project rules require comments to use third-person verbs and end with periods. Some comments in this PR use imperative verbs or omit ending periods. In HandPoseFK.ts: In HandPoseIK.test.ts: |
| const computedRotations: SimulatorHandPoseRotations = {}; | ||
| const finalRotations = new Map<JointName, THREE.Quaternion>(); | ||
|
|
||
| // Helper to build palm basis |
There was a problem hiding this comment.
| const temp = new THREE.Vector3() | ||
| .subVectors(indexMcpPos, wristPos) | ||
| .normalize(); | ||
| const zAxis = new THREE.Vector3().crossVectors(yAxis, temp).normalize(); |
There was a problem hiding this comment.
In normal scenarios, these points are non-collinear and non-coincident. However, if the keypoints are corrupted or contain degenerate values (all zeros), the cross product will be [0, 0, 0], leading to a singular basis matrix. When passed to THREE.Quaternion.setFromRotationMatrix(matrix), this can result in NaN quaternion coordinates.
Added an additional function to convert keypoints into hand angle rotations. should enable some gesture recording and stuff into the simulator. Test file shows forward backward kinematics.