I have been using the "Legacy Remote API" for Python for a long time and I think it is time to upgrade to the new ZMQ Remote API. For this, I am working with Coppelia 4.4 on Ubuntu20.04.
With the Legacy Remote API I had been working in Synchronous mode and wanted to do the same with the ZMQ. However, I have encountered a problem in my first tests, related to the reset of the scene by a stop, and subsequent start.
I've done a simple example to show that.
Code: Select all
import numpy as np
from zmqRemoteApi import RemoteAPIClient
def main():
print('Program started')
client = RemoteAPIClient()
sim = client.getObject('sim')
time_steps_each_evaluation = 5
time_steps_each_angular_increment = 40
angular_increment = 20.0 * np.pi/180.0
while (True):
alfa = 45.0 * np.pi/180.0
beta = 0.0
gama = 0.0
client.setStepping(True)
j1 = sim.getObject("/j1")
j2 = sim.getObject("/j2")
j3 = sim.getObject("/j3")
sim.startSimulation()
for timeStep in range(0, time_steps_each_evaluation):
alfa = alfa + angular_increment
beta = beta + angular_increment
gama = gama + angular_increment
sim.setJointTargetPosition(j1, alfa)
sim.setJointTargetPosition(j2, beta)
sim.setJointTargetPosition(j3, gama)
# ---- Getting Stuck here ----
for m in range(0, time_steps_each_angular_increment):
client.step()
sim.stopSimulation()
I also add a link to the scene https://www.dropbox.com/s/gpmt86uqfll4s ... o.ttt?dl=0
Any help would be appreciated.
Regards!