cl.nui
Class VKinect

java.lang.Object
  extended by java.lang.Thread
      extended by cl.nui.VKinect
All Implemented Interfaces:
java.lang.Runnable

public class VKinect
extends java.lang.Thread

Kinect class for java on top of CLNUI from Code Laboratories. Windows only and it's having problems with running on Processing IDE. How to get started: 1) Create kinect object 2) Setup any flags if needed 3) Call init() 4) Access data. simple 5) Release

Author:
Victor Martins

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 long _elapsedTime
           
 long _longerTime
           
static int LED_BLINK_GREEN
           
static int LED_BLINK_RED_ORANGE
           
static int LED_GREEN
           
static int LED_OFF
           
static int LED_ORANGE
           
static int LED_RED
           
static int MODE_RAW
           
static int MODE_RGB32
           
static boolean USE_THREAD
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
VKinect()
           
 
Method Summary
 boolean createCamera()
          Prepare and setup kinect's camera
 boolean createMotor()
          Prepare and setup kinect's motor
 int[] getColor()
           
 int getColorAt(int x, int y)
           
 int getColorMode()
          Return raw depth map (11 bit values)
 int[] getDepth()
           
 int[] getDepth8()
           
 int getDepthAt(int x, int y)
           
 int getDepthMode()
           
 float getDistanceAt(int x, int y)
           
 float[] getDistanceData()
           
 float[] getDistanceDataNorm()
           
 int getHeight()
           
 boolean getInvertDepth()
           
 float getMaxDistance()
           
 float getMinDistance()
           
 float[] getMotorAccelerometer()
          Get motor's accelerometer's values for XYZ
 boolean getNoiseRemoval()
           
 float getNormDistanceAt(int x, int y)
           
 short[] getRawDepth()
           
 java.lang.String getSerial()
          Return a 12-digit string with the motor serial number
 int getWidth()
           
 boolean init()
          Start Kinect's motor and camera.
 boolean isCameraValid()
          Check if camera is available.
 boolean isMotorValid()
          Check if motor is available.
 void release()
          Release all.
 void run()
           
 void setColorMode(int mode)
          Set color capture mode.
 void setDepthMode(int mode)
          Set depth capture mode.
 void setInvertDepth(boolean flag)
           
 boolean setLedColor(int mode)
          Set kinect's LED.
 boolean setMotorTilt(int position)
          Set motor's head tilt position
 void setNoiseRemoval(boolean flag)
           
 void setTimeout(int colorTimeout, int depthTimeout)
          Set timeout values for color and depth data Time is in milliseconds
 boolean startCamera()
          Start camera.
 boolean stopCamera()
          Stop camera.
 boolean stopMotor()
          Stop motor
 void update()
          Update data
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

USE_THREAD

public static boolean USE_THREAD

LED_OFF

public static final int LED_OFF
See Also:
Constant Field Values

LED_GREEN

public static final int LED_GREEN
See Also:
Constant Field Values

LED_RED

public static final int LED_RED
See Also:
Constant Field Values

LED_ORANGE

public static final int LED_ORANGE
See Also:
Constant Field Values

LED_BLINK_GREEN

public static final int LED_BLINK_GREEN
See Also:
Constant Field Values

LED_BLINK_RED_ORANGE

public static final int LED_BLINK_RED_ORANGE
See Also:
Constant Field Values

MODE_RAW

public static final int MODE_RAW
See Also:
Constant Field Values

MODE_RGB32

public static final int MODE_RGB32
See Also:
Constant Field Values

_longerTime

public long _longerTime

_elapsedTime

public long _elapsedTime
Constructor Detail

VKinect

public VKinect()
Method Detail

init

public boolean init()
             throws java.lang.Exception
Start Kinect's motor and camera. This should be used if you're not running processing

Throws:
java.lang.Exception

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

update

public void update()
Update data


getSerial

public java.lang.String getSerial()
Return a 12-digit string with the motor serial number

Returns:

createMotor

public boolean createMotor()
Prepare and setup kinect's motor

Returns:

createCamera

public boolean createCamera()
Prepare and setup kinect's camera

Returns:

startCamera

public boolean startCamera()
Start camera. Make sure you have created it before calling this method

Returns:

stopCamera

public boolean stopCamera()
Stop camera. Call this before destroying it

Returns:

stopMotor

public boolean stopMotor()
Stop motor

Returns:

setLedColor

public boolean setLedColor(int mode)
Set kinect's LED. index: 0 LED off 1 LED Green 2 LED Red 3 LED Orange 4/5 LED Blink Green 6/7 LED Blink Red/Orange

Parameters:
mode -
Returns:

setMotorTilt

public boolean setMotorTilt(int position)
Set motor's head tilt position

Parameters:
position -
Returns:

getMotorAccelerometer

public float[] getMotorAccelerometer()
Get motor's accelerometer's values for XYZ

Returns:
array

isCameraValid

public boolean isCameraValid()
Check if camera is available. I prefer to use this to check if object were created, instead of checking on every method.


isMotorValid

public boolean isMotorValid()
Check if motor is available. I prefer to use this to check if object were created, instead of checking on every method.


getColorMode

public int getColorMode()
Return raw depth map (11 bit values)

Parameters:
timeOut -
Returns:

setColorMode

public void setColorMode(int mode)
Set color capture mode. Available modes are RAW and RGB32

Parameters:
mode -

getDepthMode

public int getDepthMode()

setDepthMode

public void setDepthMode(int mode)
Set depth capture mode. Available modes are RAW and RGB32

Parameters:
mode -

setTimeout

public void setTimeout(int colorTimeout,
                       int depthTimeout)
Set timeout values for color and depth data Time is in milliseconds

Parameters:
colorTimeout -
depthTimeout -

getColor

public int[] getColor()

getDepth

public int[] getDepth()

getRawDepth

public short[] getRawDepth()

getDepth8

public int[] getDepth8()

getDistanceData

public float[] getDistanceData()

getDistanceDataNorm

public float[] getDistanceDataNorm()

getMinDistance

public float getMinDistance()

getMaxDistance

public float getMaxDistance()

getWidth

public int getWidth()

getHeight

public int getHeight()

getColorAt

public int getColorAt(int x,
                      int y)

getDepthAt

public int getDepthAt(int x,
                      int y)

getDistanceAt

public float getDistanceAt(int x,
                           int y)

getNormDistanceAt

public float getNormDistanceAt(int x,
                               int y)

getInvertDepth

public boolean getInvertDepth()

setInvertDepth

public void setInvertDepth(boolean flag)

getNoiseRemoval

public boolean getNoiseRemoval()

setNoiseRemoval

public void setNoiseRemoval(boolean flag)

release

public void release()
Release all.