I have a problem that my python remote API calls are getting slower and slower whenever I run a simulation.
I run in synchronous mode.
For get handles calls I'm doing like this:
Code: Select all
errorCode, handle = vrep.simxGetObjectHandle(self.clientID, string, vrep.simx_opmode_blocking)
Code: Select all
vrep.simxGetObjectPosition(self.clientID, self.hexapod, -1, vrep.simx_opmode_streaming)
Code: Select all
while (vrep.simxGetConnectionId(self.clientID) != -1):
[result,position]=vrep.simxGetObjectPosition(self.clientID, self.hexapod, -1, vrep.simx_opmode_buffer)
if (result==vrep.simx_return_ok):
return position
Code: Select all
vrep.simxGetObjectPosition(self.clientID, self.hexapod, -1, vrep.simx_opmode_discontinue)
For set variable calls I'm using the simx_opmode_oneshot or simx_opmode_oneshot_wait operators.
I thought doing like this would prevent the simulation from slowing down but it still does. How do I know it's getting slower? I'm timing my simxSynchronousTrigger call which are getting longer and longer during simulation.
Is there something else to have in mind in order to not get any memory leaks or whatever is causing this issue?
I can show more code if necessary but I tried to extract the important parts and thought it would be more helpful than just printing all my code.