Page 1 of 1

Possible error in simxGetObjectPosition

Posted: 07 Mar 2014, 02:13
by zerokol
I'm trying to retrieve a object position from remote API with C++, the function is simxGetObjectPosition, I'm doing everything equal in an old source (Working), but now no matter which operation mode I use (I tried simx_opmode_streaming and simx_opmode_buffer) but always I get => There is no command reply in the input buffer. This should not always be considered as an error, depending on the selected operation mode
What would be?

Re: Possible error in simxGetObjectPosition

Posted: 07 Mar 2014, 11:39
by coppelia
Hello,

I suppose you are using the last version of the remote API (at comes with V-REP 3.1.0)?
Can you show us a small example of your code?
You have to understand that a streaming operation mode, needs some time before you are able to read the data: when you enable data streaming, e.g. with:

Code: Select all

int position[3];
result=simxGetObjectPosition(clientId,objectHandle,position,simx_opmode_streaming);
the result will never be simx_error_noerror. Most probably it will be simx_error_novalue_flag, because above command will simply send a notification to the server (i.e. V-REP) so that it starts sending data. The data will start arriving a little bit later (typically 5-20 ms later). Then, you will be able to read the streamed data with:

Code: Select all

int position[3];
if (simx_error_noerror==simxGetObjectPosition(clientId,objectHandle,position,simx_opmode_buffer))
{
    // position contains valid data here
}
Details and other operation modes are described here.

Cheers

Re: Possible error in simxGetObjectPosition

Posted: 10 Mar 2014, 20:18
by zerokol
Correctly, I was comparing with simx_error_noerror, your solution works well!!!
Thanks!!!