[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 »

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: 10339
Joined: 14 Dec 2012, 00:25

Re: [JAVA] simxgetcollectionhandle method missing

Post by coppelia »

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 »

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

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

Re: [JAVA] simxgetcollectionhandle method missing

Post by coppelia »

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 »

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: 10339
Joined: 14 Dec 2012, 00:25

Re: [JAVA] simxgetcollectionhandle method missing

Post 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

Post Reply