Python request for object orientation bug

Report crashes, strange behaviour, or apparent bugs
Post Reply
kleinash
Posts: 112
Joined: 28 Sep 2014, 09:58

Python request for object orientation bug

Post by kleinash »

Hi,

I am getting the object orientation using Python remote API:

Code: Select all

res, kinectHandle = vrep.simxGetObjectHandle(clientID, 'kinect', vrep.simx_opmode_oneshot_wait)
res, cupHandle = vrep.simxGetObjectHandle(clientID, 'Cup_visible_transparent', vrep.simx_opmode_oneshot_wait)
res, cupOrientation = vrep.simxGetObjectOrientation(clientID, cupHandle, kinectHandle, vrep.simx_opmode_streaming)
time.sleep(5) # pause needed for server side communication
res, cupOrientation = vrep.simxGetObjectOrientation(clientID, cupHandle, kinectHandle, vrep.simx_opmode_buffer)
but each time I run the simulation again it seams to change the orientation value - even though nothing has changed in the scene??

and when using relative orientation - should it always be 0 wrt itself?

Thanks..

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

Re: Python request for object orientation bug

Post by coppelia »

Hello,

in your example you are retrieving the orientation of the cup, relative to the kinect.
Also, the first call to simxGetObjectOrientation is never returning a valid value, it is just starting data streaming for the specified command.

Now, can you show us the values returned that are always different? You have to be aware that the cup might be moving a tiny little bit depending on the settings you chose for your physics parameters.

Cheers

ktang
Posts: 1
Joined: 30 Dec 2014, 13:54

Re: Python request for object orientation bug

Post by ktang »

Hi, I am seeing an issue with the python simxGetObjectOrientation call too:
I have a prox sensor attached to BubbleRob. I verified the sensor's orientation to be (-1.57, 1.39,-3.14) via Lua script, which matches with UI display.
But in my python call (simxGetObjectOrientation), i get (-1.57, 1.39,3.14). I.e, gama value has the opposite sign of the Lua returned value.
While this issue does not affect other calculations, I am, however, curious why Lua and external API would return different values.
Thanks

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

Re: Python request for object orientation bug

Post by coppelia »

Hello,

this is probably due to the second / third argument of the simGetObjectOrientation / simxGetObjectOrientation function: it defines an object handle relative to which reference frame you want to Euler angles. Use -1 for absolute Euler angles.

Cheers

Post Reply