Missing DIO JNI Implementation

Today I was attempting to do some simple testing of a cheap ultrasonic sensor on the roboRio and I encountered an error I’ve never seen before on the RIOs.

The code involved sending a pulse out on a digital output, waiting, and receiving a pulse back from the sensor on a different pin. Bringing in our controls people to look at it, we found that this error message is generated on call to the pulse method of a DigitalOutput:

java: /Users/brad/allwpilib/wpilibj/wpilibJavaJNI/lib/DIOJNI.cpp:130: void Java_edu_wpi_first_wpilibj_hal_DIOJNI_pulse(JNIEnv*, jclass, jobject, jdouble, jobject): Assertion `false’ failed.

The next obvious step was to check out the source file of DIOJNI.cpp, and well, we found something interesting:

 * Class:     edu_wpi_first_wpilibj_hal_DIOJNI
 * Method:    pulse
 * Signature: (Ljava/nio/ByteBuffer;DLjava/nio/IntBuffer;)V
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_pulse
  (JNIEnv *, jclass, jobject, jdouble, jobject)


Now I’m not a doctor, but comparing that to the other methods in DIOJNI.cpp, it seems like the implementation is missing. Is there a WPILIB update for this?

Bugs can be reported at the location linked here: http://wpilib.screenstepslive.com/s/4485/m/24193/l/144990-support-resources

Thanks for bringing this to our attention, apparently we missed a few functions for the JNI bindings. We’ll have a fix in for the next release.

Thanks both! I’ve reported as a bug on Teamforge; in the meantime I went ahead and implemented the missing JNI DIO bindings, but won’t be able to test until tomorrow. If it works I’ll attach my patch to the bug report on Teamforge.


  • Team #2607 controls mentor

We performed a very quick test of our patched library this morning, and at least the DO pulse method works…so now the Ultrasonic class also works.

I’ve attached the patched DIOJNI.cpp source file to the Teamforge bug report for review.

In case any other teams out there need this library working before the official wpilibj update is issued, attached is our unofficial updated library. To use it in a robot program, just unzip and use the JDK jar utility to update your robot jar file (FRCUserProgram.jar) to replace the original JNI library with the attached updated library. Easier than fiddling with the any build scripts.

We ran into this problem as well. Where can I go to download the official release? How do I install once I get it?

Ok, so I figured out that I can replace the libwpilibJavaJNI.so file inside of <home>wpilib\java\current\lib\WPILib.jar with the .so file attached to this thread. This way every time I build the distribution jar (FRCUserProgram.jar), the new .so is there.

However, I still haven’t figured out where I can find new ‘official’ releases of WPILib.jar

Alright, sorry for all the chatter here, but I think I just figured it out. Updating the eclipse plugin seemed to update my wpilib jar. (Inside eclipse go to Help -> Check for updates.)