Open melMass opened 3 years ago
How long did you wait? Since this demo does not register a video or depth callback, those streams are never started and so the runloop blocks at freenect_process_events()
because there are no events. When I run demo_tilt.py
it fires once every 60 seconds, which corresponds to the timeout for that call.
Kind of related to #474
All samples work, but the
demo tilt
loop is never run. What is strange is that it is blocking the program properly, but even if I print something in the first line ofbody
, I don't see anythingOriginal Sample
```python #!/usr/bin/env python import freenect import time import random import signal keep_running = True last_time = 0 def body(dev, ctx): global last_time if not keep_running: raise freenect.Kill if time.time() - last_time < 3: return last_time = time.time() led = random.randint(0, 6) tilt = random.randint(0, 30) freenect.set_led(dev, led) freenect.set_tilt_degs(dev, tilt) print('led[%d] tilt[%d] accel[%s]' % (led, tilt, freenect.get_accel(dev))) def handler(signum, frame): """Sets up the kill handler, catches SIGINT""" global keep_running keep_running = False print('Press Ctrl-C in terminal to stop') signal.signal(signal.SIGINT, handler) freenect.runloop(body=body) ```Working example if I instance a CV window and use the
```python #!/usr/bin/env python import freenect import time import random import signal import cv2 import frame_convert2 cv2.namedWindow("RGB") keep_running = True last_time = 0 def body(*args): dev = args[0] print("body") global last_time print(last_time) if not keep_running: raise freenect.Kill if time.time() - last_time < 3: return last_time = time.time() led = random.randint(0, 6) tilt = random.randint(0, 30) freenect.set_led(dev, led) freenect.set_tilt_degs(dev, tilt) print("led[%d] tilt[%d] accel[%s]" % (led, tilt, freenect.get_accel(dev))) def handler(signum, frame): """Sets up the kill handler, catches SIGINT""" global keep_running keep_running = False def display_rgb(dev, data, timestamp): global keep_running cv2.imshow("RGB", frame_convert2.video_cv(data)) if cv2.waitKey(10) == 27: keep_running = False print("Press Ctrl-C in terminal to stop") signal.signal(signal.SIGINT, handler) print("Running loop") freenect.runloop(video=display_rgb, body=body) ```video
callback then the loop is run