Playback slanted engine onFrame is code skip / ignore

I am developing a custom gesture maker application for Leap in Java. In the function code, the onFrame is executed to the point and the rest of the code is skipped.

Code for onFrame is below:

public void onFrame(Controller controller) {
    Frame frame = controller.frame();
    if (recordableFrame(frame, minRecordingVelocity)){

        /*
         * If this is the first frame in a gesture, we clean up some running         values
         */
        if (!recording) { 
            recording = true; 
            frameCount = 0;
        }

        frameCount++;
        System.out.println("in frame... " + Integer.toString(frameCount));
        recordFrame(frame);
        System.out.println("Recording Frame...");
    }    
}

      

Everything works fine until recordFrame (frame) function is called. This function and any code in onFrame after this function are ignored / not executed. Instead of skipping frames, I seem to be skipping code.

Code for recordFrame is below:

/**
 * This function is called for each frame during gesture recording, 
 * and it is responsible for adding values in frames using the provided 
 * recordPoint function (which accepts a Vector).
 */
public void recordFrame(Frame frame) {
    HandList hands = frame.hands();
    int handCount = hands.count();

    Hand hand; 
    Finger finger; 
    FingerList fingers; 
    int fingerCount;

    int l = handCount;
    for (int i = 0; i < l; i++) {   //for each hand in the frame
        hand = hands.get(i);

        recordPoint(hand.stabilizedPalmPosition()); //record the palm position

        fingers = hand.fingers();
        fingerCount = fingers.count();

        int k = fingerCount;
        for (int j = 0; j < k; j++) {  //for each finger in the hand
            finger = fingers.get(j);
            recordPoint(finger.stabilizedTipPosition();//record fingertip position.
        }
    }
    System.out.println("Recording Frame...");
}

      

+3


source to share


1 answer


From the Leap Motion forum:

"I found a problem. In the gesture class, I declare an ArrayList, but I never initialize it with = new ArrayList (); (strange that it didn't throw a compiler error)



Once I did that, everything worked fine. Now it works and works for me. "

https://community.leapmotion.com/t/listener-onframe-is-skipping-code/3108/7

+1


source







All Articles