Created
February 19, 2013 00:14
-
-
Save thecapacity/4981937 to your computer and use it in GitHub Desktop.
Simple demo for using Kinect with freenect's python wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import freenect | |
import time | |
import sys | |
TILT_MAX = 30 | |
TILT_STEP = 10 | |
TILT_START = 0 | |
if sys.argv[1]: TILT_MAX = int(sys.argv[1]) | |
if sys.argv[2]: TILT_STEP = int(sys.argv[2]) | |
if sys.argv[2]: TILT_START = int(sys.argv[3]) | |
ctx = freenect.init() | |
dev = freenect.open_device(ctx, freenect.num_devices(ctx) - 1) | |
if not dev: | |
freenect.error_open_device() | |
print "Starting TILT Cycle" | |
for tilt in xrange(TILT_START, TILT_MAX+TILT_STEP, TILT_STEP): | |
print "Setting TILT: ", tilt | |
freenect.set_tilt_degs(dev, tilt) | |
time.sleep(3) | |
freenect.set_tilt_degs(dev, 0) |
Hey man,
I have a problem and thought maybe you could help me with it. When i use the freenect.open_device i can't use freenect.sync_get_depth() anymore. It becomes NoType
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Took me a while to find how to get the device and context, so I wanted to share
To play with the LED instead:
for i in xrange(0, 6):
print "Setting LED: ", i
freenect.set_led(dev, i)
time.sleep(3)
freenect.set_led(dev, 0)