Closed psychemedia closed 7 years ago
Hello @psychemedia. I think, that exception has been happen because the last connection was not closed. I will create closeConnection
(simxFinish) method and add it to RAII method.
If you want to avoid this error right now, you can open the connection in separate cell and don't stop them. Example:
Cell [1] (don't touch this cell anymore):
# class definitions, imports, etc...
api = VRep.connect("127.0.0.1", 19997)
Cell [2]:
api.simulation.start() # the same thing that you manually press `Start` button in v-rep
r = PioneerP3DX(api)
for _ in range(100):
rl = r.right_length()
ll = r.left_length()
if rl > 0.01 and rl < 10:
r.rotate_left()
elif ll > 0.01 and ll < 10:
r.rotate_right()
else:
r.move_forward()
time.sleep(0.1)
api.simulation.stop() # the same thing that you manually press `Stop` button in v-rep
@psychemedia i had fixed this and now a connection is automatically close. Update the library by pip install 'git+https://github.com/Troxid/vrep-api-python' --upgrade
and try again.
Great, thanks... that works far more cleanly:-)
(Thanks for posting this example...)
I can get the Pioneer example running by executing the example code in a code cell in a Jupyter notebook, and stopping the cell execution stops the simulator. But if I then try to re-run the code cell, to rerun the demo, I get an error:
The only way I can reconnect from the notebook is to restart the notebook kernel and then re-run the cell?