SimxGetObjectHandle in Remote API

Typically: "How do I... ", "How can I... " questions
Post Reply
bruss86
Posts: 6
Joined: 20 Feb 2014, 22:07

SimxGetObjectHandle in Remote API

Post by bruss86 » 10 Mar 2014, 17:53

Hello again, thanks for the prompt response my first problem. Now's the second:
I am creating a program for how the simulator using remote API. First run simxStart ((simxChar *) "127.0.0.1", 19997, true, true, 2000,5) to communicate, then run simxStartSimulation (clientID, simx_opmode_oneshot) to start the simulation. All good, but when you get the Object Handle with simxGetObjectHandle(clientID,(simxChar*)"Revolute_joint#",(simxInt*)jointHandle,simx_opmode_oneshot);, jointHandle get the variable to 0. I could tell if I'm doing things right.
I also wanted to ask if I have the child script to define simExtRemoteApiStart (19997) when using the simulator as I am doing.

Thank you. regards

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

Re: SimxGetObjectHandle in Remote API

Post by coppelia » 11 Mar 2014, 10:49

Hello,

normally, when you start V-REP, there is a remote API server service running on port 19997. So you do not need to start a new one on the V-REP side on that port.
In your case, when retrieving an object handle, use a blocking mode: simx_opmode_oneshot_wait, since a non-blocking mode (e.g. simx_opmode_oneshot) will directly return without waiting for a reply from the server (V-REP).

Make sure you have read and understood this section, otherwise you will make many mistakes using the remote API.

Cheers

Post Reply