本文整理汇总了Python中vrep.simxStopSimulation函数的典型用法代码示例。如果您正苦于以下问题:Python simxStopSimulation函数的具体用法?Python simxStopSimulation怎么用?Python simxStopSimulation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了simxStopSimulation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: restart
def restart(self,earlyStop = False):
if (self.cid != None):
vrep.simxStopSimulation(self.cid, self.mode())
vrep.simxSynchronousTrigger(self.cid)
vrep.simxFinish(-1) # just in case, close all opened connections
time.sleep(1)
self.connect()
time.sleep(1)
vrep.simxLoadScene(self.cid, '/home/elias/[email protected]/_Winter2015/CSC494/Scenes/Base_Quad.ttt', 0, self.mode())
if earlyStop:
vrep.simxStopSimulation(self.cid, self.mode())
vrep.simxSynchronousTrigger(self.cid)
vrep.simxFinish(-1) # just in case, close all opened connections
return
vrep.simxStartSimulation(self.cid, self.mode())
self.runtime = 0
err, self.copter = vrep.simxGetObjectHandle(self.cid, "Quadricopter_base",
vrep.simx_opmode_oneshot_wait)
err, self.target = vrep.simxGetObjectHandle(self.cid, "Quadricopter_target",
vrep.simx_opmode_oneshot_wait)
err, self.front_camera = vrep.simxGetObjectHandle(self.cid, 'Quadricopter_frontCamera', vrep.simx_opmode_oneshot)
err, lin, ang = vrep.simxGetObjectVelocity(self.cid, self.copter, vrep.simx_opmode_streaming)
self.getTargetStart()
for i in range(4):
self.propellerScripts[i] = vrep.simxGetObjectHandle(self.cid,
'Quadricopter_propeller_respondable' + str(i) + str(1),
self.mode())
示例2: cleanUp
def cleanUp(self):
print "About to stop simulation connected to self.simulID: ", self.simulID
vrep.simxStopSimulation(self.simulID, vrep.simx_opmode_oneshot)
vrep.simxSynchronousTrigger(self.simulID)
vrep.simxFinish(self.simulID)
vrep.simxFinish(-1)
print "Disconnected from V-REP"
示例3: close
def close(self, kill=False):
if self.connected:
remote_api.simxStopSimulation(self.api_id, remote_api.simx_opmode_oneshot_wait)
remote_api.simxFinish(self.api_id)
self.connected = False
if kill and self.vrep_proc is not None:
os.killpg(self.vrep_proc.pid, signal.SIGTERM)
示例4: reset_simulation
def reset_simulation(clientID):
vrep.simxStopSimulation(clientID, vrep.simx_opmode_oneshot)
time.sleep(1) # um pequeno sleep entre o stop e o start
vrep.simxStartSimulation(clientID, vrep.simx_opmode_oneshot)
for move in startMoves:
JointControl(clientID, 0, Body, move)
time.sleep(0.1)
示例5: disconnection
def disconnection(self):
"""
Make disconnection with v-rep simulator
"""
# stop the simulation:
vrep.simxStopSimulation(self.clientID,vrep.simx_opmode_oneshot_wait)
# Now close the connection to V-REP:
vrep.simxFinish(self.clientID)
示例6: finishSimulation
def finishSimulation(clientID):
errorStop=vrep.simxStopSimulation(clientID,vrep.simx_opmode_oneshot_wait)
errorClose=vrep.simxCloseScene(clientID,vrep.simx_opmode_oneshot_wait)
error=errorStop or errorClose
errorFinish=vrep.simxFinish(clientID)
error=error or errorFinish
return error
示例7: restart_simulation
def restart_simulation(self):
mode = vrep.simx_opmode_oneshot_wait
assert vrep.simxStopSimulation(self.clientID, mode) == 0, \
"StopSim Error"
time.sleep(0.1)
self.start_simulation()
self.num_sim_steps = 0
示例8: stop
def stop( self ):
"""
Stops the simulation
"""
err = vrep.simxStopSimulation( self.cid, vrep.simx_opmode_oneshot_wait )
time.sleep(0.01) # Maybe this will prevent V-REP from crashing as often
return hasattr(self, 'failed') # Returns true if this is a failed run
示例9: finishSimulation
def finishSimulation(self, clientID):
self.getObjectPositionFirstTime = True
errorStop=vrep.simxStopSimulation(clientID,vrep.simx_opmode_oneshot_wait)
errorClose=vrep.simxCloseScene(clientID,vrep.simx_opmode_oneshot_wait)
error=errorStop or errorClose
errorFinish=vrep.simxFinish(clientID)
error=error or errorFinish
return error
示例10: __init__
def __init__(self, n_robots, base_name):
self.name = "line follower tester"
self.n_robots = n_robots
self.base_name = base_name
self.robot_names = [self.base_name]
for i in range(self.n_robots-1):
self.robot_names.append(self.base_name+'#'+str(i))
# Establish connection to V-REP
vrep.simxFinish(-1) # just in case, close all opened connections
# Connect to the simulation using V-REP's remote API (configured in V-REP, not scene specific)
# http://www.coppeliarobotics.com/helpFiles/en/remoteApiServerSide.htm
self.clientID = vrep.simxStart('127.0.0.1', 19997, True, True, 5000, 5)
# Use port 19999 and add simExtRemoteApiStart(19999) to some child-script in your scene for scene specific API
# (requires the simulation to be running)
if self.clientID != -1:
print ('Connected to remote API server')
else:
print ('Failed connecting to remote API server')
sys.exit('Could not connect')
# Reset running simulation
vrep.simxStopSimulation(self.clientID, vrep.simx_opmode_oneshot)
time.sleep(0.2)
# Get initial robots' positions
self.robot_handles = []
self.robot_pos0 = []
for rbt_name in self.robot_names:
res, rbt_tmp = vrep.simxGetObjectHandle(self.clientID, rbt_name, vrep.simx_opmode_oneshot_wait)
self.robot_handles.append(rbt_tmp)
# Initialize data stream
vrep.simxGetObjectPosition(self.clientID, self.robot_handles[-1], -1, vrep.simx_opmode_streaming)
vrep.simxGetFloatSignal(self.clientID, rbt_name+'_1', vrep.simx_opmode_streaming)
vrep.simxGetFloatSignal(self.clientID, rbt_name+'_2', vrep.simx_opmode_streaming)
vrep.simxGetFloatSignal(self.clientID, rbt_name+'_3', vrep.simx_opmode_streaming)
time.sleep(0.2)
for rbt in self.robot_handles:
res, pos = vrep.simxGetObjectPosition(self.clientID, rbt, -1, vrep.simx_opmode_buffer)
self.robot_pos0.append(pos)
示例11: reset
def reset(self):
"""In VREP we reset a simulation by stopping and restarting it"""
eCode = vrep.simxStopSimulation(self._VREP_clientId, vrep.simx_opmode_oneshot_wait)
if eCode != 0:
raise Exception("Could not stop VREP simulation")
eCode = vrep.simxStartSimulation(self._VREP_clientId, vrep.simx_opmode_oneshot_wait)
if eCode != 0:
raise Exception("Could not start VREP simulation")
vrep.simxSynchronousTrigger(self._VREP_clientId)
示例12: reset_vrep
def reset_vrep():
print 'Start to connect vrep'
# Close eventual old connections
vrep.simxFinish(-1)
# Connect to V-REP remote server
clientID = vrep.simxStart('127.0.0.1', 19997, True, True, 5000, 5)
opmode = vrep.simx_opmode_oneshot_wait
# Try to retrieve motors and robot handlers
# http://www.coppeliarobotics.com/helpFiles/en/remoteApiFunctionsPython.htm#simxGetObjectHandle
ret_l, LMotorHandle = vrep.simxGetObjectHandle(clientID, "Pioneer_p3dx_leftMotor", opmode)
ret_r, RMotorHandle = vrep.simxGetObjectHandle(clientID, "Pioneer_p3dx_rightMotor", opmode)
ret_a, RobotHandle = vrep.simxGetObjectHandle(clientID, "Pioneer_p3dx", opmode)
vrep.simxSetJointTargetVelocity(clientID, LMotorHandle, 0, vrep.simx_opmode_blocking)
vrep.simxSetJointTargetVelocity(clientID, RMotorHandle, 0, vrep.simx_opmode_blocking)
time.sleep(1)
vrep.simxStopSimulation(clientID, vrep.simx_opmode_oneshot_wait)
vrep.simxFinish(clientID)
print 'Connection to vrep reset-ed!'
示例13: reset
def reset( self ):
err = vrep.simxStopSimulation(self.cid, vrep.simx_opmode_oneshot_wait)
time.sleep(1)
self.pos_err = [0,0,0]
self.ori_err = [0,0,0]
self.lin = [0,0,0]
self.ang = [0,0,0]
err = vrep.simxStartSimulation(self.cid, vrep.simx_opmode_oneshot_wait)
if SYNC:
vrep.simxSynchronous( self.cid, True )
示例14: reset_rob
def reset_rob(self):
"""
Sets the bubbleRob to his starting position; mind the hack, simulation has to be stopped
"""
##### Set absolute position
#stop simulation
vrep.simxStopSimulation(self.clientID,vrep.simx_opmode_oneshot_wait)
#100ms delay, this is a hack because server isn't ready either
time.sleep(0.3)
#set on absolute position
err = vrep.simxSetObjectPosition(self.clientID, self.bubbleRobHandle, -1, self.bubbleRobStartPosition, vrep.simx_opmode_oneshot_wait)
#start simulation again
vrep.simxStartSimulation(self.clientID,vrep.simx_opmode_oneshot_wait)
time.sleep(0.3)
示例15: resetSimulation
def resetSimulation(self):
returnCode = vrep.simx_return_novalue_flag
while returnCode!=vrep.simx_return_ok:
returnCode=vrep.simxStopSimulation(self.__clientID, vrep.simx_opmode_oneshot)
time.sleep(0.5)
time.sleep(0.5)
returnCode = vrep.simx_return_novalue_flag
while returnCode!=vrep.simx_return_ok:
returnCode=vrep.simxStartSimulation(self.__clientID, vrep.simx_opmode_oneshot)
time.sleep(0.5)
time.sleep(1.0)