Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Add support for input and gestures for hand controllers #552

Merged
merged 314 commits into from
Sep 22, 2020

Conversation

FejZa
Copy link
Contributor

@FejZa FejZa commented Apr 28, 2020

XRTK - Mixed Reality Toolkit Change Request

Overview

This pull request is the next iteration on the hand tracking feature, making it actually useful. It implements a lot of refactoring to improve the overall architecture and data flow based on recent learnings.

Data Flow / New Platforms

All hand data that platform APIs provide is now being processed in the respective hand data converter. Introduced BaseHandDataConverter which contains base and fallback conversion logic for hands, e.g. it will provide a pointer pose if the platform did not provide it. The essential piece of data for hands is now HandData more than ever, which the converters generate. So for each platform there is a PlatformHandControllerDataProvider + PlatformHandDataConverter pair taking care of preparing data for the agnostic hand controller.

So for a new hand platform "all" that needs to be done is implementing the data provider and if applicable the converter.

Reduced simulation specifics

The only specifics SimulatedMixedRealityHandController now has are the default interaction mappings it needs for the simulated hand to be controlled in editor. It now directly derives from MixedRealityHandController. BaseHandController got removed since MixedRealityHandController essentially is the base for any hand. I'll look into ways to get rid of SimulatedMixedRealityHandController completely in a next iteration of hands.

Near / Far Interaction

Near and far interaction using hands is now supported using

  • Pinching gesture (far)
  • Poke / Touch gesture (near)

Also added new APIs for

  • Pinch strength
  • Grab strength

Physics

The HandPhysicsEnabled setting can now be changed at runtime to enable or disable the physics components for hands using the new setter for IMixedRealityHandControllerDataProvider.HandPhysicsEnabled. This can be used to e.g. temporarily enable physics interactions and then disable them again. Also physics is now disabled by default.

The IMixedRealityHandControllerDataProvider.BoundsMode and IMixedRealityHandControllerDataProvider.UseTriggers settings are now runtime settable as well.

Tracked Poses

All hand profiles now have a new setting "Tracked Poses". These are for one the poses that are available for hand simulation and secondly these are the poses that are being tracked/recognized by the hands system. This is a work in progress feature that will enable user's to define their custom poses they recorded and have input actions raised when those poses are recognized. For now it drives simulation only. Of course each platform may override the global setting here.

tracked_poses

Rendering Mode

The former "Hand Meshing Enabled" setting in hand profiles got replaced by a rendering mode setting. The setting defaults to Joints, other options are None for when you just want "Ghost Hands" and Mesh for hand mesh visualization. If the platform does not provide hand mesh data Mesh will fallback to Joints. Of course each platform may override the global setting here.

rendering_mode

Submodule Changes

