def _start_simulation(self):
        """Tells a VREP scene to start execution."""

        if self.clientID is None:
            raise Exception('Client is not connected to V-REP server and '
                            'cannot start the simulation. Check the sim is '
                            'running and try connecting again.')

        r = vrep.simxStartSimulation(self.clientID, vrep.simx_opmode_blocking)

        if r != vrep.simx_return_ok:
            raise Exception('Unable to start simulation. Return code ', r)
        vrep.simxSynchronous(self.clientID, False)
Beispiel #2
0
    def execute_motion(self, vel_sets):
        #vrep.simxPauseSimulation(self.CLIENT_ID,0)
        vrep.simxSynchronous(self.CLIENT_ID, True)
        vrep.simxStartSimulation(self.CLIENT_ID, vrep.simx_opmode_oneshot)
        for dur, vels in vel_sets:
            vrep.simxPauseCommunication(self.CLIENT_ID, 1)
            for key in range(1, 19):
                vrep.simxSetJointTargetVelocity(self.CLIENT_ID,
                                                self.MOTOR_HANDLES[key],
                                                vels[key],
                                                vrep.simx_opmode_oneshot)

            vrep.simxPauseCommunication(self.CLIENT_ID, 0)
            time.sleep(dur)
            vrep.simxSynchronousTrigger(self.CLIENT_ID)

        vrep.simxPauseCommunication(self.CLIENT_ID, 1)
        for key in range(1, 19):
            vrep.simxSetJointTargetVelocity(self.CLIENT_ID,
                                            self.MOTOR_HANDLES[key], 0,
                                            vrep.simx_opmode_oneshot)
        vrep.simxPauseCommunication(self.CLIENT_ID, 0)
        vrep.simxSynchronousTrigger(self.CLIENT_ID)
Beispiel #3
0
def start_sim(clientID):
    vrep.simxStartSimulation(clientID, vrep.simx_opmode_oneshot)
 def start(self):
     vrep.simxStartSimulation(self.clientID, vrep.simx_opmode_oneshot)