Unable to restart the simulation from beginning using Remote API in Python

Typically: "How do I... ", "How can I... " questions
Post Reply
ravi
Posts: 54
Joined: 24 Oct 2016, 08:00

Unable to restart the simulation from beginning using Remote API in Python

Post by ravi » 05 Feb 2018, 06:31

I am trying to restart the simulation using Remote API in Python.

Below is the code snippet-

Code: Select all

vrep.simxStopSimulation(clientID, vrep.simx_opmode_blocking)
status = vrep.simxStartSimulation(clientID, vrep.simx_opmode_blocking)
if status != 0:
    raise Exception('Failed to reset simulation')
The issue is that after calling this code, the simulation stops but doesn't start. As I can see that the "Start Simulation" button is enabled in the simulator.

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

Re: Unable to restart the simulation from beginning using Remote API in Python

Post by coppelia » 07 Feb 2018, 17:57

Hello,

the reason is that when you send the stop simulation command, it will take several simulation steps until the simulation has halted. So you should wait until it has really stopped, before trying to start it again.

Cheers

ravi
Posts: 54
Joined: 24 Oct 2016, 08:00

Re: Unable to restart the simulation from beginning using Remote API in Python

Post by ravi » 08 Feb 2018, 07:44

Thanks! It worked.

Post Reply