shiffman / libfreenect

Just working on Processing library here
http://www.shiffman.net
122 stars 55 forks source link

reset kinect connection? #17

Closed johnbcarpenter closed 12 years ago

johnbcarpenter commented 12 years ago

i'm trying to run a sketch at 8 hours+ and am consistently getting crashes at around 4 hours. looked around quite a bit and the crashed seem to be a fairly common problem on some macs due to isochronous transfer frame scheduling problems?

would a hard reset of the kinect connection solve this? i've tried kinect.quit() and then variations on kinect.start(), but can't seem to enableDepth(true) because i get a null pointer error. any ideas--is this a possible work around? thanks in advance

johnbcarpenter commented 12 years ago

via one of daniel's link on another crashing issue... i think this may be a good solution: from http://groups.google.com/group/openkinect/browse_frm/thread/df3f3ee312145dff?pli=1

"The best solution that I've found so far (which is hacky and may make those actually familiar with USB driver programming smack their foreheads), is to edit src/usb_libusb10.c in libfreenect to restart isochronous transfers that die. After editing, it should read:

     FN_WARNING("Isochronous transfer error: %d ", xfer->status);
     libusb_submit_transfer(xfer);
     //strm->dead_xfers++;

You'll still get error messages (unless you comment out the warning line, I suppose), and the framerate may be affected, but the streams will at least stop freezing up."

but i'm to sure how to rebuild the openkinect library--can someone help me with this? the basic processing library examples use a build.xml file with ant in eclipse, but i'm having trouble figuring out which files/folders to open in eclipse.

i've managed to rebuild the libKinect.jnilib file (i think) from the xcode project in the wrappers folder, but not sure if just opening the xcode project file and changing the couple lines in usb_libusb10.c and hitting build is the correct way to do it... i'm also not sure where to start on recreating the openkinect.jar file. thanks

johnbcarpenter commented 12 years ago

ok, pretty sure you can just rebuild the libKinect.jnilib using the xcode project, but i don't think that was my issue... think my issue was a memory leak in the kinect.getRawDepth() call... you can see it in the point cloud example. if someone runs into this issue trying to do an 8 hour + install prior to this bug being fixed, i set up a system that has processing quit the app every four hours (using a conditional statement testing the hour / minute / second and then restarting the app with cron. i.e processing app quits at 3:59:58 and cron opens it up again at 4:00:00. will submit a bug about the memory leak.