Possible error in simxGetObjectPosition

Report crashes, strange behaviour, or apparent bugs
Post Reply
zerokol
Posts: 10
Joined: 15 Jun 2013, 02:00
Location: Brazil
Contact:

Possible error in simxGetObjectPosition

Post 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?

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

Re: Possible error in simxGetObjectPosition

Post 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

zerokol
Posts: 10
Joined: 15 Jun 2013, 02:00
Location: Brazil
Contact:

Re: Possible error in simxGetObjectPosition

Post by zerokol »

Correctly, I was comparing with simx_error_noerror, your solution works well!!!
Thanks!!!

Post Reply