Java RemoteAPI streaming

Typically: "How do I... ", "How can I... " questions
bnewman
Posts: 7
Joined: 05 Jul 2013, 19:51

Java RemoteAPI streaming

Hello,

I'm running the Khepera3 robot through remoteAPI in Java. When attempting to initialize the GetVisionSensor or the GetJointPosition with the recommended first call of streaming, I an error in java.

Code: Select all

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000107d8e269, pid=24524, tid=5891
#
# JRE version: 7.0_09-b05
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.5-b02 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.dylib+0x2a5269]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#

Here is the initializing code.

Code: Select all

IntWA robotVisionHandles = new IntWA(1);
FloatWAA[] irBottomDetectionPoint = new FloatWAA[2];
BoolW[] irBottomDetectionState = new BoolW[2];

sim.simxGetObjects(clientID, sim.sim_object_visionsensor_type,
robotVisionHandles, sim.simx_opmode_oneshot_wait);

for (int i = 0; i < 2; i++) {
irBottomDetectionPoint[i] = new FloatWAA(1);
irBottomDetectionState[i] = new BoolW(false);

irBottomDetectionState[i], irBottomDetectionPoint[i], // irBottomDetectionState[i]
sim.simx_opmode_streaming);
System.out.println("Initialize Vis: " + irV);
}

for (int i = 0; i < 2; i++) {
irBottomDetectionState[i], irBottomDetectionPoint[i], sim.simx_opmode_buffer);
if (irV == sim.simx_error_noerror) {
System.out.println("In buffer2: " + ++visInCount + ", " + irV);
bottom2Sensor[i] = irBottomDetectionPoint[i].getArray()[0].getArray()[10];
}
else
System.out.println("No buffer2: " + ++visOutCount + ", " + irV);
}

The return value of the GetVisionSensor method with streaming returns the value 1. I initialize and get the joint positions the same way, but both give this error.

For the simxReadProximitySensor, I initialize the same way with streaming then buffer for the rest. This works when I don't attempt to initialize the Vision or Joint. I have attempted to initialize and run the Vision independently and still get the same error.

I upgraded from 3.0.3 to 3.0.4 on Windows and MacOSX. On 3.0.3 in Windows, the streaming for vision and joint seemed to work well, but did not in OSX (crashed the program) and now it is giving this error in the console for both Windows and OSX in 3.0.4. Is there an issue with my initialization or use of the methods?

I am using Java 7 , OSX 10.8.4(64-bit), Windows XP(32-bit) and Windows 8 (64-bit).

coppelia
Posts: 8047
Joined: 14 Dec 2012, 00:25

Re: Java RemoteAPI streaming

Hello Billy,

indeed. And strangely enough, it is again (and only) the simxReadVisionSensor function that is affected, but this time on the client side.

Here the fixed libraries:
Again, sorry for the trouble.

Cheers

bnewman
Posts: 7
Joined: 05 Jul 2013, 19:51

Re: Java RemoteAPI streaming

Thank you again for the quick response. Everything seems to be working just fine now. Both ReadVisionSensor and GetJointPosition are working.

Billy

p.s - This has only been tested on OSX so far.