@FejZa FejZa added the In Progress PR currently still being developed label Apr 28, 2020
@StephenHodgson StephenHodgson mentioned this pull request Apr 28, 2020
36 tasks
@@ -11,7 +11,7 @@
"dependencies": {
"com.unity.package-manager-ui": "2.1.2",
"com.unity.textmeshpro": "2.0.1",
"com.unity.xr.legacyinputhelpers": "2.0.8",
"com.unity.xr.legacyinputhelpers": "2.1.3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We sure we want to do this?

Last time I updated this package we had some errors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StephenHodgson do you remember what happened? What the errors were, so I can verify.

StephenHodgson and others added 20 commits May 4, 2020 16:44
…feature/hand-input-and-poses

# Conflicts:
#	Submodules/Lumin
#	Submodules/Oculus
#	Submodules/SDK
#	Submodules/WindowsMixedReality
…github.com/XRTK/XRTK-Core into feature/hand-input-and-poses

# Conflicts:
#	Submodules/SDK
…github.com/XRTK/XRTK-Core into feature/hand-input-and-poses

# Conflicts:
#	Submodules/Lumin
#	Submodules/SDK
* Update ColliderExtensions.cs

* Update CollisionExtensions.cs
@SimonDarksideJ
Copy link
Contributor

(minor) Cannot grab both dumbbells in both hands. Only one hand works

Replication Steps:

  1. Far point at a single dumbbell and perform grab gesture
  2. Observe Dumbbell in hand, tracked
  3. Far point at the remaining dumbbell with the other hand
  4. Perform the Grab gesture
  5. No Grab action happens

Expected Behaviour:
Should be able to hold both Dumbbells, one in each hand

@SimonDarksideJ
Copy link
Contributor

SimonDarksideJ commented Jun 18, 2020

(minor) Table material makes hands not very visible (both are mostly white)

Ideally, the table should be a darker colour material to improve the visibility of hands

image

@SimonDarksideJ
Copy link
Contributor

Tested the new updates, absolutely loving the redesigned stations, it's a lot more fluid.
Almost all issues resolved, only remaining bug is that buttons can't be pressed by hand (near interaction), only by far pointers.

A side note, is it would be nice if the inner part of the button was out more, so the press is visibly more present. (big squishy buttons)
Sound ok @FejZa , tested on Quest (link) and on device, all good. Just waiting for the ok on WMR and Lumin

Copy link
Contributor

@SimonDarksideJ SimonDarksideJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing complete. Any lingering issues shoudl be solved in additional PR's

@FejZa FejZa merged commit 24a757e into development Sep 22, 2020
@FejZa FejZa deleted the feature/hand-input-and-poses branch September 22, 2020 12:16
XRTK-Build-Bot pushed a commit that referenced this pull request Dec 25, 2020
* Delete baked lighting settings for base

* Fix ControllerPopupWindow NRE

* Implement internal is grabbing update

* Disable hand meshing by default and assign tracked poses to test profile

* Add IsValidCollision extension to colliders

* Feature/pni change requests (#577)

* Update ColliderExtensions.cs

* Update CollisionExtensions.cs

* updated submodules

* updated sdk

* updated sdk

* Cleanup namespace

* Better fallback pointer pose calculation

* Introduce hand rendering mode

* Implement runtime rendering mode switch

* Update submodules

* Start new hands examples room

* Add canvas UI and 3D Buttons station

* Show button stations result

* Implement set rendering mode station

* Added more stations

* Update submodules

* updated wmr checkout

* updated sdk

* Update submodules

* Add additive scene loader for hands demo scene

* Restore base scene

* Add simple physics demo station

* Cleanup namespace

* Cleanup hand examples a bit

* Update stations

* Implement runtime bounds mode selection

* Update submodules

* Update Ultraleap checkout

* Update physics station

* Update submodule

* Update submodule

* Fix UWP certficate error

* Moved examples to examples repo

* reset editor window options for hands

* Implement pinch strength

* Add pinch strength to hand controller interface

* Update submoduules

* Update SDK

* Use array instead of list for tracked poses

* Restructure pose recognition code

* Improved variable naming

* Add root pose to hand data

* Set root pose for simulation

* Fix joint rotations

* Update SDK

* Remove base converter and introduce Post Processor

* Update data provider to use post processor

* Optimize recognition

* Introduce grip strength

* Enable setters for post processor

* Minor refactoring in post processor

* Removed NONE joint

* Rename joints

* Update submodules

* Extend default hand mappings

* Sync simulation profiles

* Reset popup window options for hands

* Hand input and poses change request (#616)

* Cleaned up RecordedHandJoint(s) to remove reference values

removed null unity object lifetime bypass
added better exceptions when starting simulated hand controller data provider and Simulated hand data converter

* fixed missing line

* updated sdk checkout

* Implement grip pose

* Adjust processor to joint enum renamings

* updated sdk checkout

* Introduce hand finger enum

* Rename pose recognizer and implement frame throttle

* Minor docs update

* Implement finger curls

* Add Oculus (Desktop) package back in for now

* Disable debug log for grip calculations

* updated tracked pose processor compare (#617)

aesthetic and spell checking in hand controller

Co-authored-by: Dino Fejzagic <dino.f@live.de>

* Implement IMixedRealityHandController.TryGetFingerCurlStrength

* Update SDK

* Disable recognition for now

* Add index curl constraint to isgripping detection

* updated sdk checkout

* updated SDK

* updated sdk checkout

* Implement recorded pose baking and update inspector

* Update SDK

* Remove handedness from hand data

* Update Oculus

* Fix baked data not persisted

* Update SDK

* Fix pose recognizer handedness issue

* Improve pose processor

* Fix IsPointing set to false when pinching

* Update submodules

* Update examples checkout

* Do not pass tracked pose scriptable object outside of data provider

* Update examples

* Update examples

* Fix potential NRE

Co-authored-by: Stephen Hodgson <hodgson.designs@gmail.com>

* Fix potential casting error

Co-authored-by: Stephen Hodgson <hodgson.designs@gmail.com>

* Fix formatting

* Use for instead of foreach

* Revert metro package version

* Rename HandControllerPoseDefinition to HandControllerPoseProfile

* Revert to ReordableList for tracked poses

* Change HandData to be a struct

* Update submodule

* Update example module

* Fix invalid simulated hand position when camera rotation is changed

* Fix generic pointer pose invalid when camera rotated

* Remove redundant properties in hand mesh data

* Update submodules

* Only update hand state if hand is tracked

* Remove obsolete pose extensions

* Introduce hand utilities for pose estimation

* Update submodules

* Implement TryGetHandMeshData

* Remove HandData input event

* Update submodule

* Update submodules

* Implement relativeTo paramter for TryGetJointPose

* Fix IsPointing

* Use TrackingState instead of bool for tracking state

* Fix missed occurence of IsTracked

* Update Oculus

* Fix pointer pose

* Update Oculus

* Fix fallback pointer pose

* Fix pose recognizer left/right issue

* Update submodules

* Remove tracked pose mapping (coming back later)

* Fix hand velocity calculation

* Fix local to world joint translation

* Fix simulation mappings

* Fix IsPointing after teleport

* Update submodule

* Fix simulated hand not reset on tracking loss

* Fix simulated hand position after teleport

* Update SDK

* Update SDK

* Update examples module

* fixed some typos

* updated oculus checkout

* Update example checkout

* Reset hand controller options window

* Update submodules

* fixed submodule checkouts

* Remove tracked poses from hand data provider interface

* Cache bounds arrays

* Allow a bit more tolerance wit IsPointing

* Update submodules

* Update example

* Update modules

* Update submodules

* Update oculus

* Update WMR

* Clean up gizmo meshes

* Remove duplicate vertices in gizmo meshes

* Update submodules and wmr package

* Only apply default head height if not managed by device

* Update submodules

* Introduce IHandDataPostProcessor

* Update submodules

* Update WMR submodule

Co-authored-by: Stephen Hodgson <hodgson.designs@gmail.com>
Co-authored-by: Simon (Darkside) Jackson <darkside@zenithmoon.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Breaking Change Enhancement New feature or request Ready for review PR finished primary development, open for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants