Skip to content

How to save/recall a gesture for later use #2

@bridgewaterrobbie

Description

@bridgewaterrobbie

Hey sorry to bother you again, we have been trying to get up and running but running into a few issues that we think you might be able to solve quickly. We tried looking through signadventure, but havent had much luck there since it seems you use a different process, and we were unable to find the methods you used to initially create the gestures.

We are trying to create a gesture, then save it for later use with .toJSON, restoring it with .fromJSON. In sign adventure, you seem to use a .byte file to recall old gestures, but we can't figure out the path you took to load them from the excercise prefab into LeapClassifier, nor how to create a new byte file.

Also we have one very strange thing happen as we call toJson. Despite checking that the Gestures dictionary does contain the key with "this.gestures.ContainsKey(gestureName)", the code crashes immediately after with the line "var gestures = this.gestures[gestureName];" with a

KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic.List`1[System.Collections.Generic.List`1[Point]]].get_Item (System.String key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
LeapTrainer.toJSON (System.String gestureName) (at Assets/LeapClasifier/LeapTrainer.cs:893)
ThomasLeapTrainer.FixedUpdate () (at Assets/Scripts/ThomasLeapTrainer.cs:30)

We also have not managed to get a gesture to be recognized after creating it. Our code looks like this:

    void Update () {
        if (Input.GetButtonDown("Fire3") && trainer != null)
        {
            startTraining();
        }


        trainer.OnGestureRecognized += (name, value, allHits) => {
            Debug.Log("Gesture recognized");
        };



    }

    void startTraining()
    {
        if (trainer == null || isTraining) return;

        isTraining = true;
        Debug.Log("Button Pressed");

        trainer.Create("TestGest", false);
        Debug.Log("Gesture Created");
    }
}

Again, sorry for the bother and we appreciate any feedback/solutions you have time to give.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions