[Python] Synchronizing V-Rep with a network in: -Another thread; or - Inside each iteration of V-Rep

Typically: "How do I... ", "How can I... " questions
Post Reply
zenmar
Posts: 1
Joined: 04 Apr 2018, 18:20

[Python] Synchronizing V-Rep with a network in: -Another thread; or - Inside each iteration of V-Rep

Post by zenmar » 10 Apr 2018, 15:36

Hi,

I'm trying to run a RNN that would compute / estimate the robots future location.
My problem is that it should take the robots own movement as input for the network, but since the networks speed is inconsistent and tends to get slower over time, I would need them to synchronize somehow.

I'm controlling V-Rep through Python using the remote API commands.
I tried running the network for a certain time inside the robots running loop (running the network for 50ms each iteration), trying to take advantage of vrep.simxSynchronous(clientID,True) and vrep.simxSynchronousTrigger(clientID); but somehow I can't get it to work correctly.

Would it be possible to run V-Rep in parallel with another thread, and make it wait for the simulation-step to finish before continuing?

Or would you have any suggestions on how to make simxSynchronous work?


Thank you very much!
Regards

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

Re: [Python] Synchronizing V-Rep with a network in: -Another thread; or - Inside each iteration of V-Rep

Post by coppelia » 12 Apr 2018, 07:27

Hello,

did you have a look at the example in programming/remoteApiBindings/python/python/simpleSynchronousTest.py? if you need to be informed when a simulation step has ended, you can stream an int signal, and increment that signal in a non-threaded child script: if your streamed signal (on the remote API client side) has changed, then the simulation step has finished executing (data is streamed from server to client at the end of a simulation step, never during a simulation step).

Cheers

Post Reply