Hello
I have been developing some code using remote API and I noticed that whenever I use simx_opmode_oneshot_wait flag for remote calls my application hangs for 5 seconds (+/- some milis) and gets novalue and timeout flag. I tested even on the most basic function such as simxStartSimulation(). I can see that V-REP starts simulation (so the call succeeded), but remote application is hanging for no reason.
I use 3.1.2 V-REP version. Windows 7. Java 7 32bit on 64bit machine, update 71.
Thanks for help
Long responses via remote API
Re: Long responses via remote API
Hello,
first of all, try to update to the last V-REP version. Then, it is normal that when you estabilsh the connection, it takes a little bit of time, but this is usually under one second.
Have you tried to run some very simple code? Can you show us that code? What does simxGetPingTime return?
Cheers
first of all, try to update to the last V-REP version. Then, it is normal that when you estabilsh the connection, it takes a little bit of time, but this is usually under one second.
Have you tried to run some very simple code? Can you show us that code? What does simxGetPingTime return?
Cheers
Re: Long responses via remote API
I have downloaded the latest version. I ran simpleTest.java that is in V-REP directory. I added line that calls ping and received
result: 3 ping: 5000 ms
full code:
result: 3 ping: 5000 ms
full code:
Code: Select all
package robust.pc.examples;
import coppelia.IntW;
import coppelia.remoteApi;
public class VRepTest {
static remoteApi vrep = new remoteApi();
public static void main (String [] args)
{
System.out.println("connect");
int clientId = vrep.simxStart("127.0.0.1", 33333, true, true, 5000, 5);
if (clientId == -1)
{
throw new RuntimeException("Connection error");
}
System.out.println("start simulation");
vrep.simxStartSimulation(clientId, vrep.simx_opmode_oneshot);
System.out.println("get distance handle");
IntW distanceHandle = new IntW(0);
int result = vrep.simxGetDistanceHandle(clientId, "sensingNose", distanceHandle, remoteApi.simx_opmode_oneshot);
System.out.println(result);
result = vrep.simxGetPingTime(clientId, distanceHandle);
System.out.println(String.format("[PING] result: %d ping: %d ms", result, distanceHandle.getValue()));
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
vrep.simxStopSimulation(clientId, vrep.simx_opmode_oneshot_wait);
vrep.simxFinish(clientId);
}
}
Re: Long responses via remote API
A return value of 3 means (that value is bit-coded):
That means your connection to V-REP is not running correctly.
Then, looking at your code, it also seems you haven't understood how the remote API works: you cannot use simx_opmode_oneshot to retrieve a value!
Cheers
- No value (1)
- Timeout (2)
That means your connection to V-REP is not running correctly.
Then, looking at your code, it also seems you haven't understood how the remote API works: you cannot use simx_opmode_oneshot to retrieve a value!
Cheers
Re: Long responses via remote API
I think I have found the cause of the problem: I used old dll . After updating V-REP version I had to replace with new dll and problem with long responses are gone