Leap motion library - tool tracking not working?

edited December 2014 in Library Questions

Hi, I am using this leap motion library https://github.com/voidplus/leap-motion-processing

I tested with example provided in the library, everything works well, but it does not track tools.

I tried many different objects like pen, straw, chopstick, brush and such, but no data from it.

Does anyone have similar trouble with me?

This is the code.

import de.voidplus.leapmotion.*;

LeapMotion leap;

void setup(){ size(800, 500, OPENGL); background(255); // ...

leap = new LeapMotion(this); }

void draw(){ background(255); // ... int fps = leap.getFrameRate();

// ========= HANDS =========

for(Hand hand : leap.getHands()) {

// ----- BASICS -----

int     hand_id          = hand.getId();
PVector hand_position    = hand.getPosition();
PVector hand_stabilized  = hand.getStabilizedPosition();
PVector hand_direction   = hand.getDirection();
PVector hand_dynamics    = hand.getDynamics();
float   hand_roll        = hand.getRoll();
float   hand_pitch       = hand.getPitch();
float   hand_yaw         = hand.getYaw();
boolean hand_is_left     = hand.isLeft();
boolean hand_is_right    = hand.isRight();
float   hand_grab        = hand.getGrabStrength();
float   hand_pinch       = hand.getPinchStrength();
float   hand_time        = hand.getTimeVisible();
PVector sphere_position  = hand.getSpherePosition();
float   sphere_radius    = hand.getSphereRadius();




  for(Tool tool : leap.getTools())
  {


    // ----- BASICS -----

    int     tool_id           = tool.getId();
    PVector tool_position     = tool.getPosition();
    PVector tool_stabilized   = tool.getStabilizedPosition();
    PVector tool_velocity     = tool.getVelocity();
    PVector tool_direction    = tool.getDirection();
    float   tool_time         = tool.getTimeVisible();


    // ----- DRAWING -----
     println(tool_position);   
     tool.draw();


    // ----- TOUCH EMULATION -----

    int     touch_zone        = tool.getTouchZone();
    float   touch_distance    = tool.getTouchDistance();

    switch(touch_zone){
      case -1: // None
        break;
      case 0: // Hovering
        // println("Hovering (#"+tool_id+"): "+touch_distance);
        break;
      case 1: // Touching
        // println("Touching (#"+tool_id+")");
        break;
    }
  }

}

// ========= DEVICES =========

for(Device device : leap.getDevices()){ float device_horizontal_view_angle = device.getHorizontalViewAngle(); float device_verical_view_angle = device.getVerticalViewAngle(); float device_range = device.getRange(); }

}

// ========= CALLBACKS =========

void leapOnInit(){ // println("Leap Motion Init"); } void leapOnConnect(){ // println("Leap Motion Connect"); } void leapOnFrame(){ // println("Leap Motion Frame"); } void leapOnDisconnect(){ // println("Leap Motion Disconnect"); } void leapOnExit(){ // println("Leap Motion Exit"); }

Answers

Sign In or Register to comment.