OpenNI UserTracker.java sample crashes
Asked Answered
R

1

15

I've built OpenNI and Sensor from source on Github and installed Nite. I've tested this on Debian with 2.6.39 kernel and with different versions of Java, and on another computer with Lubuntu 11.04 and also with OpenNI unstable and avin2 Sensor - same result. I've also tested with prebuilt binaries.

The UserTracker sample in C++ and .NET works, but the UserTracker.java runs, detects my silhouette, and then the JVM crashes when I make the calibration pose. This is the output before the crash:

New user 1
Pose Psi detected for 1

I've tried playing around with the code, but I can't find the piece of code that causes it - it doesn't crash in PoseDetectedObserver.update.

Here is the link to the example in question: https://github.com/OpenNI/OpenNI/blob/master/Samples/UserTracker.java/org/OpenNI/Samples/UserTracker/UserTracker.java

Has anyone else encountered this problem, or perhaps sees what could be wrong?

edit: I've turned on logging in the SamplesConfig.xml, and the Java samples output these warnings on startup, while the C++ and .NET samples, just have that last one - that's the only difference I find in the logs.

  125 INFO       OpenNI version is 1.3.2 (Build 3)-Linux-x86 (Jul 28 2011 03:43:14)
  141 INFO       Filter Info - minimum severity: WARNING, masks: ALL
 2482 WARNING    Failed loading lib: /usr/lib/libXnVFeatures_1_3_0.so: undefined symbol: xnOSStrFormat

 2489 WARNING    Failed to load '/usr/lib/libXnVFeatures_1_3_0.so' - missing dependencies?
 4080 WARNING    Failed loading lib: /usr/lib/libXnVHandGenerator_1_3_0.so: undefined symbol: xnOSStrFormat

 4087 WARNING    Failed to load '/usr/lib/libXnVHandGenerator_1_3_0.so' - missing dependencies?
 7581 WARNING    Open named event: failed to open key file (2) - event might not exist...

edit2: I've now set a bounty and here's a verbose log file and dump from the latest unstable versions of OpenNI, NITE and avin2's SensorKinect on Lubuntu 11.04: http://pastebin.com/anG18agp http://pastebin.com/mAkf0G6M

Revivalist answered 26/7, 2011 at 14:38 Comment(2)
have you tried using the sun jvm, use the latest 1.6 release?Osteomalacia
yes, I'm currently using sun java 1.6.0_26, but I've also tried with openjdk 6 and 7... I think the problem is in those .so files that fail to load properly, because that's the only difference I can find in the verbose logs between the C++ and Java samples.Revivalist
I
6

there is an error in the java wrapper classes of OpenNI:

In org_OpenNI_NativeMethods.cpp is reads:

void XN_CALLBACK_TYPE PoseDetectionHandler(XnNodeHandle hNode, const XnChar* strPose, XnUserID user, void* pCookie)
{
    CallbackCookie* pCallback = (CallbackCookie*)pCookie;
    JNIEnvSupplier supplier;
    jstring jPose = supplier.GetEnv()->NewStringUTF(strPose);
    supplier.GetEnv()->CallVoidMethod(pCallback->obj, pCallback->mid, jPose, user);
    supplier.GetEnv()->ReleaseStringUTFChars(jPose, strPose);
}

But you are not supposed to releaseStringUTF a string allocated with newStringUTF... therefore it crashes.. See here for an example: http://www.velocityreviews.com/forums/t144581-crash-while-calling-releasestringutfchars-for-newstringutf-string.html

Get the source code... Uncomment the release line.. build the OpenNI.jni.dll and the usetracker.java will run!

Best regards, David

Insolvency answered 11/8, 2011 at 16:8 Comment(3)
I tried building the Openni source code but it gives me some weird errors. Do you have this OpenNI.jni.dll? Could you mail it to me. I am using win64.Sericeous
cooltechnomax, I can't help you... try posting the question and the errors at the OpenNI group groups.google.com/group/openni-dev ... comments are too short for such things and there are more people reading overthere.Revivalist
Oh, and the pullrequest with the fixed wrapper has been made on github, but is not yet closed: github.com/OpenNI/OpenNI/pull/35Revivalist

© 2022 - 2024 — McMap. All rights reserved.