[JAVA] simxgetcollectionhandle method missing

Report crashes, strange behaviour, or apparent bugs
Post Reply
STAIRSTEP - LU
Posts: 5
Joined: 29 Jun 2016, 19:53

[JAVA] simxgetcollectionhandle method missing

Post by STAIRSTEP - LU » 26 Jul 2016, 22:08

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.

coppelia
Site Admin
Posts: 6559
Joined: 14 Dec 2012, 00:25

Re: [JAVA] simxgetcollectionhandle method missing

Post by coppelia » 27 Jul 2016, 08:50

Hello,

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

Cheers

STAIRSTEP - LU
Posts: 5
Joined: 29 Jun 2016, 19:53

Re: [JAVA] simxgetcollectionhandle method missing

Post by STAIRSTEP - LU » 27 Jul 2016, 19:17

I apologize, remoteApiJava.dll is the .dll file that I have installed. I got it in the 64Bit folder.

coppelia
Site Admin
Posts: 6559
Joined: 14 Dec 2012, 00:25

Re: [JAVA] simxgetcollectionhandle method missing

Post by coppelia » 28 Jul 2016, 08:29

Can you show us the code you are using to call that function? Also, what is the exact error message?

Cheers

STAIRSTEP - LU
Posts: 5
Joined: 29 Jun 2016, 19:53

Re: [JAVA] simxgetcollectionhandle method missing

Post by STAIRSTEP - LU » 28 Jul 2016, 18:57

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

coppelia
Site Admin
Posts: 6559
Joined: 14 Dec 2012, 00:25

Re: [JAVA] simxgetcollectionhandle method missing

Post by coppelia » 29 Jul 2016, 08:29

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

Post Reply