Page 1 of 1

[JAVA] simxgetcollectionhandle method missing

Posted: 26 Jul 2016, 22:08
by STAIRSTEP - LU
I'm attempting to call simxGetCollectionHandle so that I can use simxGetObjectGroupData and get data from my collection of proximity sensors. However, when I attempt to call the method, it gives me the error that the method doesn't exist. I'm using the remoteApi.dll from VREP 3.3.1 in my src folder in Eclipse.

Re: [JAVA] simxgetcollectionhandle method missing

Posted: 27 Jul 2016, 08:50
by coppelia
Hello,

for the Java remote API you need to use remoteApiJava.dll, not remoteApi.dll

Cheers

Re: [JAVA] simxgetcollectionhandle method missing

Posted: 27 Jul 2016, 19:17
by STAIRSTEP - LU
I apologize, remoteApiJava.dll is the .dll file that I have installed. I got it in the 64Bit folder.

Re: [JAVA] simxgetcollectionhandle method missing

Posted: 28 Jul 2016, 08:29
by coppelia
Can you show us the code you are using to call that function? Also, what is the exact error message?

Cheers

Re: [JAVA] simxgetcollectionhandle method missing

Posted: 28 Jul 2016, 18:57
by STAIRSTEP - LU

Code: Select all

public int getStateTESTER() {
		IntW sensor_handle = new IntW(1);
		int ObjectHandle = Simulation.vrep.simxGetCollectionHandle(Simulation.clientID, "IR_Sensors", sensor_handle,
			remoteApi.simx_opmode_oneshot);
		// Simulation.vrep.simxGetObjectGroupData(clientID, objectType, dataType, handles, intData, floatData, stringData,
		// operationMode);
		return 0;
	}
And it gives the error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method simxGetCollectionHandle(int, String, IntW, int) is undefined for the type remoteApi

Re: [JAVA] simxgetcollectionhandle method missing

Posted: 29 Jul 2016, 08:29
by coppelia
We cannot reproduce your error.

Can you try with following simple program:

Code: Select all

import coppelia.IntW;
import coppelia.remoteApi;

public class test
{
    public static void main(String[] args)
    {
        System.out.println("Program started");
        remoteApi vrep = new remoteApi();
        vrep.simxFinish(-1);
        int clientID = vrep.simxStart("127.0.0.1",19997,true,true,5000,5);
        if (clientID!=-1)
        {
            System.out.println("Connected to remote API server");	
            IntW collectionHandle = new IntW(-1);
            int ret=vrep.simxGetCollectionHandle(clientID,"myCollection",collectionHandle,vrep.simx_opmode_blocking);
            System.out.format("Function returned: %d, the collection handle is: %d\n",ret,collectionHandle.getValue());
            vrep.simxFinish(clientID);
        }
        else
            System.out.println("Failed connecting to remote API server");
        System.out.println("Program ended");
    }
}
Cheers